@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION, shortDescription="Sequential component labeling for binarized 2D images.") public class LabelComponentsSequential extends MTBOperator
Modifier and Type | Field and Description |
---|---|
private MTBImage |
colorImage
Image of regions in random colors.
|
private Boolean |
createColorImage
Flag to enable/disable creation of region image in random colors.
|
private Boolean |
createIDImage
Flag to enable/disable creation of gray-scale image with region IDs.
|
private Boolean |
createLabelImage
Flag to enable/disable creation of gray-scale label image.
|
private boolean |
diagonalNeighbors
Flag to define 4-/8-neighborhood in components.
|
private MTBImage |
idImage
Gray-scale image with IDs printed to regions.
|
private MTBImage |
inputImage
Input image to label.
|
private MTBImage |
labelImage
Grayscale image of regions, gray values are identical to IDs.
|
private int |
m_height
Height of input image.
|
private MTBImageInt |
m_labelImg
Temporary label image.
|
private int |
m_width
Width of input image.
|
private MTBRegion2DSet |
resultingRegions
Resulting set of labeled regions.
|
Constructor and Description |
---|
LabelComponentsSequential()
Constructor.
|
LabelComponentsSequential(MTBImage img,
boolean dn)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static MTBImage |
drawStringToImage(MTBImage labelImage2,
String s,
int xPos,
int yPos)
Draws string at given position into image.
|
MTBImage |
getColorImage()
Get image of randomly colored regions, if the create-color-image-flag was set to true.
|
boolean |
getCreateColorImageFlag()
Get the flag that determines the creation of an image with randomly colored regions.
|
boolean |
getCreateLabelImageFlag()
Get the flag that determines the creation of an image with region labels.
|
boolean |
getDiagonalNeighborsFlag()
Get the neighborhood flag.
|
String |
getDocumentation() |
MTBImage |
getIDImage()
Get image of region ID (of type MTB_BYTE).
|
MTBImage |
getInputImage()
Get reference to the current input image.
|
private int |
getLabel(int x,
int y)
returns the value of labelImg at position (x,y).
|
MTBImage |
getLabelImage()
Get image of region labels (of type MTB_INT).
|
MTBRegion2DSet |
getResultingRegions()
Get the resulting regions.
|
protected MTBRegion2DSet |
labelComponents(MTBImage img,
boolean diagonalNeighbors)
Sequential component labeling
|
protected void |
operate() |
protected void |
setColorImage(MTBImage colorImage)
Add the label image to the parameter object
|
void |
setCreateColorImageFlag(boolean createColorImage)
Set the flag that determines the creation of an image with randomly colored regions.
|
void |
setCreateIDImageFlag(boolean b)
Enable/disable creation of ID image.
|
void |
setCreateLabelImageFlag(boolean createLabelImage)
Set the flag that determines the creation of an image with region labels.
|
void |
setDiagonalNeighborsFlag(boolean diagonalNeighbors)
Set the neighborhood flag.
|
void |
setInputImage(MTBImage iImage)
Set a new input image.
|
protected void |
setLabelImage(MTBImage labelImage)
Set image of region labels
|
protected void |
setResultingRegions(MTBRegion2DSet regions)
Attach the vector of resulting regions.
|
readResolve
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, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="Input image", required=true, direction=IN, dataIOOrder=0, mode=STANDARD, description="Input image") private transient MTBImage inputImage
@Parameter(label="Diagonal neighborhood", required=true, direction=IN, dataIOOrder=1, mode=STANDARD, description="true for 8-neighborhood, false for 4-neighborhood") private boolean diagonalNeighbors
@Parameter(label="Create label image", required=true, direction=IN, dataIOOrder=2, mode=STANDARD, description="Create image of regions with region labels as grayvalue.") private Boolean createLabelImage
@Parameter(label="Create image with ID strings", required=true, direction=IN, dataIOOrder=3, mode=STANDARD, description="Create image of regions with numerical IDs written to regions.") private Boolean createIDImage
@Parameter(label="Create color image", required=true, direction=IN, dataIOOrder=4, mode=STANDARD, description="Create image of regions with random colors") private Boolean createColorImage
@Parameter(label="Resulting regions", required=true, direction=OUT, dataIOOrder=0, description="Resulting regions") private MTBRegion2DSet resultingRegions
@Parameter(label="Label image", required=false, direction=OUT, dataIOOrder=1, description="Image of regions with labels (MTBImageType.MTB_INT)") private transient MTBImage labelImage
@Parameter(label="ID image", required=false, direction=OUT, dataIOOrder=2, description="Image of region IDs") private transient MTBImage idImage
Note that the gray values are scaled for better visibility and to not coincide with the region labels.
@Parameter(label="Color image", required=false, direction=OUT, dataIOOrder=3, description="Image of regions with random colors") private transient MTBImage colorImage
private MTBImageInt m_labelImg
private int m_width
private int m_height
public LabelComponentsSequential() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public LabelComponentsSequential(MTBImage img, boolean dn) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- Input image.dn
- Set true for 8-NB or false for 4-NB.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.public MTBImage getInputImage()
public void setInputImage(MTBImage iImage)
iImage
- Input image to label.public boolean getDiagonalNeighborsFlag()
public void setDiagonalNeighborsFlag(boolean diagonalNeighbors)
diagonalNeighbors
- set true for 8-neighborhood and false for 4-neighborhoodpublic boolean getCreateLabelImageFlag()
public void setCreateLabelImageFlag(boolean createLabelImage)
public void setCreateIDImageFlag(boolean b)
b
- If true, ID image is created.public boolean getCreateColorImageFlag()
public void setCreateColorImageFlag(boolean createColorImage)
protected void setResultingRegions(MTBRegion2DSet regions)
public MTBRegion2DSet getResultingRegions()
protected void setLabelImage(MTBImage labelImage)
public MTBImage getLabelImage()
Only available if the create-label-image-flag was set to true, otherwise returns null.
public MTBImage getIDImage()
Only available if the corresponding flag was set to true, otherwise returns null.
protected void setColorImage(MTBImage colorImage)
public MTBImage getColorImage()
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
protected MTBRegion2DSet labelComponents(MTBImage img, boolean diagonalNeighbors)
img
- (binary) input imagediagonalNeighbors
- set true for 8-neighborhood components, set false for 4-neighborhoodprivate int getLabel(int x, int y)
x
- x-coordinatey
- y-coordinatelabelImg
- actual label imageprotected static MTBImage drawStringToImage(MTBImage labelImage2, String s, int xPos, int yPos)
labelImage2
- Image where to draw the string into.s
- String to draw.xPos
- Position of string in x.yPos
- Position of string in y.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.