de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE
Class MTBGenericEnergyNonPDE

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.segmentation.levelset.nonPDE.MTBGenericEnergyNonPDE
Direct Known Subclasses:
MTBCVFittingEnergyNonPDE, MTBEnergySumNonPDE, MTBLengthEnergyNonPDE, MTBMeijeringFittingEnergyNonPDE

@ALDParametrizedClass
public abstract class MTBGenericEnergyNonPDE
extends Object

The base class for energies intended for a nonPDE level set approach. When extending this base class it is necessary to override at least the constructor (defining the name of the energy) as well as the abstract methods 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.


Field Summary
protected  int debug
          Bit mask for debug output on System.out.
protected  String name
          Name of the energy.
 
Constructor Summary
MTBGenericEnergyNonPDE()
           
 
Method Summary
abstract  double deltaE(int x, int y, int z, byte 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.
 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 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, byte newPhase, 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, MTBLevelsetMembership phi)
          Update parameters (if any) of the energy object which depend on the associated level set function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
Name of the energy.


debug

protected int debug
Bit mask for debug output on System.out.

Constructor Detail

MTBGenericEnergyNonPDE

public MTBGenericEnergyNonPDE()
Method Detail

init

public MTBGenericEnergyNonPDE init(MTBImage img,
                                   MTBLevelsetMembership phi)
Initialization routine which is called once before the energy is actually used.

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.

Parameters:
img - the image to be segmented
phi - the level set function associated with this energy object in its initial state
Returns:
The modified or a new energy if initialization was successful, otherwise null.

deltaE

public abstract double deltaE(int x,
                              int y,
                              int z,
                              byte 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.

Parameters:
x -
y -
z -
newPhase - new phase to change the pixel/voxel to
phi - level set function assumed to be associated with this energy object
Returns:
difference of energy

deltaE

public 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.

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.

Parameters:
x -
y -
z -
phi - level set function assumed to be associated with this energy object
Returns:
difference of energy

E

public abstract double E(MTBLevelsetMembership phi)
Return the complete energy for the level set function phi.
Note: this may be an expensive operation.

Parameters:
phi - level set function assumed to be associated with this energy object
Returns:
energy

updateParams

public void updateParams(int x,
                         int y,
                         int z,
                         byte newPhase,
                         MTBLevelsetMembership phi)
Update parameters (if any) of the energy object which depend on the associated level set function.

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.

Parameters:
x -
y -
z -
newPhase - new phase to change pixel/voxel to
phi - assumed to be associated with this energy object

updateParams

public 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.

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, byte, 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.

Parameters:
x -
y -
z -
phi - assumed to be associated with this energy object

estimateParams

protected void estimateParams(MTBLevelsetMembership phi)
Estimate internal parameters (if any) for the level set function phi assumed to be associated with this energy object.

Parameters:
phi -

print

public 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. Each line output is prefixed with the string indent. Note: this may be an expensive operation.

Parameters:
phi - level set function assumed to be associated with this energy object
out - stream to print to
indent - indentation string

toString

public abstract String toString()
Return an ascii representation identifying the energy and internal parameters, but not the state.

Overrides:
toString in class Object

setDebug

public void setDebug(int debug)
Set debug bit mask

Parameters:
debug - bit mask

getNewIndent

protected String getNewIndent(String indent)
Return a new indentation string. If old indent was empty, just leave is, otherwise add four spaces.

Parameters:
indent - Indentation asked for


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.