@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, allowBatchMode=false, shortDescription="Analyzes skeletons of a given set of regions.") public class Region2DSkeletonAnalyzer extends MTBOperator
The operator takes as input a label image, calculates the skeleton for each region and finally calculates several measures on the skeletons, e.g., the number of branches, their average lengths, or the average distances of the branch endpoints to the background. The skeleton is calculated using ImageJ functions. Inside the skeleton 8-neighborhood between pixels is given.
Note that the number of branches is determined by the number of
endpoints to be found in the skeleton. An endpoint is a skeleton
point having no or only a single neighboring pixel in the skeleton,
or a point with two neighbors in direct vicinity. The latter case
can only appear if within the skeleton 4-neighborhood is assumed.
If we find more than two endpoints the count is equal to the number
of branches, and if we find only two endpoints or even only one,
we only have a single branch in the skeleton.
The distance of an endpoint to the background can be interpreted as a rough estimation of the curvature of the contour surrounding the endpoint. The curvature can be defined as the radius of a maximal circle located at the branch endpoint, and the distance to the background is approximately equal to the radius of this circle.
Modifier and Type | Class and Description |
---|---|
static class |
Region2DSkeletonAnalyzer.FeatureNames
Set of region features calculated from region skeletons.
|
Modifier and Type | Field and Description |
---|---|
private MTBImageRGB |
analysisDisplayImg
Image illustrating analysis results.
|
private static int |
blue
Definition of blue color.
|
private static int |
green
Definition of green color.
|
private int |
height
Height of input label image.
|
private MTBImage |
inImg
Label image to process.
|
private static String |
operatorID
Operator class identifier.
|
private double |
pixelLength
Length of a pixel.
|
private static int |
red
Definition of red color.
|
private MTBTableModel |
resultFeatureTable
Table with region skeleton features.
|
private boolean |
visualizeAnalysisResults
Enable/disable the creation of an image to visualize results.
|
private int |
width
Width of input label image.
|
private MTBImage |
workImage
Internal image to work on.
|
private static int |
yellow
Definition of yellow color.
|
Constructor and Description |
---|
Region2DSkeletonAnalyzer()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private double |
calcBranchLength(Vector<Point2D.Double> points)
Calculates the lenght of the given branch.
|
MTBImageRGB |
getAnalysisImage()
Get image with visualized analysis results.
|
String |
getDocumentation() |
MTBImageRGB |
getInfoImage()
Get the info image with analysis data visualized.
|
MTBTableModel |
getResultTable()
Get table of calculated features.
|
private static int |
numberOfNeighbors(MTBImage img,
int x,
int y)
Counts the number of neighboring skeleton pixels.
|
protected void |
operate() |
void |
setInputLabelImage(MTBImage img)
Set input label image to process.
|
void |
setPixelLength(double pl)
Set length of a pixel.
|
void |
setVisualizeAnalysisResults(boolean flag)
Enable/disable creation of image with analysis data.
|
private double |
traceBranch(MTBImage img,
int x,
int y,
MTBImage nonBranchPixelImg)
Traces a skeleton branch and extracts its length.
|
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
private static final String operatorID
private static final int red
private static final int yellow
private static final int green
private static final int blue
@Parameter(label="Input Label Image", required=true, direction=IN, description="Input image.", dataIOOrder=0) private transient MTBImage inImg
It is assumed that each region is marked by a unique label larger than zero. The background should have zero values.
@Parameter(label="Pixel length", required=false, direction=IN, description="Pixel length.", dataIOOrder=0) private double pixelLength
Note that we assume that a pixel is square, i.e. has an aspect ratio of 1. If this is not the case, extracted values are not correct.
@Parameter(label="Result Table of Skeleton Features", dataIOOrder=0, direction=OUT, description="Result table of skeleton features.") private transient MTBTableModel resultFeatureTable
Each row contains one region, each column corresponds to a feature. The region IDs are identical to the labels in the input image.
The first two columns of the table corresponding to the region ID
and the branch count contain values of type Integer
,
the last two columns contain values of type Double
.
@Parameter(label="Visualize analysis results?", dataIOOrder=0, direction=IN, supplemental=true, description="If selected an image showing analysis results is created.") private boolean visualizeAnalysisResults
@Parameter(label="Image showing analysis results", dataIOOrder=1, direction=OUT, description="Image illustrating the results of the analysis.") private transient MTBImageRGB analysisDisplayImg
private transient int width
private transient int height
private MTBImage workImage
public Region2DSkeletonAnalyzer() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown on construction failure.public void setInputLabelImage(MTBImage img)
img
- Input label image.public void setPixelLength(double pl)
pl
- Length of a pixel.public void setVisualizeAnalysisResults(boolean flag)
flag
- If true, creation of image is enabled.public MTBTableModel getResultTable()
public MTBImageRGB getInfoImage()
Note, the image is only available if
visualizeAnalysisResults
was set to true before.
public MTBImageRGB getAnalysisImage()
This image is only available if the parameter
visualizeAnalysisResults
has been selected prior to
running the operator.
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 static int numberOfNeighbors(MTBImage img, int x, int y)
The 8-neighborhood is considered here.
img
- Skeleton image.x
- x-coordinate of pixel to examine.y
- y-coordinate of pixel to examine.private double traceBranch(MTBImage img, int x, int y, MTBImage nonBranchPixelImg)
The tracing starts at the given position and ends at the next branch point, i.e., the next pixel having more than one neighbor.
img
- Skeleton image.x
- x-coordinate where to start.y
- y-coordinate where to start.nonBranchPixelImg
- Image where to erase branch pixels (optional).private double calcBranchLength(Vector<Point2D.Double> points)
The length is calculated by tracing the point list and summing up the distances between consecutive pixels.
points
- Branch in terms of an ordered list of branch points.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.