@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION) public class ContourOnLabeledComponents extends MTBOperator
Outer contours as well as inner contours (length greater than a given value) are segmented.
Modifier and Type | Class and Description |
---|---|
static class |
ContourOnLabeledComponents.ContourType
The possible type of contours for segmentation.
|
Modifier and Type | Field and Description |
---|---|
private ContourOnLabeledComponents.ContourType |
contourType
Special type of contours to calculate.
|
private int |
height
Image height.
|
private int |
innerContourLengthMin
Minimum number of pixels a inner contour must have (length of the contour).
|
private MTBImageByte |
inputImage
The binary input image where the contours should be calculated from.
|
private MTBRegion2DSet |
inputRegions
The input regions where the contours should be calculated from.
|
private MTBContour2DSet |
resultContours
* The calculated contours, every contour can include several inner
contours.
|
private MTBImageByte |
resultImage
* The binary image with the calculated contours and the contours as
possible outputs from the operator.
|
private int |
width
Image width.
|
Constructor and Description |
---|
ContourOnLabeledComponents()
Standard constructor.
|
ContourOnLabeledComponents(MTBImageByte inImg,
MTBRegion2DSet inRegions,
ContourOnLabeledComponents.ContourType type,
int length)
Constructor.
|
ContourOnLabeledComponents(MTBRegion2DSet inRegions,
ContourOnLabeledComponents.ContourType type,
int length)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected MTBContour2DSet |
addInnerContours()
Adding the possible inner contours to the outer contour of a region.
|
protected MTBImageByte |
calcContours()
Get all inner- and outer-contours for the given regions.
|
protected int |
findNextPoint(Point2D.Double Xc,
int dir,
MTBImageByte theImage)
Find direction to next pixel in specific direction from the last pixel.
|
ContourOnLabeledComponents.ContourType |
getContourType()
Get reference to the current contour type.
|
int |
getHeight()
Get image height.
|
int |
getInnerContourLengthMin()
Get the minimum number of pixels in the inner contour (length of the
contour).
|
MTBImageByte |
getInputImage()
Get reference to the current input image.
|
MTBRegion2DSet |
getInputRegions()
Get reference to the input regions.
|
protected MTBContour2DSet |
getOuterContours(MTBRegion2DSet theRegions,
MTBImageByte theImage)
Calculate the outer contours of the given regions in a image.
|
MTBContour2DSet |
getResultContours()
Get reference to the calculated contours.
|
MTBImageByte |
getResultImage()
Get reference to the binary image with the calculated contours.
|
int |
getWidth()
Get image width.
|
protected void |
operate()
This method does the actual work.
|
void |
setContourType(ContourOnLabeledComponents.ContourType type)
Set reference to the contour type.
|
void |
setHeight(int h)
Set image height.
|
void |
setInnerContourLengthMin(int length)
Set the minimum number of pixels in the inner contour (length of the
contour).
|
void |
setInputImage(MTBImageByte inImg)
Set reference to the current input image.
|
void |
setInputRegions(MTBRegion2DSet inRegions)
Set reference to the the input regions.
|
void |
setWidth(int w)
Set image width.
|
protected MTBImageByte |
toMTBImageByte()
Method to save all contours from the regions on a binary image with
specific width and height.
|
protected MTBContour2D |
traceContour(int xS,
int yS,
MTBImageByte theImage)
Trace contour, starting at (xS, yS) in direction dS.
|
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
private transient int width
private transient int height
@Parameter(label="Inner Contour Length Min", required=true, direction=IN, description="Minimum of inner contour length.") private int innerContourLengthMin
@Parameter(label="Contour Type", required=true, direction=IN, description="Contour type.") private ContourOnLabeledComponents.ContourType contourType
@Parameter(label="Input Image", required=false, direction=IN, description="Input image.") private transient MTBImageByte inputImage
@Parameter(label="Input Regions", required=true, direction=IN, description="Input regions.") private transient MTBRegion2DSet inputRegions
@Parameter(label="Result Image", required=true, direction=OUT, description="Result image with contours.") private transient MTBImageByte resultImage
@Parameter(label="Result Contours", required=true, direction=OUT, description="Resulting contour set.") private transient MTBContour2DSet resultContours
public ContourOnLabeledComponents() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ContourOnLabeledComponents(MTBImageByte inImg, MTBRegion2DSet inRegions, ContourOnLabeledComponents.ContourType type, int length) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
inImg
- input image to work oninRegions
- regions to get the contours fromtype
- type of the resulting contour regions to get the contours fromlength
- minimum number of pixels that a inner region must have (length of
the inner contour) to calculate the inner contourde.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ContourOnLabeledComponents(MTBRegion2DSet inRegions, ContourOnLabeledComponents.ContourType type, int length) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
inRegions
- regions to get the contours fromtype
- type of the resulting contour regions to get the contours fromlength
- minimum number of pixels that a inner region must have (length of
the inner contour) to calculate the inner contourde.unihalle.informatik.Alida.exceptions.ALDOperatorException
public MTBImageByte getInputImage()
public void setInputImage(MTBImageByte inImg)
public MTBRegion2DSet getInputRegions()
public void setInputRegions(MTBRegion2DSet inRegions)
public ContourOnLabeledComponents.ContourType getContourType()
public void setContourType(ContourOnLabeledComponents.ContourType type)
public int getInnerContourLengthMin()
public void setInnerContourLengthMin(int length)
public MTBImageByte getResultImage()
public MTBContour2DSet getResultContours()
public int getWidth()
public void setWidth(int w)
public int getHeight()
public void setHeight(int h)
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 MTBImageByte calcContours() 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 MTBContour2DSet addInnerContours() 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 MTBContour2DSet getOuterContours(MTBRegion2DSet theRegions, MTBImageByte theImage)
theRegions
- Regions to get contours from.theImage
- Binary image of the regions to get the contours from.protected MTBContour2D traceContour(int xS, int yS, MTBImageByte theImage)
xS
- starting x-coordinateyS
- starting y-coordinatetheImage
- the binary image to validate if pixel is black or white (get the
label)protected int findNextPoint(Point2D.Double Xc, int dir, MTBImageByte theImage)
Xc
- starting pointdir
- direction of last pointtheImage
- the binary image to validate if pixel is black or white (get the
label)protected MTBImageByte toMTBImageByte()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.