de.unihalle.informatik.MiToBo.segmentation.snakes.energies
Class MTBSnakeEnergyCDIB_GVF2D

java.lang.Object
  extended by de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyCDImageBased
      extended by de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyCDIB_GVF2D
All Implemented Interfaces:
MTBActiveContourEnergy, MTBActiveContourEnergyDerivable, MTBSnakeEnergyComputable, MTBSnakeEnergyDerivable

@ALDDerivedClass
@ALDParametrizedClass
public class MTBSnakeEnergyCDIB_GVF2D
extends MTBSnakeEnergyCDImageBased

Class for external energy of a GVF field energy vector. The GVF field from a given image returns to energy flow (vector for x- and y-direction). Every energy vector is stored in a one dimensional array, so the width of the image is used to get a energy value at position (x,y). The GVF field can be normalized in the range[-1,1], see `normalizeEnergy` method.

Author:
Danny Misiak
See Also:
GVFFieldCalculator2D

Field Summary
 
Fields inherited from class de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyCDImageBased
height, normalizationFactor, normMode, scaleFactor, width
 
Fields inherited from interface de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyDerivable
targetEnergyRange
 
Constructor Summary
MTBSnakeEnergyCDIB_GVF2D()
          Default constructor.
MTBSnakeEnergyCDIB_GVF2D(MTBImage _image, int _numIterations)
          Constructor to create a new SnakeExternalEnergyGVF2D object.
 
Method Summary
 double getDerivativeX(double x, double y)
          Get x-derivative of external snake energy at given position.
 double getDerivativeY(double x, double y)
          Get y-derivative of external snake energy at given position.
 MTBVectorField2D getGVF()
          Get the calculated Gradient Vector Flow field.
 double[] getPotential()
          Get the energy potential field from this external energy.
 double getValue(double x, double y)
          Returns the value of the external energy at the given position.
 boolean initEnergy(SnakeOptimizerSingle o)
          Init routine which is called once before the energy is actually used.
 void normalizeEnergy()
           Normalization of the GVF field. !!!
 void saveExtEnergy(String file)
          Save the gvf field in a MATLAB like file.
 String toString()
          Get an identifier string for the energy object.
 
Methods inherited from class de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyCDImageBased
calcEnergy, calcEnergy, getDerivative_MatrixPart, getDerivative_VectorPart, getDerivativeX_norm, getDerivativeY_norm, getScaleFactor, getValue_norm, requiresCounterClockwiseContourSorting, requiresOverlapMask, setScaleFactor, updateStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MTBSnakeEnergyCDIB_GVF2D

public MTBSnakeEnergyCDIB_GVF2D()
Default constructor.


MTBSnakeEnergyCDIB_GVF2D

public MTBSnakeEnergyCDIB_GVF2D(MTBImage _image,
                                int _numIterations)
Constructor to create a new SnakeExternalEnergyGVF2D object.

Parameters:
image - input image for calculating the gvf field
numIterations - number of iterations used for calculating the gvf field
Method Detail

initEnergy

public boolean initEnergy(SnakeOptimizerSingle o)
Description copied from interface: MTBSnakeEnergyDerivable
Init routine which is called once before the energy is actually used.

In this routine global parameter settings can be handled or other initialization stuff be done. The SnakeOptimizer will call this routine once before the actual use of the energy. If no stuff needs to be done in advance the routine should at least return true.

Specified by:
initEnergy in interface MTBSnakeEnergyComputable
Specified by:
initEnergy in interface MTBSnakeEnergyDerivable
Overrides:
initEnergy in class MTBSnakeEnergyCDImageBased
Parameters:
o - Calling snake optimizer.
Returns:
True if init was successful, otherwise false.

getGVF

public MTBVectorField2D getGVF()
Get the calculated Gradient Vector Flow field.

Returns:
The GVF field as VectorField2D object.

getPotential

public double[] getPotential()
Get the energy potential field from this external energy.

Returns:
Potential field in a double array.

getValue

public double getValue(double x,
                       double y)
Returns the value of the external energy at the given position.

In case of GVFs the external energy is given by a potential field reconstructed from the given GVF. Since the potential reconstruction yields only approximate results, the energy values should be interpreted as a more or less good approximation to the real potential.

The potential is normalized so that the minimum equals 0.

Specified by:
getValue in class MTBSnakeEnergyCDImageBased
Parameters:
x - x-coordinate of position.
y - y-coordinate of position.
Returns:
Absolute value of external energy (always positive!).

getDerivativeX

public double getDerivativeX(double x,
                             double y)
Get x-derivative of external snake energy at given position.

Specified by:
getDerivativeX in class MTBSnakeEnergyCDImageBased
Parameters:
x - x-coordinate of pixel position
y - y-coordinate of pixel position
Returns:
Negative x-derivative value at given position.

getDerivativeY

public double getDerivativeY(double x,
                             double y)
Get y-derivative of external snake energy at given position.

Specified by:
getDerivativeY in class MTBSnakeEnergyCDImageBased
Parameters:
x - x-coordinate of pixel position
y - y-coordinate of pixel position
Returns:
Negative y-derivative value at given position.

saveExtEnergy

public void saveExtEnergy(String file)
Save the gvf field in a MATLAB like file.

Parameters:
file - complete path to the file which should be saved

normalizeEnergy

public void normalizeEnergy()
 
 Normalization of the GVF field.
 
 !!! ATTENTION: the GVF field is normalized in range [-1.0, 1.0] !!!
                Independent of the given lower or upper bound values,
                because the gradient can be negative.
 

Specified by:
normalizeEnergy in class MTBSnakeEnergyCDImageBased
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

toString

public String toString()
Description copied from interface: MTBSnakeEnergyDerivable
Get an identifier string for the energy object.

When meta parameters are saved to a file, configuration objects need to be converted to strings. Consequently, each snake energy should be associated with a unique and descriptive string for later reference.

Specified by:
toString in interface MTBSnakeEnergyComputable
Specified by:
toString in interface MTBSnakeEnergyDerivable
Overrides:
toString in class Object
Returns:
Identifier string.


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