@ALDAOperator(genericExecutionMode=ALL, level=STANDARD) public class Contour2DCurvatureCalculator extends MTBOperator
The following algorithm's used:
Modifier and Type | Class and Description |
---|---|
static class |
Contour2DCurvatureCalculator.Algorithm |
Modifier and Type | Field and Description |
---|---|
private Contour2DCurvatureCalculator.Algorithm |
algorithm
The algorithm used for estimating the curvature.
|
private Double |
displayColor |
private Double |
displayThres |
private MTBContour2DSet |
inContours
Set of contours to compute curvatures for
|
private MTBImage |
inputImage |
private Integer |
k
Used only for MODIFIED_FREEMAN_DAVIS
|
private static int |
K_MIN
in length of vector k as suggested by H.Freeman and L.S.Davis
|
private Integer |
kLower
Used only for BEUS_TIU
|
private Integer |
kUpper
Used only for BEUS_TIU
|
private MTBImage |
outimg |
private Vector<double[]> |
vectorOfCurvatures
Resulting Curvatures for each Pixel on the given
MTBContour2D . |
Constructor and Description |
---|
Contour2DCurvatureCalculator()
Default empty constructor.
|
Contour2DCurvatureCalculator(MTBContour2DSet inContours) |
Modifier and Type | Method and Description |
---|---|
private static double |
angleDiff360(double angleOne,
double angleTwo)
Compute angle difference of two angles in interval 0 up to 360 degree
|
private static double |
angleDiffPM180(double angleOne,
double angleTwo)
Compute angle difference of two angles in interval -180 up to 180 degree
|
private double[] |
averageDeltas(double[] deltas,
int k)
Return the averaged deltas, i.e.
|
private double[] |
calculateCurvatureBeusTiu(Vector<Point2D.Double> contourPixelVec) |
private double[] |
calculateCurvatureModifiedFreemanDavis(Vector<Point2D.Double> contourVec,
int k)
Calculates the curvatures by a modified version of the Freeman and Davis
curvature estimation algorithm.
|
private double[] |
computeDeltas(double[] thetaAngleArray)
Return the centered angles (named delta).
|
private double[] |
computeThetas(Vector<Point2D.Double> contourPixelVec,
int k)
Calculate the
theta angle for all contour pixels provided. |
Contour2DCurvatureCalculator.Algorithm |
getAlgorithm() |
int |
getK() |
int |
getKLower() |
int |
getKUpper() |
Vector<double[]> |
getResultVectorOfCurvatures()
Get calculated curvatures.
|
protected void |
operate() |
void |
setAlgorithm(Contour2DCurvatureCalculator.Algorithm algorithm) |
void |
setK(int vectorLength) |
void |
setKLower(int lowerBound) |
void |
setKUpper(int upperBound) |
private static double |
toPositiveAngle360(double angle)
Normalize angles (in the range -360 to 360 degree) to the range 0-360 degree.
|
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
private static final int K_MIN
@Parameter(label="Contour set", required=true, dataIOOrder=0, direction=IN, description="Set of input contours") private MTBContour2DSet inContours
private Contour2DCurvatureCalculator.Algorithm algorithm
@Parameter(label="k", required=true, dataIOOrder=4, direction=IN, description="k for freeman davis") private Integer k
private Integer kLower
private Integer kUpper
@Parameter(label="Input Image", required=false, dataIOOrder=7, direction=IN, description="Input image.") private MTBImage inputImage
@Parameter(label="displayThres", required=false, dataIOOrder=8, direction=IN, description="threshold between 0 and 1 to threshold absolute curvature normalized to [-1;1] and display with displayColor; if negative display curvature") private Double displayThres
@Parameter(label="displayColor", required=false, dataIOOrder=8, direction=IN, description="color to display curvatures if displayThres >=0\nOtherwise the curvature is displayed") private Double displayColor
@Parameter(label="Resulting vector of curvatures", direction=OUT, dataIOOrder=0, description="The vector of curvatures for each pixel of each contour") private Vector<double[]> vectorOfCurvatures
MTBContour2D
.
@Parameter(label="Output Image", required=true, dataIOOrder=1, direction=OUT, description="Image including curvatures (if input image is given).") private MTBImage outimg
public Contour2DCurvatureCalculator() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public Contour2DCurvatureCalculator(MTBContour2DSet inContours) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
mtbContour2D
- de.unihalle.informatik.Alida.exceptions.ALDOperatorException
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
private double[] calculateCurvatureModifiedFreemanDavis(Vector<Point2D.Double> contourVec, int k)
contourVec
- The Vector<Point2D.Double>
of all contour
pixels.k
- k (index distance between contour points).CurvatureForPointVO
calculated by a
modified version of the Freeman and Davis algorithm.private double[] calculateCurvatureBeusTiu(Vector<Point2D.Double> contourPixelVec)
private double[] computeDeltas(double[] thetaAngleArray)
A centered angle of pixel i
is the difference of
theta(i+1)
and theta(i-1)
.
thetaAngleArray
- The theta
angles.private double[] averageDeltas(double[] deltas, int k)
E
.
In contrast to the original method we normalize with the number of
angles (deltas) averaged, i.e 1 / k + 1
.
deltas
- k
- private double[] computeThetas(Vector<Point2D.Double> contourPixelVec, int k)
theta
angle for all contour pixels provided.
contourPixelVec
- The Vector
of contour pixels.k
- The number of neighbor pixels involved in the
calculation.public Vector<double[]> getResultVectorOfCurvatures()
public Contour2DCurvatureCalculator.Algorithm getAlgorithm()
public void setAlgorithm(Contour2DCurvatureCalculator.Algorithm algorithm)
algorithm
- public int getKLower()
public void setKLower(int lowerBound)
public int getKUpper()
public void setKUpper(int upperBound)
public int getK()
public void setK(int vectorLength)
private static final double angleDiff360(double angleOne, double angleTwo)
angleOne
- angleTwo
- private static final double angleDiffPM180(double angleOne, double angleTwo)
angleOne
- angleTwo
- private static final double toPositiveAngle360(double angle)
angle
- An angle in the range of [-360,360]Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.