@ALDDerivedClass @ALDParametrizedClass public class MTBSnakeEnergyCD_OverlapPenalty extends Object implements MTBSnakeEnergyDerivable, MTBSnakeEnergyComputable, MTBSnakeEnergyCoupled
This energy is defined as follows for a set of N snakes:
Note that using this energy with a single snake is not reasonable. The energy does not cause a single snake to move anyway, i.e., it strictly requires interaction of multiple snakes.
Paper: C. Zimmer and J.-C. Olivo-Marin, Coupled Parametric Active Contours, IEEE Trans. on PAMI, vol. 27, no. 11, pp. 1838-1842, 2005.
Modifier and Type | Field and Description |
---|---|
private SnakeOptimizerCoupled |
cSnakeOpt
Reference to a coupled snake optimizer.
|
protected int[][] |
currentOverlapMask
Overlap mask of current snake configuration, updated in each iteration.
|
protected static int[] |
factorialVals
Pre-computed factorial values.
|
protected double |
maxEnergyVal
Maxmimum value of energy, dependent on number of snakes and rho.
|
private double |
rho
Weighting factor and overlap penalty, respectively.
|
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 |
snakeNum
Number of snakes to be optimized.
|
targetEnergyRange
Constructor and Description |
---|
MTBSnakeEnergyCD_OverlapPenalty()
Default constructor.
|
MTBSnakeEnergyCD_OverlapPenalty(double _rho,
int snakes)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
calcEnergy(SnakeOptimizerSingle opt)
Calculates the current energy of the snake.
|
Jama.Matrix |
getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
Updates the region coupling energy term in matrix A.
|
Jama.Matrix |
getDerivative_VectorPart(SnakeOptimizerSingleVarCalc opt)
Returns the vector part of this energy for snake optimization.
|
double |
getScaleFactor()
Get scaling factor.
|
boolean |
initEnergy(SnakeOptimizerCoupled opt)
Init routine which is called once before the energy is actually used.
|
boolean |
initEnergy(SnakeOptimizerSingle opt)
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(SnakeOptimizerCoupled o)
Update internal state of energy object prior to querying
derivatives and so on.
|
void |
updateStatus(SnakeOptimizerSingle o)
Update internal state of energy object prior to usaging it.
|
@ALDClassParameter(label="Weighting Parameter") private double rho
private transient SnakeOptimizerCoupled cSnakeOpt
This reference is only non-null if the energy is used in conjunction with coupled snake optimization.
protected transient int snakeNum
protected transient double maxEnergyVal
protected double scaleFactor
protected int[][] currentOverlapMask
protected static int[] factorialVals
At position n in this array the following value is stored:
public MTBSnakeEnergyCD_OverlapPenalty()
public MTBSnakeEnergyCD_OverlapPenalty(double _rho, int snakes)
_rho
- Overlap penalty coefficient.public void setScaleFactor(double s)
setScaleFactor
in interface MTBSnakeEnergyComputable
setScaleFactor
in interface MTBSnakeEnergyDerivable
s
- new scaling factor.public double getScaleFactor()
getScaleFactor
in interface MTBSnakeEnergyComputable
getScaleFactor
in interface MTBSnakeEnergyDerivable
public boolean initEnergy(SnakeOptimizerCoupled opt)
MTBSnakeEnergyCoupled
In this routine global parameter settings can be handled or other initialization stuff be done. Snake optimizers are supposed to call this routine once before they actual use of the energy. If no stuff needs to be done in advance the routine should at least return true.
initEnergy
in interface MTBSnakeEnergyCoupled
opt
- Calling snake optimizer.public boolean initEnergy(SnakeOptimizerSingle opt)
MTBSnakeEnergyDerivable
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.
initEnergy
in interface MTBSnakeEnergyComputable
initEnergy
in interface MTBSnakeEnergyDerivable
opt
- Calling snake optimizer.public void updateStatus(SnakeOptimizerCoupled o)
MTBSnakeEnergyCoupled
updateStatus
in interface MTBSnakeEnergyCoupled
public void updateStatus(SnakeOptimizerSingle o)
MTBSnakeEnergyDerivable
updateStatus
in interface MTBSnakeEnergyComputable
updateStatus
in interface MTBSnakeEnergyDerivable
public Jama.Matrix getDerivative_MatrixPart(SnakeOptimizerSingleVarCalc opt)
getDerivative_MatrixPart
in interface MTBSnakeEnergyDerivable
opt
- Calling snake optimizer.public Jama.Matrix getDerivative_VectorPart(SnakeOptimizerSingleVarCalc opt)
MTBSnakeEnergyDerivable
getDerivative_VectorPart
in interface MTBSnakeEnergyDerivable
opt
- Calling snake optimizer.public double calcEnergy(SnakeOptimizerSingle opt)
The energy is calculated based on the overlap mask of the current configuration of all snakes. In this overlap mask at each pixel position the absolute number of snakes covering that position is stored. For extracting the absolute energy value from this data it is, thus, necessary to derive the number of pairwise overlaps at a certain position. This count is given by the binomial of the number of snakes overlapping at a certain location over 2.
calcEnergy
in interface MTBSnakeEnergyComputable
opt
- Calling snake optimizer.public String toString()
MTBSnakeEnergyDerivable
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.
toString
in interface MTBSnakeEnergyComputable
toString
in interface MTBSnakeEnergyDerivable
toString
in class Object
public boolean requiresCounterClockwiseContourSorting()
MTBSnakeEnergyDerivable
requiresCounterClockwiseContourSorting
in interface MTBSnakeEnergyComputable
requiresCounterClockwiseContourSorting
in interface MTBSnakeEnergyCoupled
requiresCounterClockwiseContourSorting
in interface MTBSnakeEnergyDerivable
public boolean requiresOverlapMask()
MTBSnakeEnergyDerivable
requiresOverlapMask
in interface MTBSnakeEnergyComputable
requiresOverlapMask
in interface MTBSnakeEnergyCoupled
requiresOverlapMask
in interface MTBSnakeEnergyDerivable
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.