|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperatorControllable
de.unihalle.informatik.MiToBo.core.operator.MTBOperatorControllable
de.unihalle.informatik.MiToBo.segmentation.snakes.optimize.SnakeOptimizer
public abstract class SnakeOptimizer
Image contour segmentation using parametric snakes.
This class defines a generic interface for segmenting contours in an image based on parametric active contour models, i.e. snakes. It supports thread-based optimization and interaction with a graphical user interface.
Nested Class Summary | |
---|---|
static class |
SnakeOptimizer.Snake_status
Indicates the current (internal) state of the snake calculations. |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
de.unihalle.informatik.Alida.operator.ALDOperatorControllable.OperatorControlStatus |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Field Summary | |
---|---|
protected boolean |
counterClockwiseSnakePointOrderRequested
Flag to indicate if snakes are required to be sorted counter-clockwise. |
protected MTBTableModel |
energyData
|
protected boolean[][] |
excludeMask
Mask to exclude image pixels from calculations. |
protected int |
iHeight
Image height. |
protected MTBImage |
inImg
Input image to be segmented. |
protected MTBPolygon2DSet |
initialSnakes
Set of initial snake contours. |
protected java.util.Vector<MTBPolygon2DSet> |
intermediateResults
Set of intermediate segmentation results, required for stack generation. |
protected int |
itCounter
Iteration counter. |
protected int |
iWidth
Image width. |
protected MTBImageRGB |
outIntermediateResultsStack
Image stack with intermediate result images. |
protected int |
outIntermediateResultsStackInterval
Interval for saving intermediate results in stack. |
protected java.lang.Boolean |
outIntermediateResultsStackWanted
Flag to request a stack of intermediate result images. |
protected MTBPolygon2DSet |
outSnakes
Result contours. |
protected MTBImageRGB |
outSnakesImg
Image with final snake contours overlayed. |
protected java.lang.Boolean |
sampleEnergyData
|
protected java.lang.Boolean |
saveIntermediateResults
Flag to enable/disable saving of intermediate results. |
protected de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
saveIntermediateResultsPath
Path to where intermediate results should be stored. |
protected java.lang.Boolean |
showIntermediateResults
Flag to enable/disable showing of intermediate results. |
protected int |
snakeNum
Number of snakes currently managed. |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
configurationEventlistenerList, controlEventlistenerList, notifyListenersRecursively, operatorStatus, stepSize, stepWiseExecution |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
SnakeOptimizer()
Default constructor |
Method Summary | |
---|---|
abstract SnakeOptimizer |
clone()
|
protected abstract void |
closeWindows()
Close all windows openened by this operator (for clean-up). |
void |
disableSaveIntermediateResults()
Deactivates writing of intermediate results. |
void |
disableShowIntermediateResults()
Deactivates display of intermediate results. |
protected abstract SnakeOptimizer.Snake_status |
doIteration()
Here the main work should be done. |
void |
enableSaveIntermediateResults()
Activates writing of intermediate results to disc. |
void |
enableShowIntermediateResults()
Activates display of intermediate results. |
private void |
generateStackWithIntermediateResults()
Generates a stack with intermediate results. |
abstract MTBPolygon2DSet |
getCurrentSnakes()
Returns a copy of the current snake(s). |
boolean[][] |
getExcludeMask()
Returns the current exclude mask. |
MTBPolygon2DSet |
getInitialSnakes()
Returns initial snake. |
MTBImage |
getInputImage()
Returns input image. |
int |
getIterationCount()
Returns the current iteration count. |
MTBImageRGB |
getResultSnakeImage()
Returns image with snakes contours. |
MTBPolygon2DSet |
getResultSnakes()
Returns the set of result snakes. |
int |
getSnakeNumber()
Returns the number of snakes currently managed. |
MTBImageRGB |
getStackWithIntermediateResults()
Returns a stack with intermediate segmentation results. |
protected abstract void |
initOptimizer()
Initializes the optimizer. |
protected void |
operate()
|
private void |
plotSnakesToImage()
Returns overlay of output snakes onto current input image. |
private static MTBImageRGB |
plotSnakesToImage(MTBPolygon2DSet polyset,
MTBImage image,
int[] colors)
Returns overlay of given snakes onto given image. |
abstract void |
printParams()
Print current parameter settings to standard output device. |
protected java.lang.Object |
readResolve()
Init function for deserialized objects. |
void |
requireCounterClockwiseSnakePointOrder()
Request snakes ordered counter-clockwise. |
protected abstract void |
saveSnake()
Save intermediate results. |
void |
setExcludeMask(boolean[][] mask)
Set exclude mask. |
void |
setInitialSnakes(MTBPolygon2DSet inS)
Specify initial snakes. |
void |
setInputImage(MTBImage img)
Specify an input image for the segmentation. |
void |
setIntermediateResultPath(java.lang.String path)
Set path for intermediate results. |
protected abstract void |
showSnake()
Display current result contour by overlaying the current snake result onto the input image. |
java.lang.String |
toString()
|
void |
validateCustom()
|
void |
wantStackWithIntermediateResults(boolean flag)
Flag for turning on/off generation of stack with intermediate results. |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
addALDConfigurationEventListener, addALDControlEventListener, fireALDConfigurationEvent, fireALDControlEvent, handleALDConfigurationEvent, handleALDControlEvent, removeALDConfigurationEventListener, removeALDControlEventListener, setNotifyRecursiveFlag |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient boolean counterClockwiseSnakePointOrderRequested
@Parameter(label="Energy data", direction=OUT, required=false, dataIOOrder=10, description="Table of iteration-wise energies.") protected transient MTBTableModel energyData
protected transient boolean[][] excludeMask
protected transient int iHeight
@Parameter(label="Input Image", mode=STANDARD, direction=IN, required=true, description="Input Image.", dataIOOrder=0) protected transient MTBImage inImg
@Parameter(label="Initial Snake(s)", mode=STANDARD, direction=IN, required=true, description="Initial snakes.", dataIOOrder=1) protected MTBPolygon2DSet initialSnakes
protected transient java.util.Vector<MTBPolygon2DSet> intermediateResults
protected transient int itCounter
protected transient int iWidth
@Parameter(label="Stack with Intermediate Results", direction=OUT, supplemental=true, description="Optional stack of intermediate segmentation results.") protected transient MTBImageRGB outIntermediateResultsStack
@Parameter(label="Saving Interval for Stack", mode=ADVANCED, direction=IN, dataIOOrder=5, supplemental=true, description="Interval for saving results to stack.") protected int outIntermediateResultsStackInterval
Note that memory issues might occur if number of iterations is high and the interval small...
@Parameter(label="Show Intermediate Snakes Stack", mode=ADVANCED, direction=IN, dataIOOrder=4, supplemental=true, description="Flag to show stack with intermediate segmentations.") protected java.lang.Boolean outIntermediateResultsStackWanted
@Parameter(label="outSnakes", direction=OUT, description="Final snake(s).") protected transient MTBPolygon2DSet outSnakes
@Parameter(label="Snake Plot", direction=OUT, description="Overlay with final snake(s).") protected transient MTBImageRGB outSnakesImg
@Parameter(label="Collect energy data", supplemental=true, direction=IN, required=false, dataIOOrder=15, description="Flag for collecting energy data in each iteration.") protected java.lang.Boolean sampleEnergyData
@Parameter(label="Save Intermediate Results", mode=ADVANCED, direction=IN, dataIOOrder=2, supplemental=true, description="Save intermediate results to disc.") protected java.lang.Boolean saveIntermediateResults
@Parameter(label="Save Intermediate Results To...", mode=ADVANCED, supplemental=true, direction=IN, dataIOOrder=3, description="Path for saving intermediate results.") protected de.unihalle.informatik.Alida.datatypes.ALDDirectoryString saveIntermediateResultsPath
@Parameter(label="Show Intermediate Results", mode=STANDARD, direction=IN, dataIOOrder=1, supplemental=true, description="Show intermediate results to user.") protected java.lang.Boolean showIntermediateResults
protected transient int snakeNum
Constructor Detail |
---|
public SnakeOptimizer() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail |
---|
public abstract SnakeOptimizer clone()
clone
in class java.lang.Object
protected abstract void closeWindows()
public final void disableSaveIntermediateResults()
public final void disableShowIntermediateResults()
protected abstract SnakeOptimizer.Snake_status doIteration() throws MTBException
MTBException
public final void enableSaveIntermediateResults()
public final void enableShowIntermediateResults()
private void generateStackWithIntermediateResults()
public abstract MTBPolygon2DSet getCurrentSnakes()
If the optimizer deals with a single snake, the set contains only a single snake polygon.
public final boolean[][] getExcludeMask()
public final MTBPolygon2DSet getInitialSnakes()
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public final MTBImage getInputImage()
public final int getIterationCount()
public MTBImageRGB getResultSnakeImage()
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public final MTBPolygon2DSet getResultSnakes()
public final int getSnakeNumber()
public final MTBImageRGB getStackWithIntermediateResults()
protected abstract void initOptimizer() throws de.unihalle.informatik.Alida.exceptions.ALDException
Needs to be implemented by any derived class. This routine is automatically called on invoking the local operate routine.
de.unihalle.informatik.Alida.exceptions.ALDException
protected final void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperatorControllable
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
private void plotSnakesToImage()
private static MTBImageRGB plotSnakesToImage(MTBPolygon2DSet polyset, MTBImage image, int[] colors)
polyset
- Set of snakes.image
- Input image where to plot the snakes.
public abstract void printParams()
protected java.lang.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 de.unihalle.informatik.Alida.operator.ALDOperator
public final void requireCounterClockwiseSnakePointOrder()
This function is intended for energies which require a certain sorting of the snake points.
protected abstract void saveSnake()
public final void setExcludeMask(boolean[][] mask)
public final void setInitialSnakes(MTBPolygon2DSet inS)
inS
- Initial snakes.public final void setInputImage(MTBImage img)
img
- Input image.public final void setIntermediateResultPath(java.lang.String path)
protected abstract void showSnake()
public java.lang.String toString()
toString
in class java.lang.Object
public void validateCustom() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
validateCustom
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public final void wantStackWithIntermediateResults(boolean flag)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |