# Refactoring Level-Set framework - V4

This page outlines the proposed changes to the current Level-Set framework. A number of these changes will break backwards compatibility.

## Authors

The proposed changes for the Level-Set framework are being proposed by the Megason-Lab, Systems Biology Department, Harvard Medical School.

Questions and comments regarding these changes should be sent to

- Arnaud Gelas (arnaud_gelas -at- hms.harvard.edu)
- Sean Megason (sean_megason -at- hms.harvard.edu)

Other team members include:

- Kishore Mosaliganti (kishore_mosaliganti -at- hms.harvard.edu)
- Nicolas Rannou (nicolas_rannou -at- hms.harvard.edu)

## Tcons

- 29 July. Attendees: Karthik Krishnan (Kitware), Lucas Antiga (Orobix), Kishore Mosaliganti (Harvard), Arnaud Gelas (Harvard)
- 11 August. Attendees: Luis Ibanez (Kitware), Ivo Sbalzarini (ETH), Kishore Mosaliganti (Harvard), Arnaud Gelas (Harvard)
- 18 August. Attendees: Gregory Paul (ETH), Kishore Mosaliganti (Harvard), Arnaud Gelas (Harvard)
- 1 September. Attendees: Olivier Bernard (Creatis), Joel Schaerer (Creatis), Kishore Mosaliganti (Harvard), Arnaud Gelas (Harvard)

## Ideas

### Term class

Represent on term of the PDE. First example of implementation (not complete) located at http://github.com/lantiga/ModularLevelSets.

- One weight (scalar)
- One Level Set Function
- virtual GetCFLContribution() = 0;
- virtual Value() = 0;
- virtual bool IsStreamable() = 0

### Term Container class

- std::map< id, Term > to be able to dynamically add/remove terms at any time during the evolution
- Virtual Value() = 0;
- bool IsStreamable(); // iterate on all term elements as long as there is streamable element.

### Term Sum Container

- Inherit form Term Container
- Implement Value as sum of all elements from the container

### Term Product Container

(Don't know yet the application, but it is theoretically possible to implement it as noticed by Joel Schaerer).

- Inherit form Term Container
- Implement Value as product of all elements from the container

### LevelSetFunctionBase

The level set function representation could be discrete, parametric (continuous)

- Virtual Value() = 0;
- Virtual Grad() = 0;
- Virtual Hessian() = 0;
- Virtual bool IsStreamable() = 0;

### LocalStructure

This structure will be used to pass information add each step for a single location x

- Location x
- std::pair< bool, xxx > value (bool encode if its characteristics has already been computed)
- std::pair< bool, xxx > grad
- Etc…

### Reinitialization Filter

- Input: one level set function
- Output: one level set function
- Virtual void GenerateData() = 0; // processing

### Stopping criterion

- Functor?
- Inputs: Phi^{n}, Phi^{n-1}, Number of iterations
- Check for additional values that can be passed (to avoid as much as possible explosion of computational cost!!!)

### SamplingDomain

- Represents the domain where the level set PDE is sampled, and thus used to solve the PDE equation.
- Iterator Begin();
- Iterator End();
- Iterator Iterator::operator ++ ( -- ? )