@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION, allowBatchMode=false) public class MorphologyAnalyzer2D extends MTBOperator
Note that the operator assumes squared pixels. If the pixels are not squared several feature values will not be calculated correctly.
Modifier and Type | Class and Description |
---|---|
static class |
MorphologyAnalyzer2D.FeatureNames
Set of region features calculated from segmented cell regions.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
analyzeProtrusionsIndentations
Flag to turn on/off analysis of protrusions and indentations.
|
private Vector<Double> |
areas |
private Vector<Double> |
avgApicalIndentationLengths |
private Vector<Double> |
avgApicalProtrusionLengths |
private Vector<Double> |
avgBasalIndentationLengths |
private Vector<Double> |
avgBasalProtrusionLengths |
private Vector<Double> |
avgBaselineIndentationLengths |
private Vector<Double> |
avgBaselineProtrusionLengths |
private Vector<Double> |
avgBranchLengths |
private Vector<Double> |
avgConcavities |
private Vector<Double> |
avgEndpointDistances |
private Vector<Double> |
avgEquatorIndentationLengths |
private Vector<Double> |
avgEquatorProtrusionLengths |
private Vector<Double> |
avgIndentationLengths |
private Vector<Double> |
avgLobeDepths |
private Vector<Double> |
avgNeckDepths |
private Vector<Double> |
avgProtrusionLengths |
private int |
bgLabel |
private Vector<Double> |
branchCounts |
private boolean |
calcArea |
private boolean |
calcCircularity |
private boolean |
calcConcavityData
Flag to turn on/off analysis of concavities.
|
private boolean |
calcConvexHullMeasures
Flag to turn on/off analysis of convex hull.
|
private boolean |
calcEccentricity |
private boolean |
calcLengthWidth |
private boolean |
calcMarginRoughness
Flag to turn on/off calculation of margin roughness.
|
private boolean |
calcPerimeter |
private boolean |
calcSkeletonBranchFeatures
Flag to turn on/off calculation of skeleton branch features.
|
private boolean |
calcSolidity
Flag to turn on/off calculation of solidity.
|
private Vector<Double> |
circularities |
private int |
concavityMaskSize
Masksize for concavity calculations.
|
private Vector<Double> |
convexHullAreas |
private Vector<Double> |
convexHullConvexities |
private Vector<Double> |
convexHullPerimeters |
private Vector<Double> |
convexHullRoundnessValues |
private boolean |
createCurvatureInfoImage
Flag to enable drawing curvature information to info image.
|
private boolean |
createSkeletonInfoImage
Flag to enable drawing skeleton information to info image.
|
private MTBImageRGB |
curvatureInfoImg
Info image for curvature analysis.
|
private Double |
deltaXY |
private Vector<Double> |
eccentricities |
private Integer |
fracDigits |
private double |
gaussianSigma
Standard deviation of Gaussian kernel in curvature smoothing.
|
private int |
height
Height of currently processed image.
|
private MTBImage |
inLabelImg |
private Vector<MorphologyAnalyzer2DInProData> |
inProDetails
Vector with detailed result data on indentations and protrusions.
|
private MTBRegion2DSet |
inRegions |
private MTBImage |
labelImg |
private Vector<Integer> |
labels |
private Vector<Double> |
lengths |
private Vector<Double> |
longestPathLengths |
private Vector<Double> |
marginRoughnessValues |
private Vector<Double> |
maxCoreRegionWidths |
private Vector<Double> |
minCoreRegionWidths |
private double |
minimalCurvature
Threshold for minimal curvature.
|
private int |
minIndentationLength
Minimal number of pixels a valid indentation requires.
|
private int |
minProtrusionLength
Minimal number of pixels a valid protrusion requires.
|
private NumberFormat |
nf |
private Vector<Double> |
nonProtrusionAreas |
private static String |
operatorID
Identifier string for this operator class.
|
private Vector<Double> |
perimeters |
private Vector<Integer> |
protrusionCounts |
private Vector<Double> |
radiiMaxInscribedEmptyCircles |
private MTBRegion2DSet |
regions |
private MTBImageRGB |
skeletonInfoImg
Info image for skeleton analysis.
|
private Vector<Double> |
solidities |
private Vector<Double> |
stdDevConcavities |
private MTBTableModel |
table |
private String |
unitXY |
private int |
width
Width of currently processed image.
|
private Vector<Double> |
widths |
Constructor and Description |
---|
MorphologyAnalyzer2D() |
MorphologyAnalyzer2D(MTBImage labelImg)
constructor
|
MorphologyAnalyzer2D(MTBRegion2DSet rs) |
Modifier and Type | Method and Description |
---|---|
private void |
analyzeLocalCurvatures()
Calculates and analyses pixel-wise local curvatures.
|
boolean |
calcArea() |
boolean |
calcCircularity() |
boolean |
calcEccentricity() |
boolean |
calcLengthWidth() |
boolean |
calcPerimeter() |
private void |
calculateConcavityData()
Extracts average concavity and standard deviation of concavities.
|
private void |
calculateConvexHullMeasures()
Calculates convex hull convexities and roundnesses.
|
private void |
calculateConvexHulls()
Calculates convex hull areas and perimeters.
|
private void |
calculateSolidityValues()
Calculates solidity values.
|
private void |
callbackArea()
Callback function called in case of changes of parameter
calcArea . |
private void |
callbackConcavity()
Callback function called in case of changes of parameter
calcConcavityData . |
private void |
callbackCurvature()
Callback function called in case of changes of parameters
analyzeProtrusionsIndentations or calcMarginRoughness . |
private void |
callbackSolidity()
Callback function called in case of changes of parameter
calcSolidity . |
private void |
getCalibration() |
MTBImageRGB |
getCurvatureInfoImage()
Access info image about curvature analysis.
|
Double |
getDeltaXY() |
Vector<MorphologyAnalyzer2DInProData> |
getDetailedInProResults()
Access detailed information on indentations and protrusions.
|
MTBImage |
getLabelImage()
Get the label image.
|
private void |
getSimpleShapeFeatures()
calculate several shape features in one method
|
MTBImageRGB |
getSkeletonInfoImage()
Access info image about skeleton analysis.
|
MTBTableModel |
getTable() |
String |
getUnitXY() |
private void |
makeTable()
create result table
|
protected void |
operate() |
void |
setAnalyzeProtrusionsAndIndentations(boolean flag)
Turn on/off analysis of contour protrusions and indentations.
|
void |
setCalcArea(boolean calcArea) |
void |
setCalcCircularity(boolean flag)
Turn of/off calculation of circularity.
|
void |
setCalcConcavityData(boolean flag)
Turn on/off calculation of concavity information.
|
void |
setCalcConvexHullMeasures(boolean flag)
Turn on/off calculation of convex hull measures.
|
void |
setCalcEccentricity(boolean flag)
Turn of/off calculation of eccentricity.
|
void |
setCalcLengthWidth(boolean flag)
Turn of/off calculation of region length and width.
|
void |
setCalcMarginRoughness(boolean flag)
Turn on/off calculation of margin roughness values.
|
void |
setCalcPerimeter(boolean calcPerimeter) |
void |
setCalcSkeletonBranchFeatures(boolean flag)
Turn on/off calculation of skeleton branch features.
|
void |
setCalcSolidity(boolean flag)
Turn on/off calculation of solidities.
|
void |
setConcavityMaskSize(int m)
Specify size of local mask for concavity calculations.
|
void |
setDeltaXY(Double dXY) |
void |
setDrawCurvatureInfoImage(boolean flag)
Enable/disable display of curvature info image.
|
void |
setDrawSkeletonInfoImage(boolean flag)
Enable/disable display of skeleton info image.
|
void |
setFractionalDigits(int digits)
specify the number of fractional digits for the results table
|
void |
setGaussianSigmaCurvatureSmoothing(double s)
Set Gaussian standard deviation for smoothing curvature values.
|
void |
setLabelImage(MTBImage img)
Set input label image.
|
void |
setMinimalCurvatureThreshold(double c)
Set minimal curvature threshold.
|
void |
setMinimalLobeLength(int m)
Set minimal pixel count a lobe requires.
|
void |
setRegionSet(MTBRegion2DSet regs)
Set regions.
|
void |
setUnitXY(String unitXY) |
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 static final String operatorID
@Parameter(label="Label image", required=false, direction=IN, supplemental=false, description="label image", dataIOOrder=0, callback="getCalibration", paramModificationMode=MODIFIES_INTERFACE) private transient MTBImage inLabelImg
@Parameter(label="Regions", required=false, direction=IN, supplemental=false, description="input regions", dataIOOrder=1) private MTBRegion2DSet inRegions
@Parameter(label="Pixel length", required=false, direction=IN, supplemental=false, description="Pixel length, note that we assume square pixels!", dataIOOrder=2) private Double deltaXY
@Parameter(label="Unit in x/y", required=false, direction=IN, supplemental=false, description="unit x/y", dataIOOrder=4) private String unitXY
@Parameter(label="Calculate area", required=false, direction=IN, supplemental=false, description="should object\'s areas be calculated", dataIOOrder=5, callback="callbackArea", paramModificationMode=MODIFIES_INTERFACE) private boolean calcArea
@Parameter(label="Calculate perimeter", required=false, direction=IN, supplemental=false, description="should object\'s perimeters be calculated", dataIOOrder=6) private boolean calcPerimeter
@Parameter(label="Calculate length and width", required=false, direction=IN, supplemental=false, description="should object\'s length and width (fitting ellipse\'s major/minor axes length) be calculated", dataIOOrder=7) private boolean calcLengthWidth
@Parameter(label="Calculate circularity", required=false, direction=IN, supplemental=false, description="should object\'s circularities be calculated", dataIOOrder=8) private boolean calcCircularity
@Parameter(label="Calculate eccentricity", required=false, direction=IN, supplemental=false, description="should object\'s eccentricities be calculated", dataIOOrder=9) private boolean calcEccentricity
@Parameter(label="Calculate solidity", required=false, direction=IN, supplemental=false, description="Should object\'s solidity be calculated?", dataIOOrder=10, callback="callbackSolidity", paramModificationMode=MODIFIES_INTERFACE) private boolean calcSolidity
@Parameter(label="Calculate margin roughness", required=false, direction=IN, supplemental=false, description="If true margin roughness is calculated.", dataIOOrder=11, callback="callbackCurvature", paramModificationMode=MODIFIES_INTERFACE) private boolean calcMarginRoughness
@Parameter(label="Analyze protrusions and indentations", required=false, direction=IN, supplemental=false, description="If true protrusions/indentations are analyzed.", dataIOOrder=12, callback="callbackCurvature", paramModificationMode=MODIFIES_INTERFACE) private boolean analyzeProtrusionsIndentations
@Parameter(label=" - Minimal curvature", required=false, direction=IN, supplemental=false, dataIOOrder=13, description="Curvature below this value are handled as noise.") private double minimalCurvature
@Parameter(label=" - Gaussian \u03c3 in curvature analysis", required=false, direction=IN, supplemental=false, dataIOOrder=14, description="If true margin roughness is calculated.") private double gaussianSigma
@Parameter(label=" - Minimal length of a protrusion section", required=false, direction=IN, supplemental=false, dataIOOrder=15, description="Minimal pixel number a protrusion requires to be valid.") private int minProtrusionLength
@Parameter(label=" - Minimal length of an indentation section", required=false, direction=IN, supplemental=false, dataIOOrder=16, description="Minimal pixel number an indentation requires to be valid.") private int minIndentationLength
Note that too short protrusions are removed first, and indentations are only checked afterwards.
@Parameter(label="Calculate skeleton branch features", required=false, dataIOOrder=17, direction=IN, supplemental=false, description="If true skeleton branches are analyzed.") private boolean calcSkeletonBranchFeatures
@Parameter(label="Calculate concavity information", required=false, direction=IN, supplemental=false, dataIOOrder=18, description="If true average concavity and standard deviation are calculated.", callback="callbackConcavity", paramModificationMode=MODIFIES_INTERFACE) private boolean calcConcavityData
@Parameter(label=" - Concavity Masksize", required=false, direction=IN, supplemental=false, dataIOOrder=19, description="Size of local mask in concavity calculations.") private int concavityMaskSize
Refer to operator Contour2DConcavityCalculator
for details.
@Parameter(label="Calculate convex hull measures", required=false, direction=IN, supplemental=false, dataIOOrder=20, description="If true some measures of the convex hull are calculated.") private boolean calcConvexHullMeasures
@Parameter(label="Fractional digits", required=false, direction=IN, supplemental=false, description="fractional digits", dataIOOrder=21, mode=ADVANCED) private Integer fracDigits
@Parameter(label="Show curvature analysis info image?", required=false, direction=IN, supplemental=true, dataIOOrder=0, description="If selected info image with curvature data is shown.") private boolean createCurvatureInfoImage
@Parameter(label="Curvature data image", required=false, direction=OUT, supplemental=true, dataIOOrder=10, description="Curvature data image.") private transient MTBImageRGB curvatureInfoImg
@Parameter(label="Show skeleton analysis info image?", required=false, direction=IN, supplemental=true, dataIOOrder=0, description="If selected info image with skeleton data is shown.") private boolean createSkeletonInfoImage
@Parameter(label="Skeleton data image", required=false, direction=OUT, supplemental=true, dataIOOrder=10, description="Skeleton data image.") private transient MTBImageRGB skeletonInfoImg
@Parameter(label="results table", required=true, direction=OUT, supplemental=false, description="results table", dataIOOrder=0) private MTBTableModel table
private NumberFormat nf
private int bgLabel
private Vector<MorphologyAnalyzer2DInProData> inProDetails
private MTBRegion2DSet regions
private MTBImage labelImg
private int width
private int height
public MorphologyAnalyzer2D() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public MorphologyAnalyzer2D(MTBImage labelImg) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
labelImg
- input label imagede.unihalle.informatik.Alida.exceptions.ALDOperatorException
public MorphologyAnalyzer2D(MTBRegion2DSet rs) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
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
private void getSimpleShapeFeatures() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
private void makeTable()
public void setLabelImage(MTBImage img)
img
- Label image to process.public MTBImage getLabelImage()
If a label image is provided this method returns the input image, otherwise the internally generated label image is returned.
public void setRegionSet(MTBRegion2DSet regs)
regs
- Set of regions to process.public Double getDeltaXY()
public void setDeltaXY(Double dXY)
dXY
- physical pixel length in x-directionpublic String getUnitXY()
public void setUnitXY(String unitXY)
unitXY
- tphysical space unitpublic boolean calcArea()
public void setCalcArea(boolean calcArea)
calcAreas
- should areas be calculatedpublic boolean calcPerimeter()
public void setCalcPerimeter(boolean calcPerimeter)
calcPerimeters
- should perimeters be calculatedpublic boolean calcLengthWidth()
public void setCalcLengthWidth(boolean flag)
The region length and width are defined as the lengths of the major and minor axes of the ellipse best fitting.
The method is based on using moments of the region:
flag
- If true lengths of minor and major axis are calculated.MTBRegion2D
public boolean calcCircularity()
public void setCalcCircularity(boolean flag)
The circularity is calculated according to the following equation:
flag
- If true, circularity is calculated.MTBRegion2D
public boolean calcEccentricity()
public void setCalcEccentricity(boolean flag)
The eccentricity is calculated according to the following equation:
flag
- If true eccentricities are calculated.MTBRegion2D
public void setCalcSolidity(boolean flag)
The solidity is calculated according to the following equation:
flag
- If true, solidities are calculated.public void setCalcMarginRoughness(boolean flag)
flag
- If true, margin roughness values are calculated.public void setAnalyzeProtrusionsAndIndentations(boolean flag)
The analysis of protrusions and indentations subsumes the overall count of protrusions, their average lengths and some more measures.
flag
- If true, protrusion/indentation measures are extracted.public void setMinimalCurvatureThreshold(double c)
c
- Minimal curvature.public void setGaussianSigmaCurvatureSmoothing(double s)
The smoothing affects the calculation of margin roughness and the analysis of lobes and necks.
s
- Gaussian standard deviation to apply.public void setMinimalLobeLength(int m)
Lobes with fewer pixels will be eliminated.
m
- Minimal pixel count to apply.public void setCalcSkeletonBranchFeatures(boolean flag)
The skeleton branch features subsume the total number of skeleton branches, their average length as well as the average radius of the lobes (approximated as the distance of branch endpoints from the background).
flag
- If true, skeleton branch features are extracted.public void setCalcConcavityData(boolean flag)
The method calculates the average concavity of all pixels on the
region boundary as well as the standard deviation of concavities.
For more information on the estimation of local contour concavity
refer to the operator Contour2DConcavityCalculator
.
flag
- If true, concavity data is calculated.public void setConcavityMaskSize(int m)
Refer to operator Contour2DConcavityCalculator
for details.
m
- Size of mask to apply.public void setCalcConvexHullMeasures(boolean flag)
flag
- If true, convex hull measures are calculated.public void setFractionalDigits(int digits)
digits
- public void setDrawCurvatureInfoImage(boolean flag)
flag
- If true image is drawn and shown, otherwise not.public void setDrawSkeletonInfoImage(boolean flag)
flag
- If true image is drawn and shown, otherwise not.public MTBTableModel getTable()
public Vector<MorphologyAnalyzer2DInProData> getDetailedInProResults()
These data is only available if analyzeProtrusionsIndentations
has been set to true.
public MTBImageRGB getCurvatureInfoImage()
public MTBImageRGB getSkeletonInfoImage()
private void analyzeLocalCurvatures() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
The method extracts the following features:
In addition to the baseline also the equator of protrusions and indentations is extracted by drawing a line between the two inflection points defining the protrusion or indentation, respectively. The total length of a protrusion or indentation, and the apical and basal lengths are calculated by calculating the largest distance of any point of the baseline to the region contour. Then the intersection point of this distance line with the equator is found which splits the distance line. The length of the upper part of this line is denoted the apical length of the protrusion/indentation and the length of the lower part is denoted the basal length of the protrusion/indentation.
Contour2DCurvatureCalculator
for details.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of problems with the processing history.private void calculateConcavityData() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
For details about concavity calculation refer to
Contour2DConcavityCalculator
.
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of problems with processing history.private void calculateConvexHulls() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of problems with processing history.private void calculateSolidityValues()
private void calculateConvexHullMeasures()
private void getCalibration()
private void callbackCurvature()
analyzeProtrusionsIndentations
or calcMarginRoughness
.private void callbackArea()
calcArea
.private void callbackSolidity()
calcSolidity
.private void callbackConcavity()
calcConcavityData
.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.