i3d::PDESolver< VOXELIN, VOXELOUT > Class Template Reference
This class is together with class PDESolverFunction the root abstract class for wide family of classes which implements segmentation methods and image preprocessing filters. All these offsprings of this base class have one common feature. The key idea of those methods or filters is described by partial differential equation. The execution of the methods or application of the filters has in the background the solution of the underlying PDE. More...
#include <LevelSet.h>
Inheritance diagram for i3d::PDESolver< VOXELIN, VOXELOUT >:

Public Member Functions | |
void | InitializeOutput () |
Initialize the output image (Memory allocation, Resolution settings, etc.). | |
virtual bool | Convergence () |
If returns true the iteration proccess stops. | |
virtual void | Initialize () |
Initialize the computation. | |
virtual void | InitializeIteration () |
Initialize computation for one iteration step. | |
virtual void | ComputeChange () |
Compute the ![]() | |
virtual void | ApplyChange () |
Add the ![]() | |
virtual void | Execute () |
This method implements the main iterative proccess of solution finding. | |
bool | EstimateDistanceInOnePoint (size_t index, size_t *neighbors, VOXELOUT *offset) |
void | SetMaximumNumberOfIterations (size_t max) |
Set the maximum number of iterations. | |
size_t | GetMaximumNumberOfIterations () |
Get the maximum number of iterations. | |
void | SetSpacing (float x, float y, float z) |
Set the spacing between voxels. | |
void | SetSpacing (Vector3d< float > vec) |
Set the spacing between voxels. | |
void | GetSpacing (float *x, float *y, float *z) |
Get the spacing between voxels. | |
virtual void | SetGlobalTimeStep (VOXELOUT t) |
Set the fixed global time step (![]() | |
VOXELOUT | GetGlobalTimeStep () |
Get the fixed global time step (![]() | |
Protected Attributes | |
Image3d< VOXELIN > & | Input |
Input image. | |
Image3d< VOXELOUT > & | Output |
Output Image. | |
size_t | ElapsedIteration |
Number of Elapsed Iteration during computations. | |
size_t | MaximumIteration |
Maximum number of iterations. | |
VOXELOUT | InputIsoValue |
Vector3d< float > | Spacing |
Spacing of the LevelSet lattice. | |
size_t | Dimensions |
Number of dimensions (2 or 3). |
Detailed Description
template<class VOXELIN, class VOXELOUT>
class i3d::PDESolver< VOXELIN, VOXELOUT >
This class is together with class PDESolverFunction the root abstract class for wide family of classes which implements segmentation methods and image preprocessing filters. All these offsprings of this base class have one common feature. The key idea of those methods or filters is described by partial differential equation. The execution of the methods or application of the filters has in the background the solution of the underlying PDE.
The partial differential equation, which is the core off all offsprings of this class, has following "general form":
where F is some function of spatial derivatives. The temporal derivation can be for example discretised by the forward Euler operator in following way.
This leads to following explicit scheme:
From this follows, that we have some initial state (input image, initial state of the segmentation, etc. ) we iteratively modify this state (we compute the filter on the image, we try to find correct segmentation) and after some time we find the solution of the equation.
This class together with class PDESolverFunction
implements above suggested functionality. The PDESolver
class (and their offsprings) take control of the iteration proccess, it handles the input and the output (memory allocation, etc.) and it implements the iterative solver of PDE equation. It has also an pointer to the "Function" object (PDESolverFunction
and offsprings), which is responsible for computation of the part of the equation. There is no need to instantiate a "Function" object (i. e.
PDESolverFunction
class) from the user point of view. The user should only instantiate some offspring of PDESolver
class. The "Function" object is instantiated automatically by the "Solver" object.
More detailed description
The constructor of every offspring of this class has two parameters -- references to Input and Output image (Image3d objects). The user should only supply correctly initialised (allocated and loaded) Input image. The output image is automatically initialised to the correct state. There are some methods which should the user use to adjust the default settings (Spacing between voxels, maximum number of the iterations, the time step and so on). The core functionality (iterative proccess of solution finding) is implemented in the method
PDESolver::Execute()
. The code listing of this method is shown bellow. In first the Input is copied to Output by the InitializeOutput()
method. Second the virtual method Initialize()
is called to allow some necessary initialization steps, which are not common for all inherited classes. The iterative process starts after that. The method ComputeChange()
calls method PDESolverFunction::ComputeUpdateData(), which computes the part of the equation. This method also computes the posible maximum time step
which can be used to add the
part to
. The addition of
to
provides the
ApplyChange()
method. The loop ends if the Convergence()
method returns true.
template <class VOXELIN, class VOXELOUT> void PDESolver<VOXELIN, VOXELOUT>::Execute() { InitializeOutput(); Initialize(); while (! Convergence()) { InitializeIteration(); ComputeChange(); ApplyChange(); ++ElapsedIteration; } }

Diagram of Data and Control flow between Solver object (PDESolver
offspring) and Function Object (PDESolverFunction
offsprint)
Simple example of usage
In the code sequence bellow is shown the simple example how should be used the offsprings of the PDESolver
class. After instantiation with two parameters, where the input parameter is correctly allocated and the ouput is only declared, some adjustment is done (setting the spacing and timestep). After that the main Execute()
method is called. The last two lines are used only for converting the float output to gray leveels image.
#include <LevelSet.h> #include <image3d.h> ..... Image3d<GRAY8> i; Image3d<float> fimg; i.ReadImage('input.tif'); // read input image AOSTVFilter<GRAY8,float> TV(i,fimg); // instantiate the filter TV.SetMaximumNumberOfIterations(3); // Set the number of iterations to 2 TV.SetSpacing(1.0,1.0,2.0); // Set the spacing of spatial discretisation to 1,1,2 TV.SetGlobalTimeStep(5.0); // Set the global time step TV.Execute(); // Perform the work of the filter FloatToGray8NoWeight(fimg,i); //Convert the output float image to gray8 image i.SaveImage('output.tif'); // save the output of the filter ......
- Date:
- 2005
Member Function Documentation
bool i3d::PDESolver< VOXELIN, VOXELOUT >::EstimateDistanceInOnePoint | ( | size_t | index, | |
size_t * | neighbors, | |||
VOXELOUT * | offset | |||
) |
Input: index - index into image array, neighbors - array with indices of the central point neighborhood output offset - distance of the nearest point on the interface to the point of index return value true - is near the interface false - is not near the interface
Member Data Documentation
VOXELOUT i3d::PDESolver< VOXELIN, VOXELOUT >::InputIsoValue [protected] |
Value of the isoline(surface), which will be taken as the zero level set, from the input image
The documentation for this class was generated from the following files:
- LevelSet.h
- LevelSet.cc