@ALDParametrizedClass public abstract class MTBGenericEnergyNonPDE extends Object
E
and toString
.
Likewise the abstract version of the
method deltaE
which explicitly refers to the new phase the pixel should change to has to be implemented.
The second version of deltaE
makes sense in a strict way only for two phase approaches and an appropriate
default implementation is supplied.
In case the derived energy class relies on parameters depending on the
current state of the level set function associated with the energy,
then also the version of updateParams
has to be implemented
which explicitly refers to the new phase the pixel should change to.
The second version of updateParams
has an appropriate default implementation.
Each implementation of updateParams
is assume to change/update the parameters of the
energy object to reflect an intended change of the level set function.
If the energy relies on parameters it is also highly recommended to implement the method
estimateParams
. This method is expected to set the parameters to the
current state of the level set function.
The rational behind this requirements is as follows.
In almost all cases an instance of an extending class is associated
with an instance of MTBLevelsetMembership
.
As these two separate objects (of class MTBGenericEnergyNonPDE
and MTBLevelsetMembership
)
interact some caution has to be taken into account.
This is the case if the energy object relies on parameters
depending on the current state of the level set function associated with the energy.
Examples for such parameters are the mean intensities of phases/regions
as used in the fitting term of the Chan-Vese-Energy.
In this case changing of the level set function and setting of the parameters of the energy object
need to be synchronized.
The concept used in the solver LevelsetSolveNonPDE
is as follows: First the parameters of the energy object are updated calling updateParams
where the
the level set function supplied as argument is still in the old state
and the anticipated change of the level set function is given via arguments, too.
Subsequently the energy object may rely on the fact that this change of the level set function
is conducted immediately to again have both energy function and
level set function in compatible states.
In order for an extending energy class to be used as a parameter of
an operator intended to be used for generic execution,
e.g. de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE.ui.LevelsetSegmentationNonPDE
the following has to be taken into account.
As in this case the energy object is initialized using the standard constructor
the implementation may not rely on initialization of any member variables
conducted in other constructors. Particularly initialization depending on the
image of initial level set function are not feasible within a constructor.
However, the energy object may rely on its init
method being called
prior to actual use of the energy. This method assumes that all class parameters are properly set.
If the neighborhood of pixels is used to define the energy then
it is recommended to implement a 2D and 3D version of the energy * in separate classes.
This is the case e.g. if derivatives are used. Examples are length energies
MTBLengthEnergyNonPDE
and CurvatureEnergy
.
Modifier and Type | Field and Description |
---|---|
protected int |
debug
Bit mask for debug output on
System.out . |
protected String |
name
Name of the energy.
|
Constructor and Description |
---|
MTBGenericEnergyNonPDE() |
Modifier and Type | Method and Description |
---|---|
double |
deltaE(int x,
int y,
int z,
MTBLevelsetMembership phi)
Calculate differences of energy if the pixel/voxel (x,y,z) changes its phase in
the levelest function
phi supplied as argument and assumed to be
associated with this energy object. |
abstract double |
deltaE(int x,
int y,
int z,
short newPhase,
MTBLevelsetMembership phi)
Calculate differences of energy if the pixel/voxel (x,y,z) is changed
from its current phase in the level set function
phi supplied
from current phase to newPhase . |
abstract double |
E(MTBLevelsetMembership phi)
Return the complete energy for the level set function
phi . |
protected void |
estimateParams(MTBLevelsetMembership phi)
Estimate internal parameters (if any) for the level set function
phi
assumed to be associated with this energy object. |
protected String |
getNewIndent(String indent)
Return a new indentation string.
|
MTBGenericEnergyNonPDE |
init(MTBImage img,
MTBLevelsetMembership phi)
Initialization routine which is called once before the energy is actually used.
|
void |
print(MTBLevelsetMembership phi,
PrintStream out,
String indent)
Print this energy object - including the value of the energy for
phi assumed to be associated with this energy object. |
void |
setDebug(int debug)
Set debug bit mask
|
abstract String |
toString()
Return an ascii representation identifying the energy and internal parameters,
but not the state.
|
void |
updateParams(int x,
int y,
int z,
MTBLevelsetMembership phi)
Update parameters (if any) of the energy object which depend on
the associated level set function.
|
void |
updateParams(int x,
int y,
int z,
short newPhase,
MTBLevelsetMembership phi)
Update parameters (if any) of the energy object which depend on
the associated level set function.
|
protected String name
protected int debug
System.out
.public MTBGenericEnergyNonPDE init(MTBImage img, MTBLevelsetMembership phi)
This method assumes, that all class parameters of the energy are already set and takes care of initializations which depend on the image to be segmented and/or the initial level set function supplied as argument. It may also be the case that depending on the image and/or the initial level set function a new energy object is created, e.g. if a specialized energy according to dimensionality of the image of the type of the level set function (multi phase) is required.
If no initialization is required the routine should just return the unmodified energy object.
img
- the image to be segmentedphi
- the level set function associated with this energy object in its initial statepublic abstract double deltaE(int x, int y, int z, short newPhase, MTBLevelsetMembership phi)
phi
supplied
from current phase to newPhase
.x
- y
- z
- newPhase
- new phase to change the pixel/voxel tophi
- level set function assumed to be associated with this energy objectpublic double deltaE(int x, int y, int z, MTBLevelsetMembership phi)
phi
supplied as argument and assumed to be
associated with this energy object.
This version makes sense only for two phase level set function. In the multi phase case any object phase is changed to the background, while a background pixel/voxel is changed to the first object phase.
x
- y
- z
- phi
- level set function assumed to be associated with this energy objectpublic abstract double E(MTBLevelsetMembership phi)
phi
.
phi
- level set function assumed to be associated with this energy objectpublic void updateParams(int x, int y, int z, short newPhase, MTBLevelsetMembership phi)
This method is called to update the parameters if is is intended to change the
phase of a pixel/voxel to newPhase
.
Note: The level set function phi
is still in the old state and is
assumed to be to updated subsequently.
x
- y
- z
- newPhase
- new phase to change pixel/voxel tophi
- assumed to be associated with this energy objectpublic void updateParams(int x, int y, int z, MTBLevelsetMembership phi)
This method is called to update the parameters if is is intended to change a pixel/voxel to the other state,
assuming a two phase level set function.
For a multi phase level set function flipping of phases is realized
in deltaE(int, int, int, short, de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE.MTBLevelsetMembership)
.
Note: The level set function phi
is still in the old state and is
assumed to be to updated subsequently.
x
- y
- z
- phi
- assumed to be associated with this energy objectprotected void estimateParams(MTBLevelsetMembership phi)
phi
assumed to be associated with this energy object.phi
- public void print(MTBLevelsetMembership phi, PrintStream out, String indent)
phi
assumed to be associated with this energy object.
Each line output is prefixed with the string indent
.
Note: this may be an expensive operation.phi
- level set function assumed to be associated with this energy objectout
- stream to print toindent
- indentation stringpublic abstract String toString()
public void setDebug(int debug)
debug
- bit maskCopyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.