@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, shortDescription="Image contour segmentation with parametric snakes.") @ALDDerivedClass public class SnakeOptimizerSingleVarCalc extends SnakeOptimizerSingle
Image contour segmentation using parametric snakes. This class provides methods to segment contours in an image based on parametric active contour models, i.e. snakes. Note that we assume here a counter-clockwise ordering of the snake points. Pay attention if you deal with upper-left coordinates!In this class snake optimization is done by solving PDEs like in the original Kass et al. paper. TODO correct handling of not closed snakes TODO adaptation of gamma for every single point TODO adaptation of segment length
SnakeOptimizerSingle.EnergyNormalizationMode, SnakeOptimizerSingle.IntensityNormalizationMode
SnakeOptimizer.Snake_status
de.unihalle.informatik.Alida.operator.ALDOperatorControllable.OperatorControlStatus, de.unihalle.informatik.Alida.operator.ALDOperatorControllable.OperatorControlStatusHandle, de.unihalle.informatik.Alida.operator.ALDOperatorControllable.OperatorExecutionStatus
Modifier and Type | Field and Description |
---|---|
private Jama.Matrix |
A
Optimization matrix A, to be modified by snake energies in each iteration.
|
private Jama.Matrix |
B
External energy vector, to be modified by snake energies.
|
protected MTBSet_SnakeEnergyDerivable |
energySet
List of snake energies to be used in segmentation.
|
protected double[] |
energyWeightsNormed
List of normalized energy weights.
|
protected double[][] |
gammaAdaptive
Vector containing the current gamma values (step sizes).
|
protected MTBGammaUpdate |
gammaUpdater
Gamma update strategy.
|
protected Double |
initialGammas
Initial step size in snake optimization.
|
private Jama.Matrix |
memA
Optimization matrix with values of last calculations.
|
protected MTBTermination |
termCriterion
Termination criterion.
|
dispImg, doResampling, energy, energyCalculationRequested, intNormMode, normMode, previousEnergy, previousSnake, resampleSegLength, scaleFactor, snake, timer, workingImage
counterClockwiseSnakePointOrderRequested, energyData, excludeMask, iChannels, iHeight, inImg, initialSnakes, intermediateResults, itCounter, iWidth, outIntermediateResultsStack, outIntermediateResultsStackInterval, outIntermediateResultsStackWanted, outSnakes, outSnakesImg, sampleEnergyData, saveIntermediateResults, saveIntermediateResultsPath, showIntermediateResults, snakeNum
Constructor and Description |
---|
SnakeOptimizerSingleVarCalc()
Default constructor.
|
SnakeOptimizerSingleVarCalc(MTBImage img,
MTBPolygon2DSet initSnake,
MTBSet_SnakeEnergyDerivable energs,
MTBGammaUpdate gamUpdater,
Double gammas,
MTBTermination tc,
Boolean resample,
Double segLength)
Default constructor with parameters.
|
Modifier and Type | Method and Description |
---|---|
protected double |
calcSnakeEnergy()
Calculates total snake energy.
|
SnakeOptimizerSingleVarCalc |
clone() |
protected SnakeOptimizer.Snake_status |
doIteration()
Performs one single optimization step.
|
double[][] |
getCurGamma()
Returns current gamma vector.
|
String |
getDocumentation() |
Vector<MTBSnakeEnergyDerivable> |
getEnergies()
Returns a reference to the list of energies.
|
MTBSet_SnakeEnergyDerivable |
getEnergySet()
Returns a reference to the set of energies.
|
Jama.Matrix |
getMemorizedMatrixA()
Returns matrix carrying always the values of the last iteration, or null
before first run.
|
protected boolean |
hasEnergies()
Check if energies are given.
|
protected void |
initOptimizer()
Initializes the optimizer.
|
void |
printParams()
Print important parameters to standard output stream.
|
protected Object |
readResolve()
Function for proper initialization of deserialized objects.
|
void |
resizeMatrices()
Resize parameter matrices.
|
void |
setEnergySet(MTBSet_ActiveContourEnergy eSet)
Specify set of energies.
|
protected void |
setupEnergyTable()
Inits the table for sampled energy values.
|
String |
toString() |
void |
validateCustom() |
closeWindows, disableEnergyCalculation, doResampleSnake, enableEnergyCalculation, getCurrentSnake, getCurrentSnakes, getEnergyValue, getIntensityNormalizationMode, getNormalizationMode, getPreviousEnergyValue, getPreviousSnake, getSegmentLength, getWorkingImage, normalizeInputImage, resampleSnake, saveSnake, setNormalizationMode, showSnake
disableSaveIntermediateResults, disableShowIntermediateResults, enableSaveIntermediateResults, enableShowIntermediateResults, getExcludeMask, getInitialSnakes, getInputImage, getIterationCount, getResultSnakeImage, getResultSnakes, getSnakeNumber, getStackWithIntermediateResults, operate, setExcludeMask, setInitialSnakes, setInputImage, setIntermediateResultPath, supportsStepWiseExecution, wantStackWithIntermediateResults
addALDConfigurationEventListener, addALDControlEventListener, fireALDConfigurationEvent, fireALDControlEvent, getControlStatus, getControlStatusHandle, getExecutionStatus, handleALDConfigurationEvent, handleALDControlEvent, removeALDConfigurationEventListener, removeALDControlEventListener, setControlStatus, setNotifyRecursiveFlag
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="List of Energies", mode=STANDARD, direction=IN, required=true, description="List of snake energies.", dataIOOrder=3) protected MTBSet_SnakeEnergyDerivable energySet
@Parameter(label="Gamma Update Strategy", mode=ADVANCED, direction=IN, required=false, dataIOOrder=22, description="Gamma update object.") protected MTBGammaUpdate gammaUpdater
@Parameter(label="Termination Criterion", mode=ADVANCED, direction=IN, required=false, dataIOOrder=20, description="Termination criterion for optimization.") protected MTBTermination termCriterion
@Parameter(label="Initial Gamma Value", mode=STANDARD, direction=IN, required=false, dataIOOrder=21, description="Initial step sizes.") protected Double initialGammas
protected transient double[] energyWeightsNormed
protected transient double[][] gammaAdaptive
Note that the array is two-dimensional, however, the number of columns is always one! This is mainly for compatibility reasons as we need to convert the double array to Jama matrices which require two-dimensional arrays.
private transient Jama.Matrix A
private transient Jama.Matrix memA
private transient Jama.Matrix B
public SnakeOptimizerSingleVarCalc() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public SnakeOptimizerSingleVarCalc(MTBImage img, MTBPolygon2DSet initSnake, MTBSet_SnakeEnergyDerivable energs, MTBGammaUpdate gamUpdater, Double gammas, MTBTermination tc, Boolean resample, Double segLength) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- Gray-scale input image.initSnake
- Array of initial snake polygon(s).energs
- Vector of energy objects.gamUpdater
- Object for gamma adaptation.gammas
- Initial value(s) for step size.tc
- Termination checker.opStepWise
- Enables step-through optimization (requires GUI).stepsize
- Number of iterations per step-through step.normalize
- Flag for enabling snake/image normalization.resample
- Flag for activating snake resampling.segLength
- Desired length of segments are resampling.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
SnakeAlgosRegionException
public SnakeOptimizerSingleVarCalc clone()
clone
in class SnakeOptimizer
protected Object readResolve()
This function is called on an instance of this class being deserialized from file, prior to handing the instance over to the user. It takes care of a proper initialization of transient member variables as they are not initialized to the default values during deserialization.
readResolve
in class SnakeOptimizerSingle
public void validateCustom() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
validateCustom
in class SnakeOptimizerSingle
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected boolean hasEnergies()
SnakeOptimizerSingle
hasEnergies
in class SnakeOptimizerSingle
public void printParams()
printParams
in class SnakeOptimizerSingle
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public String toString()
toString
in class SnakeOptimizerSingle
protected void initOptimizer() throws MTBSnakeException
Here internal member variables are initialized according to the given parameters, and memory for intermediate results and debug data is allocated.
initOptimizer
in class SnakeOptimizerSingle
MTBSnakeException
protected SnakeOptimizer.Snake_status doIteration() throws MTBException
doIteration
in class SnakeOptimizer
MTBException
public void resizeMatrices()
The size of the matrices depends on the number of points used to represent the snake. This methods resizes the snake, if the given point number does not coincide with the current size of the matrices. After resizing the matrices, entries are set to zero.
protected void setupEnergyTable()
protected double calcSnakeEnergy()
public void setEnergySet(MTBSet_ActiveContourEnergy eSet)
SnakeOptimizerSingle
setEnergySet
in class SnakeOptimizerSingle
eSet
- Set of energies.public MTBSet_SnakeEnergyDerivable getEnergySet()
SnakeOptimizerSingle
getEnergySet
in class SnakeOptimizerSingle
public Vector<MTBSnakeEnergyDerivable> getEnergies()
public double[][] getCurGamma()
public Jama.Matrix getMemorizedMatrixA()
public String getDocumentation()
getDocumentation
in class de.unihalle.informatik.Alida.operator.ALDOperator
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.