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

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

@ALDParametrizedClass
public abstract class MTBSnakeEnergyCDImageBased
extends Object
implements MTBSnakeEnergyDerivable, MTBSnakeEnergyComputable

Interface class for snake energies that are purely image-based.

This class is used by the snake optimizer. Pure image-based energies are energies that just evaluate the energy gradient at single image positions. Examples are intensity gradient, GVFs and so on. On updating the snake optimizer target functional they usually just modify the constant vector and not the linear matrix. All energies of this type share the common property that derivatives can be calculated quite easy and straight-forward which discriminates them from more complex snake energies.

Author:
moeller

Field Summary
protected  int height
          Height of the given image for the energy.
protected  double normalizationFactor
          Normalization factor for scaling matrix entries.
protected  SnakeOptimizerSingle.EnergyNormalizationMode normMode
          Mode of normalization.
protected  double scaleFactor
          Scaling factor to rescale image coordinates in range [0,1] or several ranges to the original coordinates range like [1000, 1000] in a image of size 1000 x 1000.
protected  int width
          Width of the given image for the energy.
 
Fields inherited from interface de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyDerivable
targetEnergyRange
 
Constructor Summary
MTBSnakeEnergyCDImageBased()
           
 
Method Summary
 double calcEnergy(SnakeOptimizerSingle opt)
          Calculates the energy of the current snake.
 double calcEnergy(SnakeOptimizerSingle opt, int pointID)
          Calculates energy at a certain snake point.
 Jama.Matrix getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
          Returns the linear matrix part of this energy for snake optimization.
 Jama.Matrix getDerivative_VectorPart(SnakeOptimizerSingleVarCalc opt)
          Returns the vector part of this energy for snake optimization.
 double getDerivativeX_norm(double x, double y)
          Get x-derivative of external snake energy at given position on a normalizes image coordinates in range [width*scale, height*scale].
abstract  double getDerivativeX(double x, double y)
          Get x-derivative of external snake energy at given position.
 double getDerivativeY_norm(double x, double y)
          Get y-derivative of external snake energy at given position on a normalizes image coordinates in range [width*scale, height*scale].
abstract  double getDerivativeY(double x, double y)
          Get y-derivative of external snake energy at given position.
 double getScaleFactor()
          Get scaling factor.
 double getValue_norm(double x, double y)
          Returns the value of the external energy at the given position on a normalizes image coordinates in range [width*scale, height*scale].
abstract  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.
protected abstract  void normalizeEnergy()
          Normalize the external energy in a range [-1.0, 1.0].
 boolean requiresCounterClockwiseContourSorting()
          Ask energy if contour points need to sorted counter-clockwise.
 boolean requiresOverlapMask()
          Ask energy if an overlap mask for all snakes jointly optimized is required.
 void setScaleFactor(double s)
          Set the scaling factor.
 void updateStatus(SnakeOptimizerSingle o)
          Update internal state of energy object prior to usaging it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyDerivable
toString
 
Methods inherited from interface de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyComputable
toString
 

Field Detail

width

protected int width
Width of the given image for the energy.


height

protected int height
Height of the given image for the energy.


scaleFactor

protected double scaleFactor
Scaling factor to rescale image coordinates in range [0,1] or several ranges to the original coordinates range like [1000, 1000] in a image of size 1000 x 1000. Default scaling factor is 1.


normMode

protected SnakeOptimizerSingle.EnergyNormalizationMode normMode
Mode of normalization.


normalizationFactor

protected double normalizationFactor
Normalization factor for scaling matrix entries.

Constructor Detail

MTBSnakeEnergyCDImageBased

public MTBSnakeEnergyCDImageBased()
Method Detail

setScaleFactor

public void setScaleFactor(double s)
Set the scaling factor.

Specified by:
setScaleFactor in interface MTBSnakeEnergyComputable
Specified by:
setScaleFactor in interface MTBSnakeEnergyDerivable
Parameters:
s - new scaling factor.

getScaleFactor

public double getScaleFactor()
Get scaling factor.

Specified by:
getScaleFactor in interface MTBSnakeEnergyComputable
Specified by:
getScaleFactor in interface MTBSnakeEnergyDerivable
Returns:
Scaling factor.

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
Parameters:
o - Calling snake optimizer.
Returns:
True if init was successful, otherwise false.

getDerivative_MatrixPart

public final Jama.Matrix getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
Description copied from interface: MTBSnakeEnergyDerivable
Returns the linear matrix part of this energy for snake optimization.

Specified by:
getDerivative_MatrixPart in interface MTBSnakeEnergyDerivable
Parameters:
opt - Calling snake optimizer.
Returns:
Optimization matrix for this energy object.

getDerivative_VectorPart

public Jama.Matrix getDerivative_VectorPart(SnakeOptimizerSingleVarCalc opt)
Description copied from interface: MTBSnakeEnergyDerivable
Returns the vector part of this energy for snake optimization.

Specified by:
getDerivative_VectorPart in interface MTBSnakeEnergyDerivable
Parameters:
opt - Calling snake optimizer.
Returns:
Optimization vector for this energy object.

calcEnergy

public double calcEnergy(SnakeOptimizerSingle opt)
Description copied from interface: MTBSnakeEnergyComputable
Calculates the energy of the current snake.

Specified by:
calcEnergy in interface MTBSnakeEnergyComputable
Parameters:
opt - Calling snake optimizer.
Returns:
Energy of complete snake.

calcEnergy

public double calcEnergy(SnakeOptimizerSingle opt,
                         int pointID)
Calculates energy at a certain snake point.

Parameters:
opt - Snake optimizer.
pointID - Point ID where to calculate local energy.
Returns:
Energy value at location with given ID.

getValue_norm

public double getValue_norm(double x,
                            double y)
Returns the value of the external energy at the given position on a normalizes image coordinates in range [width*scale, height*scale].

Parameters:
x - x-coordinate of position
y - y-coordinate of position
Returns:
Absolute value of external energy.

getDerivativeX_norm

public double getDerivativeX_norm(double x,
                                  double y)
Get x-derivative of external snake energy at given position on a normalizes image coordinates in range [width*scale, height*scale].

Parameters:
x - x-coordinate of position
y - y-coordinate of position
Returns:
x-derivative value at given scaled position.

getDerivativeY_norm

public double getDerivativeY_norm(double x,
                                  double y)
Get y-derivative of external snake energy at given position on a normalizes image coordinates in range [width*scale, height*scale].

Parameters:
x - x-coordinate of position
y - y-coordinate of position
Returns:
y-derivative value at given scaled position.

getValue

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

Parameters:
x - x-coordinate of position
y - y-coordinate of position
Returns:
Absolute value of external energy.

getDerivativeX

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

Parameters:
x - x-coordinate of pixel position
y - y-coordinate of pixel position
Returns:
x-derivative value at given position.

getDerivativeY

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

Parameters:
x - x-coordinate of pixel position
y - y-coordinate of pixel position
Returns:
y-derivative value at given position.

normalizeEnergy

protected abstract void normalizeEnergy()
Normalize the external energy in a range [-1.0, 1.0]. The user implements how the energy is normalized. The range can also be [0.0, 1.0] or something else, but the range must be inside [-1.0, 1.0]. The normalization is called in the initEnergy method of the energy.


updateStatus

public void updateStatus(SnakeOptimizerSingle o)
Description copied from interface: MTBSnakeEnergyDerivable
Update internal state of energy object prior to usaging it.

Specified by:
updateStatus in interface MTBSnakeEnergyComputable
Specified by:
updateStatus in interface MTBSnakeEnergyDerivable

requiresCounterClockwiseContourSorting

public boolean requiresCounterClockwiseContourSorting()
Description copied from interface: MTBSnakeEnergyDerivable
Ask energy if contour points need to sorted counter-clockwise.

Specified by:
requiresCounterClockwiseContourSorting in interface MTBSnakeEnergyComputable
Specified by:
requiresCounterClockwiseContourSorting in interface MTBSnakeEnergyDerivable
Returns:
If true, counter-clockwise sorting is expected.

requiresOverlapMask

public boolean requiresOverlapMask()
Description copied from interface: MTBSnakeEnergyDerivable
Ask energy if an overlap mask for all snakes jointly optimized is required.

Specified by:
requiresOverlapMask in interface MTBSnakeEnergyComputable
Specified by:
requiresOverlapMask in interface MTBSnakeEnergyDerivable
Returns:
If true, the energy expects an overlap mask to be available.


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