@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION) public class BordersOnLabeledComponents extends MTBOperator
Contrary to contours, for example extracted by the operator
ContourOnLabeledComponents
, the borders extracted by this operator
contain unordered sets of pixels, i.e. the border elements are neither
clockwise nor counter-clockwise sorted. The main advantage of this operator
is that it is faster than the counterpart, and very often there is no need
for ordered contours, but unordered contours are sufficient for the task
at hand.
The operator allows to extract outer borders, inner borders or both. If
only inner borders are to be extracted a border set is returned which
contains empty outer dummy borders which contain the inner borders. This
way the inner borders are grouped according to the regions they belong to.
But, note that this behavior is different from the
ContourOnLabeledComponents
operator.
This operator takes a label image as input interpreting all pixels with values larger than zero as foreground pixels. Alternatively you can supply a region set. If both are given, the operator assumes that label image and region set are consistent.
Modifier and Type | Class and Description |
---|---|
static class |
BordersOnLabeledComponents.BorderType
Possible types of borders to be extracted.
|
Modifier and Type | Field and Description |
---|---|
private BordersOnLabeledComponents.BorderType |
borderType
Type of borders to be extracted.
|
private MTBBorder2D.BorderConnectivity |
connectivity
Connectivity within resulting borders.
|
private int |
height
Image height.
|
private MTBImage |
inputImage
(Optional) input image where the borders should be extracted from.
|
private MTBRegion2DSet |
inputRegions
(Optional) region set where the borders should be extracted from.
|
private int |
minimalBorderLength
Lower threshold for border length.
|
private MTBBorder2DSet |
resultBorders
Set of extracted borders.
|
private MTBImageShort |
resultImage
Image of extracted borders.
|
private int |
width
Image width.
|
Constructor and Description |
---|
BordersOnLabeledComponents()
Standard constructor.
|
BordersOnLabeledComponents(MTBImage inImg,
MTBRegion2DSet inRegions,
MTBBorder2D.BorderConnectivity con,
BordersOnLabeledComponents.BorderType type,
int minLength)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
drawBordersToImage()
Draws result contours to an image.
|
protected void |
extractBorders()
Extract requested borders for given input data.
|
MTBBorder2DSet |
getResultBorders()
Get result borders.
|
MTBImageShort |
getResultImage()
Get result image with extracted borders.
|
protected void |
operate() |
void |
setBorderType(BordersOnLabeledComponents.BorderType type)
Set border type to be extracted.
|
void |
setConnectivity(MTBBorder2D.BorderConnectivity bc)
Specify connectivity for extracted border pixels.
|
void |
setInputImage(MTBImage inImg)
Set input image.
|
void |
setInputRegions(MTBRegion2DSet inRegions)
Set input regions.
|
void |
setMinimalBorderLength(int length)
Set the minimal border length.
|
void |
validateCustom() |
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, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="Border Type", required=true, dataIOOrder=0, direction=IN, description="Border type.") private BordersOnLabeledComponents.BorderType borderType
@Parameter(label="Input Image", required=false, dataIOOrder=0, direction=IN, description="Input image.") private transient MTBImage inputImage
@Parameter(label="Input Regions", required=false, dataIOOrder=1, direction=IN, description="Input regions.") private transient MTBRegion2DSet inputRegions
@Parameter(label="Desired connectivity of border pixels", required=false, dataIOOrder=2, direction=IN, description="Desired connectivity of border pixels.") private MTBBorder2D.BorderConnectivity connectivity
Default is 8-neighborhood.
@Parameter(label="Minimal Length", required=false, dataIOOrder=3, direction=IN, description="Minimum length of borders.") private int minimalBorderLength
Allows to exclude too short borders from the result set, result only contains borders with length greater or equal threshold.
@Parameter(label="Result Image", dataIOOrder=0, direction=OUT, description="Result image with extracted borders.") private transient MTBImageShort resultImage
Outer borders are labeled sequentially, inner borders are marked gray.
@Parameter(label="Result Borders", dataIOOrder=1, direction=OUT, description="Resulting set of borders.") private transient MTBBorder2DSet resultBorders
A border can include additional inner borders.
private transient int width
private transient int height
public BordersOnLabeledComponents() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public BordersOnLabeledComponents(MTBImage inImg, MTBRegion2DSet inRegions, MTBBorder2D.BorderConnectivity con, BordersOnLabeledComponents.BorderType type, int minLength) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public void setInputImage(MTBImage inImg)
Image
- to process.public void setInputRegions(MTBRegion2DSet inRegions)
Regions
- to process.public void setConnectivity(MTBBorder2D.BorderConnectivity bc)
bc
- Connectivity.public void setBorderType(BordersOnLabeledComponents.BorderType type)
Type
- of borders to be extracted.public void setMinimalBorderLength(int length)
length
- Minimal length of borders to be extracted.public MTBImageShort getResultImage()
public MTBBorder2DSet getResultBorders()
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 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 void extractBorders() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
protected void drawBordersToImage()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.