|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.MiToBo.core.operator.MTBOperator
de.unihalle.informatik.MiToBo.morphology.ComponentPostprocess
@ALDAOperator(genericExecutionMode=ALL, level=STANDARD) public class ComponentPostprocess
Methods for post-processing components/pixels in binary images.
Thresholding algorithms yield binary images with distinct connected components of foreground pixels, i.e. regions. The routines of this class provide functionality for post-processing such binary (unlabeled) component images. Exemplary post-processing steps might include linking/merging adjacent components or changing a component's morphological shape.
Note that the different processing modes may require different parameter settings. These settings have to be done explicitly by calling the corresponding setter-functions the class provides. If the parameters are not set by the user default values are used.
Nested Class Summary | |
---|---|
static class |
ComponentPostprocess.ProcessMode
Processing mode identifiers. |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Field Summary | |
---|---|
private boolean |
diagonalNeighbors
Flag for using 8-neighborhood. |
private java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> |
endPointHash
|
private int |
height
|
private MTBImage |
inImg
Binary input image. |
private int |
maxCompDist
Maximal distance of adjacent components. |
private int |
maxCompSize
Minimal size of components in mode ERASE_SMALL_COMPS. |
private int |
maxVoronoiExpDist
Voronoi expansion distance. |
private int |
minCompSize
Minimal size of components in mode ERASE_SMALL_COMPS. |
private ComponentPostprocess.ProcessMode |
processMode
Processing mode. |
private MTBImageByte |
resultImg
Binary result image. |
private double |
roundnessThreshold
Roundness threshold for components. |
private int |
width
|
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
ComponentPostprocess()
Default constructor. |
|
ComponentPostprocess(MTBImage img,
ComponentPostprocess.ProcessMode pm)
Default constructor. |
|
ComponentPostprocess(MTBImage img,
ComponentPostprocess.ProcessMode pm,
int _minCompSize,
int _maxCompDist,
int maxVoroExpandDist)
Deprecated. |
|
ComponentPostprocess(MTBImage img,
ComponentPostprocess.ProcessMode pm,
int _minCompSize,
int _maxCompDist,
int maxVoroExpandDist,
double _roundnessThreshold)
Deprecated. |
Method Summary | |
---|---|
protected MTBImageByte |
EraseLargeComponents(MTBImageByte binIP,
int maxComponentSize)
Function to remove large components from a binary image. |
protected MTBImageByte |
EraseRoundComponents(MTBImageByte binImage,
double threshold)
Remove components with small eccentricity. |
protected MTBImageByte |
EraseSmallComponents(MTBImageByte binIP,
int minComponentSize)
Function to remove small components from a binary image. |
boolean |
getDiagonalNeighbors()
Get value of Parameter argument DiagonalNeighbors. |
MTBImage |
getInputImage()
Get reference to the current input image. |
int |
getMaximalComponentDist()
Returns the maximal component distance for linking. |
int |
getMaximalComponentSize()
Returns the maximal valid component size for component removal. |
int |
getMaxVoronoiExpandDist()
Returns the maximal distance of pixels considered in Voronoi expansion. |
int |
getMinimalComponentSize()
Returns the minimal valid component size for component removal. |
ComponentPostprocess.ProcessMode |
getProcessMode()
Get current process mode. |
MTBImageByte |
getResultImage()
Get the result image after applying operator. |
double |
getRoundnessThreshold()
Returns the currently active roundness threshold. |
protected MTBImageByte |
LinkAdjacentComponents(MTBImageByte binIP)
Function for linking adjacent components/regions in a binary image. |
protected MTBImageByte |
LinkAdjacentPixels(MTBImageByte binIP,
int maxDist)
Function for linking adjacent pixels in a binary image. |
protected void |
operate()
|
void |
setDiagonalNeighbors(boolean value)
If true 8-neighborhood, i.e. diagonal neighbors, will be used in mode 'VORONOI_EXPAND' for Voronoi dilation. |
void |
setMaximalComponentDistance(int _maxCompDist)
Set maximal component/pixel distance for linking. |
void |
setMaximalComponentSize(int _maxCompSize)
Set maximal component size for erasing large components. |
void |
setMaximalVoronoiExpansionDistance(int _maxVoroExpandDist)
Set radius of dilation mask in Voronoi expansion. |
void |
setMinimalComponentSize(int _minCompSize)
Set minimal component size for erasing small components. |
void |
setRoundnessThreshold(double _roundnessThreshold)
Set roundness threshold for eliminating round components. |
protected MTBImageByte |
VoronoiExpandComponents(MTBImageByte binImg,
int maxDist)
Dilate components, but avoid merges. |
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator |
---|
readResolve |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Parameter(label="Use Diagonal Neighbors? ", required=false, direction=IN, dataIOOrder=-10, description="Flag for considering 8-neighborhood instead of 4-NB") private boolean diagonalNeighbors
private java.util.Vector<java.util.Vector<java.awt.geom.Point2D.Double>> endPointHash
private int height
@Parameter(label="Binary Input Image", required=true, dataIOOrder=-10, direction=IN, description="Binary input image") private transient MTBImage inImg
@Parameter(label="Max. Distance of Componens", required=false, direction=IN, dataIOOrder=-6, description="Maximum allowed distance of components to be linked.") private int maxCompDist
@Parameter(label="Max. Component Size", required=false, direction=IN, dataIOOrder=-8, description="Maximal component size, larger ones are deleted.") private int maxCompSize
@Parameter(label="Max. Voronoi Expansion Distance", required=false, direction=IN, dataIOOrder=-4, description="Distance to which components are expanded in Voronoi expansion mode.") private int maxVoronoiExpDist
@Parameter(label="Min. Component Size", required=false, direction=IN, dataIOOrder=-8, description="Minimal component size, smaller ones are deleted.") private int minCompSize
@Parameter(label="Process Mode", required=true, direction=IN, description="Process Modus", dataIOOrder=-8) private ComponentPostprocess.ProcessMode processMode
@Parameter(label="Result Image", required=true, direction=OUT, description="Result image") private transient MTBImageByte resultImg
@Parameter(label="Roundness Threshold", required=false, direction=IN, dataIOOrder=-2, description="Threshold for removing round components, larger values enforce greater eccentricity of surviving components.") private double roundnessThreshold
private int width
Constructor Detail |
---|
public ComponentPostprocess() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ComponentPostprocess(MTBImage img, ComponentPostprocess.ProcessMode pm) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Note that parameters for the chosen processing mode have to be set explicitly. Parameters for other modes are ignored.
img
- Image to work on.pm
- Process mode of operator.
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
@Deprecated public ComponentPostprocess(MTBImage img, ComponentPostprocess.ProcessMode pm, int _minCompSize, int _maxCompDist, int maxVoroExpandDist) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- Image to work on.pm
- Process mode of operator._minCompSize
- Minimal region size for eliminating small comps._maxCompDist
- Maximal region distance in linking.maxVoroExpandDist
- Max. distance of pixel considered in Voronoi expansion.
Note: Depending on the process mode each time only one of the
parameters is actually in use.
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
@Deprecated public ComponentPostprocess(MTBImage img, ComponentPostprocess.ProcessMode pm, int _minCompSize, int _maxCompDist, int maxVoroExpandDist, double _roundnessThreshold) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
inImg
- Image to work on.pm
- Process mode of operator.minCompSize
- Minimal region size for eliminating small comps.maxCompDist
- Maximal region distance in linking.maxVoronoiExpandDist
- Max. distance of pixel considered in Voronoi expansion.roundnessThreshold
- Threshold for round objects in range [0,1]. A sustained region has
eccentricity 1, a round region has eccentricity 0.
Note: Depending on the process mode each time only one of the
parameters is actually in use.
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail |
---|
protected MTBImageByte EraseLargeComponents(MTBImageByte binIP, int maxComponentSize) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Large components are components that have a size above the given threshold.
binIP
- binary input imagemaxComponentSize
- maximum size of valid components
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
protected MTBImageByte EraseRoundComponents(MTBImageByte binImage, double threshold) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
binImage
- Input image.threshold
- Eccentricity threshold.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
protected MTBImageByte EraseSmallComponents(MTBImageByte binIP, int minComponentSize) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Small components are components that have a size below the given threshold. Suitable for noise reduction in binary images.
binIP
- binary input imageminComponentSize
- minimum size of valid components
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
public boolean getDiagonalNeighbors()
public MTBImage getInputImage()
public int getMaximalComponentDist()
public int getMaximalComponentSize()
public int getMaxVoronoiExpandDist()
public int getMinimalComponentSize()
public ComponentPostprocess.ProcessMode getProcessMode()
public MTBImageByte getResultImage()
public double getRoundnessThreshold()
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected MTBImageByte LinkAdjacentComponents(MTBImageByte binIP) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
This function processes a binary image with foreground objects being white. Based on an initial component labeling step and subsequent skeletonization of resulting components, adjacent components are linked by a line of width one pixel in the result image.
The criterion for two components to be adjacent is defined based on the distance of pairs of skeleton endpoints of both components. If there exists at least one pair of endpoints between two components with a distance below the given threshold, the components are linked. If there is more than one pair of such points, the pair with the smallest distance is selected to be linked to each other.
binImage
- input binary image with regions
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
protected MTBImageByte LinkAdjacentPixels(MTBImageByte binIP, int maxDist) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
This function processes a binary image containing only isolated pixels in the foreground. The foreground color is white. Based on the given maximal distance adjacent pixels are linked together to components. The result is comparable to a single-linkage clustering. As result an image is returned where adjacent pixels are linked to each other by a line of width one.
Note that the behaviour of the function is undefined if there are foreground objects present in the image other than single pixels!
binImage
- input binary image with regions
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
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
public void setDiagonalNeighbors(boolean value)
public void setMaximalComponentDistance(int _maxCompDist)
Only used in modes 'LINK_ADJ_COMPS' and 'LINK_ADJ_PIXELS'.
public void setMaximalComponentSize(int _maxCompSize)
Only used in mode 'ERASE_LARGE_COMPS'.
public void setMaximalVoronoiExpansionDistance(int _maxVoroExpandDist)
Only used in mode 'VORONOI_EXPAND'.
public void setMinimalComponentSize(int _minCompSize)
Only used in mode 'ERASE_SMALL_COMPS'.
public void setRoundnessThreshold(double _roundnessThreshold)
Only used in mode 'ERASE_ROUND_COMPS'.
protected MTBImageByte VoronoiExpandComponents(MTBImageByte binImg, int maxDist) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
binImg
- Input image.maxDist
- Size of dilation mask.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |