@ALDAOperator(level=APPLICATION, genericExecutionMode=ALL) public class LevelsetSegmentationNonPDE extends MTBOperator
Details
The input image is segmented using a level set technique.
Segmentation by be done using two or multiple phases, if multiphase is true.
Optionally a topology preserving mode is available (only 2D currently)
which assumes initially object phases with exactly one connected component each
and no holes. This condition is preserved during optimization.
The maximal number of iterations is given as maxiter.
If invalidImg all pixels/voxels in this image with non-zero intensities are
interpreted as invalid. This is in principle as if this pixels/voxels would not exist
(similar to pixels/voxels outside the image domain):
They are neither assigned a phase to, nor are image intensities used, e.g. to compute
gradients.
Initialization
If no initialization is given, a default initialization,
usually a circle/sphere is used.
If both initLabelImg and initBinImg are supplied, initLabelImg is used.
If a two phase approach is used (i.e. multiphase is false) then both
types of initialization are identical: all pixels/voxels with intensity zero are
assumed as background (phase), all other as foreground phase.
In the multi phase case the labels in initLabelImg are assumed to be the
phases to be used for initialization. Again, pixels/voxels with intensity zero are
assumed as background (phase).
If in the multi phase case initBinImg is given, the image is interpreted
as a binary image (zero is again background), a compontent labeling is
done and each resulting connected component assign to one phase
(in addition to the background phase).
Result
The final segmentation is output as a label image.
Additional Output
If verbose is set output is written to stdout. The debug argument is a bit mask to control debuggung output. This is intended for developers and not (well) documented, also behaviour may change over time without notice. If spacing is non-zero, intermediate levelset functions after each spacing-th iteration are output to files with prefix ibase (default intermediateLS) and incrementally numbered. As a zero-th levelset function the initialization is prepended and the final result added as a last levelset image (which might happen to show up twice). Additionally the input image is overlayed with the final contours of the object phases as well as with the contours of the intialization. This image is output to the file contourResult (default: contourImg.tif).
Limitations Currently not all options are implemented for the plugin version.
Modifier and Type | Field and Description |
---|---|
private Integer |
debug |
(package private) static Double |
DEFAULT_ALPHA |
(package private) static Double |
DEFAULT_KAPPA |
(package private) static Double |
DEFAULT_LAMBDA_BG |
(package private) static Double |
DEFAULT_LAMBDA_FG |
(package private) static Integer |
DEFAULT_MAXITER |
(package private) static Double |
DEFAULT_MU |
(package private) static Double |
DEFAULT_NU |
(package private) static Double |
DEFAULT_SIGMA |
private MTBGenericEnergyNonPDE |
energy |
private MTBImage |
inImg |
private MTBImage |
initBinImg |
private MTBImage |
initLabelImg |
private MTBRegion2DSet |
initRegions |
private MTBImage |
intermediateLS |
private MTBImage |
invalidImg |
private Integer |
maxIter |
private Boolean |
multiphase |
private Integer |
numIterations |
private Boolean |
preserveTopology |
private MTBImage |
resultContourImage |
private MTBImage |
resultImg |
private Integer |
spacing |
private Double |
threshold |
Constructor and Description |
---|
LevelsetSegmentationNonPDE()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private MTBImage |
drawContours(MTBImage inImg,
MTBImage resultImg,
MTBImage initLabelImg)
Draw contours of resultImg and if non null initLabelImg
into inIMg and return this result in a new image
|
private static MTBImage |
getContourImg(MTBImage img)
Create a new image where all contour pixels of img are set to 1,
all other pixels to 0.
|
Integer |
getDebug()
Get value of debug.
|
MTBGenericEnergyNonPDE |
getEnergy()
Get value of energy.
|
MTBImage |
getInImg()
Get value of inImg.
|
MTBImage |
getInitBinImg()
Get value of initBinImg.
|
MTBImage |
getInitLabelImg()
Get value of initLabelImg.
|
MTBImage |
getIntermediateLS() |
MTBImage |
getInvalidImg()
Get value of invalidImg.
|
Integer |
getMaxIter()
Get value of maxIter.
|
Boolean |
getMultiphase()
Get value of multiphase.
|
Integer |
getNumIterations()
Get value of numIterations
Explanation: Number of iterations performed
|
Boolean |
getPreserveTopology()
Get value of preserveTopology.
|
MTBImage |
getResultContourImage()
Get value of ResultContourImage.
|
MTBImage |
getResultImage()
Get value of ResultImage.
|
Integer |
getSpacing()
Get value of spacing.
|
Double |
getThreshold()
Get value of threshold.
|
private MTBLevelsetMembership |
initLS()
Construct an initial level set function.
|
private LevelsetSolveNonPDE |
initSolver()
Create a parameter object and set/initialize all objects.
|
protected void |
operate() |
void |
setDebug(Integer value)
Set value of debug.
|
void |
setEnergy(MTBGenericEnergyNonPDE energy)
Set value of energy.
|
void |
setInImg(MTBImage value)
Set value of inImg.
|
void |
setInitBinImg(MTBImage value)
Set value of initBinImg.
|
void |
setInitLabelImg(MTBImage value)
Set value of initLabelImg.
|
void |
setIntermediateLS(MTBImage intermediateLS) |
void |
setInvalidImg(MTBImage value)
Set value of invalidImg.
|
void |
setMaxIter(Integer value)
Set value of maxIter.
|
void |
setMultiphase(Boolean value)
Set value of multiphase.
|
void |
setNumIterations(Integer value)
Set value of numIterations
Explanation: Number of iterations performed
|
void |
setPreserveTopology(Boolean value)
Set value of preserveTopology.
|
void |
setResultContourImage(MTBImage value)
Set value of ResultContourImage.
|
void |
setResultImage(MTBImage value)
Set value of ResultImage.
|
void |
setSpacing(Integer value)
Set value of spacing.
|
void |
setThreshold(Double value)
Set value of threshold.
|
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
static final Integer DEFAULT_MAXITER
static final Double DEFAULT_MU
static final Double DEFAULT_LAMBDA_FG
static final Double DEFAULT_LAMBDA_BG
static final Double DEFAULT_NU
static final Double DEFAULT_ALPHA
static final Double DEFAULT_SIGMA
static final Double DEFAULT_KAPPA
@Parameter(label="Input image", required=true, direction=IN, dataIOOrder=0, description="Input image to segment.") private transient MTBImage inImg
@Parameter(label="Energy", required=true, direction=IN, dataIOOrder=1, description="Energy to use for optimization.") private MTBGenericEnergyNonPDE energy
@Parameter(label="Max. iterations", required=true, direction=IN, dataIOOrder=2, description="Maximal number of iterations for optimization.") private Integer maxIter
@Parameter(label="Preserve topology", required=true, direction=IN, dataIOOrder=3, description="Preserve topology during optimization.") private Boolean preserveTopology
@Parameter(label="Multiphase", required=true, direction=IN, dataIOOrder=4, mode=ADVANCED, description="Use multiphase level sets.") private Boolean multiphase
@Parameter(label="Initial segmentation (binary)", required=false, direction=IN, dataIOOrder=6, description="Binary image for initialization.") private transient MTBImage initBinImg
@Parameter(label="Initial segmentation (labeled)", required=false, direction=IN, dataIOOrder=5, description="Label image for initialization.") private transient MTBImage initLabelImg
@Parameter(label="Initial regions", required=false, direction=IN, dataIOOrder=7, description="Regions for initialization.") private MTBRegion2DSet initRegions
@Parameter(label="Initialization threshold", required=false, direction=IN, dataIOOrder=8, description="Threshold to initialize the level set function.") private Double threshold
@Parameter(label="Invalid pixel map", required=false, direction=IN, dataIOOrder=9, description="Image of invalid pixels (pixels != 0 are invalid).") private transient MTBImage invalidImg
@Parameter(label="Result segmentation", direction=OUT, description="Resulting label image.", dataIOOrder=0) private transient MTBImage resultImg
@Parameter(label="Result contour image", direction=OUT, description="Resulting contour image.", dataIOOrder=1) private transient MTBImage resultContourImage
@Parameter(label="Number of iterations", direction=OUT, description="Number of iterations performed.", dataIOOrder=2) private Integer numIterations
@Parameter(label="Sampling rate for intermediate results", direction=IN, dataIOOrder=-2, supplemental=true, description="Spacing of intermediate results (none if spacing == 0).") private Integer spacing
@Parameter(label="Debugging", direction=IN, supplemental=true, dataIOOrder=-1, description="Bit mask for debugging of level set solver.") private Integer debug
@Parameter(label="Intermediate results", required=false, direction=OUT, supplemental=true, dataIOOrder=3, description="Intermediate level set segmentation results.") private transient MTBImage intermediateLS
public LevelsetSegmentationNonPDE() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private LevelsetSolveNonPDE initSolver() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
private MTBLevelsetMembership initLS()
If both initBinImg and initLabelImg are supplied, initLabelImg is preferred for initialization. If both are null, contours are imported from ImageJ's ROI manager (if available). Only if none the three formerly mentioned parameters is non-null, the image is binarized applying the specified threshold.
MTBLevelsetMembership
private static MTBImage getContourImg(MTBImage img)
private MTBImage drawContours(MTBImage inImg, MTBImage resultImg, MTBImage initLabelImg)
public Integer getDebug()
public void setDebug(Integer value)
value
- New value of debugpublic MTBGenericEnergyNonPDE getEnergy()
public void setEnergy(MTBGenericEnergyNonPDE energy)
energy
- New value of energypublic Double getThreshold()
public void setThreshold(Double value)
value
- New value of thresholdpublic Integer getMaxIter()
public void setMaxIter(Integer value)
value
- New value of maxIterpublic Boolean getPreserveTopology()
public void setPreserveTopology(Boolean value)
value
- New value of preserveTopologypublic Integer getSpacing()
public void setSpacing(Integer value)
value
- New value of spacingpublic Boolean getMultiphase()
public void setMultiphase(Boolean value)
value
- New value of multiphasepublic MTBImage getInvalidImg()
public void setInvalidImg(MTBImage value)
value
- New value of invalidImgpublic MTBImage getInitLabelImg()
public void setInitLabelImg(MTBImage value)
value
- New value of initLabelImgpublic MTBImage getInImg()
public void setInImg(MTBImage value)
value
- New value of inImgpublic MTBImage getInitBinImg()
public void setInitBinImg(MTBImage value)
value
- New value of initBinImgpublic MTBImage getResultContourImage()
public void setResultContourImage(MTBImage value)
value
- New value of ResultContourImagepublic MTBImage getResultImage()
public void setResultImage(MTBImage value)
value
- New value of ResultImagepublic Integer getNumIterations()
public void setNumIterations(Integer value)
New
- value of numIterationspublic MTBImage getIntermediateLS()
public void setIntermediateLS(MTBImage intermediateLS)
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.