@ALDAOperator(genericExecutionMode=NONE) public class LevelsetSolveNonPDE extends MTBOperator
Optionally a invalid image may be supplied which defines pixels with nonzero value as invalid and not considered for segmentation.
The resulting image is a short image, where background and invalid pixels have zeros and the obejct compontens/phases values starting from one.
NOTE: if verbose is turned on runtime will typically be increase considerably due to outputting (and consequently computing) the complete energy.
Currently only 2D images are supported.
Modifier and Type | Class and Description |
---|---|
private class |
LevelsetSolveNonPDE.CoordInt3D
Just to hold 3D coordinate and nothing else
|
private class |
LevelsetSolveNonPDE.LevelsetIterator
Abstract class for iterators of pixels/voxels of the level set function.
|
private class |
LevelsetSolveNonPDE.LevelsetIteratorContourPoints
Iterator for all contour pixels/voxels of the level set function
excluding invalid pixels/voxels.
|
private class |
LevelsetSolveNonPDE.LevelsetIteratorScan
Iterator for all pixels/voxels of the level set function in scanline fashion
excluding invalid pixels/voxels.
|
Modifier and Type | Field and Description |
---|---|
private Integer |
debug |
private MTBGenericEnergyNonPDE |
energy |
private static int |
FLAG_SOLVER |
private static int |
FLAG_SOLVER2 |
private Vector<MTBImageShort> |
intermediateLS |
private MTBImage |
invalidImage |
private Integer |
maxIterations |
private short[] |
nbPhases
Phases of the 8-neighbors of the current pixel.
|
private Vector<Short> |
nbPhasesNonredundant
Non redudant phases in the neighborhood of the current pixel.
|
private Integer |
numIterations |
private MTBLevelsetMembership |
phi |
private Vector<Short> |
potentialNewPhases
Phases the current pixel is (topologically) allowed to change to.
|
private Boolean |
preserveTopology |
private MTBImageShort |
resultImage |
private Integer |
spacingIntermediate |
private boolean |
verbose |
Constructor and Description |
---|
LevelsetSolveNonPDE()
Constructor
|
LevelsetSolveNonPDE(MTBGenericEnergyNonPDE energy,
MTBLevelsetMembership phi,
int maxIter,
int spacingIntermediate,
MTBImage invalidImg,
boolean preserveTopology)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
get8NeighborsPhase(int x,
int y,
short[] nb)
Compute phases of 8 neighbors of (x,y) and store these
in the array
nb . |
Integer |
getDebug()
Get value of debug.
|
MTBGenericEnergyNonPDE |
getEnergy()
Get value of energy.
|
Vector<MTBImageShort> |
getIntermediateLS()
Get value of intermediateLS.
|
MTBImage |
getInvalidImage()
Get value of invalidImage.
|
Integer |
getMaxIterations()
Get value of maxIterations.
|
Integer |
getNumIterations()
Get value of numIterations
Explanation: Number of iterations performed
|
MTBLevelsetMembership |
getPhi()
Get value of phi.
|
private Vector<Short> |
getPotentialNewPhases2D(boolean preserveTopology,
int x,
int y) |
Boolean |
getPreserveTopology()
Get value of preserveTopology.
|
MTBImageShort |
getResultImage()
Get value of resultImage.
|
Integer |
getSpacingIntermediate()
Get value of spacingIntermediate.
|
private boolean |
hasForeign4Neighbor(short phase,
short[] nbPhases)
Check whether there is a different/foreign phase (then
phase ) in the 4-neighborhood
as represented in the 8 neighborhood nbPhases . |
private int |
numBlockChange(short[] nbPhases,
int r)
Return number of connected components of different/foreign phase then
r
in the 8 neighborhood nbPhases ,
which are 4 connected to the current pixel. |
protected void |
operate()
This function does the actual work, i.e. optimization of the energy.
|
private void |
printNbPhases(short[] nbPhases) |
void |
setDebug(Integer value)
Set value of debug.
|
void |
setMaxIterations(Integer value)
Set value of maxIterations.
|
void |
setPreserveTopology(Boolean value)
Set value of preserveTopology.
|
void |
setSpacingIntermediate(Integer value)
Set value of spacingIntermediate.
|
private boolean |
solve() |
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, 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, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="phi", required=true, direction=IN, description="Initial levelset function") private MTBLevelsetMembership phi
@Parameter(label="invalidImage", required=false, direction=IN, description="optional image of invalid pixels (pixels <> 0 are invalid)") private MTBImage invalidImage
@Parameter(label="resultImage", direction=OUT, description="Result image") private MTBImageShort resultImage
@Parameter(label="energy", required=true, direction=IN, description="Energy to use for optimization") private MTBGenericEnergyNonPDE energy
@Parameter(label="maxIterations", required=false, direction=IN, description="Maximal number of iterations") private Integer maxIterations
@Parameter(label="preserveTopology", required=true, direction=IN, description="Topology preserving mode?") private Boolean preserveTopology
@Parameter(label="debug", direction=IN, supplemental=true, description="Additional dubugging informaton") private Integer debug
@Parameter(label="spacingIntermediate", direction=IN, supplemental=true, description="spacing of intermediate of levelset function returned; 0 = none?") private Integer spacingIntermediate
@Parameter(label="intermediateLS", direction=IN, supplemental=true, description="intermediate of levelset functions") private Vector<MTBImageShort> intermediateLS
@Parameter(label="numIterations", direction=IN, supplemental=true, description="Number of iterations performed") private Integer numIterations
private Vector<Short> potentialNewPhases
private Vector<Short> nbPhasesNonredundant
private short[] nbPhases
private boolean verbose
private static final int FLAG_SOLVER
private static final int FLAG_SOLVER2
public LevelsetSolveNonPDE(MTBGenericEnergyNonPDE energy, MTBLevelsetMembership phi, int maxIter, int spacingIntermediate, MTBImage invalidImg, boolean preserveTopology) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
enery
- Energyls
- initialed level set function of type membership, i.e. LevelsetMembershipmaxIter
- maximal number of iterationsspacingIntermediate
- spacing of intermediate of level set function returned; 0 = noneinvalidImg
- optional image of invalid pixels (pixels <> 0 are invalid)preserveTopology
- verbose
- output if requesteddebug
- bit mask for debugging outputde.unihalle.informatik.Alida.exceptions.ALDOperatorException
public LevelsetSolveNonPDE() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
private boolean solve() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
private Vector<Short> getPotentialNewPhases2D(boolean preserveTopology, int x, int y)
private boolean hasForeign4Neighbor(short phase, short[] nbPhases)
phase
) in the 4-neighborhood
as represented in the 8 neighborhood nbPhases
.nbPhases
- private int numBlockChange(short[] nbPhases, int r)
r
in the 8 neighborhood nbPhases
,
which are 4 connected to the current pixel.
Invalid pixels are not considered as another phase
This is identical to the topological number T_4(\vec x,fg) n in
Han, X. and Xu, C. and Prince, J.L., A topology preserving level set method for geometric deformable models}, PAMI, pages 755-768, 2003
nbPhases
- Phases in the 8 neighborhood of current pixel with pahse r
r
- Phase of current pixelprivate void get8NeighborsPhase(int x, int y, short[] nb)
nb
.
This array is reused for efficiency.x
- x coordinatey
- y coordinatenb
- array in which to store the phases.private void printNbPhases(short[] nbPhases)
public Integer getMaxIterations()
public void setMaxIterations(Integer value)
value
- New value of maxIterationspublic Boolean getPreserveTopology()
public void setPreserveTopology(Boolean value)
value
- New value of preserveTopologypublic MTBGenericEnergyNonPDE getEnergy()
public MTBImage getInvalidImage()
public MTBLevelsetMembership getPhi()
public MTBImageShort getResultImage()
public Vector<MTBImageShort> getIntermediateLS()
public Integer getDebug()
public void setDebug(Integer value)
value
- New value of debugpublic Integer getNumIterations()
public Integer getSpacingIntermediate()
public void setSpacingIntermediate(Integer value)
value
- New value of spacingIntermediateCopyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.