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

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

@ALDDerivedClass
@ALDParametrizedClass
public class MTBSnakeEnergyCD_KassLength
extends Object
implements MTBSnakeEnergyDerivable, MTBSnakeEnergyComputable

Internal length penalty energy of the pioneering paper of Kass et al.

The energy is based on first order derivatives of a snake C and is defined as follows:

%preamble{\usepackage{amssymb}}
Note that in contrast to the original work this implementation allows for more flexible weighting parameters alpha, i.e. the weighting factors may be set for each snake point individually.

In addition, the weighting parameters can dynamically be adjusted by providing the energy with an update object, see MTBSnakeEnergyCD_KassLength_ParamAdapt.

Paper: Kass, Witkin and Terzopoulos, Snakes: Active Contour Models, International Journal of Computer Vision, pp. 321-331, 1988.

Author:
moeller

Field Summary
protected  double scaleFactor
          Scaling factor for image coordinates.
 
Fields inherited from interface de.unihalle.informatik.MiToBo.segmentation.snakes.energies.MTBSnakeEnergyDerivable
targetEnergyRange
 
Constructor Summary
MTBSnakeEnergyCD_KassLength()
          Default constructor.
MTBSnakeEnergyCD_KassLength(double _alpha, MTBSnakeEnergyCD_KassLength_ParamAdapt _pUpd)
          Constructor with dynamic parameter updater.
 
Method Summary
 double calcEnergy(SnakeOptimizerSingle opt)
          Calculates snake energy (non-normalized!).
 double calcEnergy(SnakeOptimizerSingle opt, int pos)
          Calculates energy at a certain position for the current snake.
 Jama.Matrix getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
          Updates matrix A given weights for the internal energy term.
 Jama.Matrix getDerivative_VectorPart(SnakeOptimizerSingleVarCalc opt)
          Returns the vector part of this energy for snake optimization.
 double getInitAlpha()
          Get the initial alpha value.
 double getScaleFactor()
          Get scaling factor.
 boolean initEnergy(SnakeOptimizerSingle o)
          Init routine which is called once before the energy is actually used.
 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.
 String toString()
          Get an identifier string for the energy object.
 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, wait, wait, wait
 

Field Detail

scaleFactor

protected double scaleFactor
Scaling factor for image coordinates.

The factor is used to scale image coordinates between the range [0,1] and the real-world image size in pixels. Default scaling factor is 1.

Constructor Detail

MTBSnakeEnergyCD_KassLength

public MTBSnakeEnergyCD_KassLength()
Default constructor.


MTBSnakeEnergyCD_KassLength

public MTBSnakeEnergyCD_KassLength(double _alpha,
                                   MTBSnakeEnergyCD_KassLength_ParamAdapt _pUpd)
Constructor with dynamic parameter updater.

Parameters:
_alpha - Weighting factor for length term.
_pUpd - Parameter update object.
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.

getInitAlpha

public double getInitAlpha()
Get the initial alpha value.

Returns:
Intial alpha.

calcEnergy

public double calcEnergy(SnakeOptimizerSingle opt)
Calculates snake energy (non-normalized!).

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

calcEnergy

public double calcEnergy(SnakeOptimizerSingle opt,
                         int pos)
Calculates energy at a certain position for the current snake.


getDerivative_MatrixPart

public Jama.Matrix getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
Updates matrix A given weights for the internal energy term.

The upper left block and the lower right block of matrix A just dependent on the weight parameters alpha and beta for the internal snake energy terms.

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.

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.

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.