@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, shortDescription="Fills holes in connected components of binary or label images.") public class FillHoles2D extends MTBOperator implements loci.common.StatusReporter
If there is only a single grey value besides the background (of zero) the input image is assumed to be binary, otherwise a label image.
If the input image is a label image each label is assumed to constitute one connected component, i.e. one region. Otherwise the result of the operator is undefined.
If the input image is binary conncected components are detected an filled.
Modifier and Type | Field and Description |
---|---|
private MTBImage |
inImg
Input image.
|
private Vector<loci.common.StatusListener> |
m_statusListeners
vector of installed StatusListeners
|
private static String |
opIdentifier
Identifier for outputs in verbose mode.
|
private MTBImage |
resultImg
Result image.
|
Constructor and Description |
---|
FillHoles2D()
Default constructor.
|
FillHoles2D(MTBImage img)
Constructor with input image.
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(loci.common.StatusListener statuslistener) |
String |
getDocumentation() |
MTBImage |
getInputImage()
Get reference to the current input image.
|
MTBImage |
getResultImage()
Get the resulting image.
|
void |
notifyListeners(loci.common.StatusEvent e) |
protected void |
operate() |
private void |
paintFilledRegion(MTBRegion2D reg,
MTBImage img,
MTBImage outImg)
Draw a region without holes to an image.
|
private void |
paintFilledRegionsBinary(MTBImage img,
MTBImage outImg,
int v)
Close holes in binary image.
|
protected Object |
readResolve()
Init function for deserialized objects.
|
void |
removeStatusListener(loci.common.StatusListener statuslistener) |
void |
setInputImage(MTBImage inputImage)
Set input image.
|
protected void |
setResultImage(MTBImage resultImage)
Set the result image.
|
void |
validateCustom() |
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
private static final String opIdentifier
@Parameter(label="Input image", required=true, direction=IN, mode=STANDARD, dataIOOrder=1, description="Input image, binary or label image") private transient MTBImage inImg
@Parameter(label="Result image", required=true, direction=OUT, mode=STANDARD, dataIOOrder=2, description="Result image") private transient MTBImage resultImg
private transient Vector<loci.common.StatusListener> m_statusListeners
public FillHoles2D() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public FillHoles2D(MTBImage img) throws IllegalArgumentException, de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- Image to process.IllegalArgumentException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.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
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 MTBOperator
public MTBImage getInputImage()
public void setInputImage(MTBImage inputImage)
inputImage
- Input image to process.public MTBImage getResultImage()
protected void setResultImage(MTBImage resultImage)
resultImage
- Set result image variable.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 void paintFilledRegionsBinary(MTBImage img, MTBImage outImg, int v) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
In a binary image the foreground regions are in white, while background and holes are black. The difference between holes and background is given by the fact that holes have to be completely enclosed by a region, thus, never touch the image boundary.
The method first inverts the image and then labels the background and hole components. Afterwards all regions are checked for contact with the image boundary, and if there is no contact the region is identified as a hole region and drawn to the output image.
img
- Binary region image with holes (in black).outImg
- Binary region image without holes (regions in white).v
- Value of foreground in input/result image.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.private void paintFilledRegion(MTBRegion2D reg, MTBImage img, MTBImage outImg) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
reg
- Region to draw.img
- Original input image.outImg
- Image where to draw it.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.public void addStatusListener(loci.common.StatusListener statuslistener)
addStatusListener
in interface loci.common.StatusReporter
public void notifyListeners(loci.common.StatusEvent e)
notifyListeners
in interface loci.common.StatusReporter
public void removeStatusListener(loci.common.StatusListener statuslistener)
removeStatusListener
in interface loci.common.StatusReporter
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.