@ALDAOperator(genericExecutionMode=ALL, level=STANDARD, allowBatchMode=false, shortDescription="Calculates set of Haralick co-occurrence texture features from an image.") @ALDDerivedClass public class FeatureCalculatorHaralickMeasures extends FeatureCalculator
The operator expects that the input image does not contain more than 256 different gray-values, color images are completely rejected. For saving memory the operator first checks the maximal gray-value in the image and updates the size of the gray-level co-occurence matrices accordingly. Subsequently, the following measures are calculated:
Modifier and Type | Class and Description |
---|---|
static class |
FeatureCalculatorHaralickMeasures.HaralickDirection
Directions available for matrix calculations.
|
Modifier and Type | Field and Description |
---|---|
private Vector<FeatureCalculatorHaralickMeasures.HaralickDirection> |
directions
Directions.
|
private int |
distance
Distance.
|
private boolean |
isotropicCalcs
Flag for isotropic calculations.
|
private boolean |
thrinkMatrix
Flag for thrinking matrix if possible.
|
inImg, resultObj
Constructor and Description |
---|
FeatureCalculatorHaralickMeasures()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected double[] |
calcFeatures(double[][] matrix)
Extracts Haralick features from given matrix.
|
protected double[][] |
calcMatrix(FeatureCalculatorHaralickMeasures.HaralickDirection dir)
Extracts the co-occurence matrix for the given distance and direction.
|
void |
doIsotropicCalcutations(boolean flag)
Set flag for isotropic calculations.
|
String |
getDocumentation() |
protected FeatureCalculatorHaralickMeasuresResult |
getResultDataObjectInvalid(int dim)
Helper method to allow for requesting invalid dummy results.
|
void |
operate() |
void |
setDirections(Vector<FeatureCalculatorHaralickMeasures.HaralickDirection> dirs)
Directions to be analyzed.
|
void |
setDistance(int dist)
Specify distance to be used in calculations.
|
void |
setFlagThrinkMatrix(boolean b)
Flag for thrinking matrix if possible.
|
void |
validateCustom() |
getResultData, setInputImage
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, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="Directions", required=true, direction=IN, dataIOOrder=0, mode=STANDARD, description="Desired directions.") private Vector<FeatureCalculatorHaralickMeasures.HaralickDirection> directions
Note that no checks are done if directions appear several times.
@Parameter(label="Isotropic calculations", required=true, direction=IN, dataIOOrder=1, mode=STANDARD, description="Flag to enable isotropic calculations.") private boolean isotropicCalcs
If flag is true the average of all given directions is calculated.
@Parameter(label="Distance", required=true, direction=IN, dataIOOrder=2, mode=STANDARD, description="Desired distance.") private int distance
@Parameter(label="Reduce matrix size", required=true, direction=IN, dataIOOrder=4, mode=STANDARD, description="Thrinks the matrix if not the whole range of gray-values is actually used.") private boolean thrinkMatrix
public FeatureCalculatorHaralickMeasures() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.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
public void operate()
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
protected double[][] calcMatrix(FeatureCalculatorHaralickMeasures.HaralickDirection dir)
dir
- Haralick direction to consider.protected double[] calcFeatures(double[][] matrix)
Order of the features in the result vector is as follows: 0 = homogenity (also known as energy) 1 = contrast (|i-j|² * p(i,j)) 2 = local homogeneity 3 = entropy 4 = correlation 5 = auto-correlation 6 = dissimilarity 7 = cluster shade 8 = cluster prominence 9 = maximum probability
matrix
- Normalized co-occurence matrix.public void doIsotropicCalcutations(boolean flag)
flag
- If true, isotropic calculations are done.public void setDistance(int dist)
dist
- Distance to be used (in pixels).public void setDirections(Vector<FeatureCalculatorHaralickMeasures.HaralickDirection> dirs)
dirs
- Set of directions to consider.FeatureCalculatorHaralickMeasures.HaralickDirection
public void setFlagThrinkMatrix(boolean b)
b
- If true, matrix size is reduced, otherwise it remains 256x256.protected FeatureCalculatorHaralickMeasuresResult getResultDataObjectInvalid(int dim)
FeatureCalculator
getResultDataObjectInvalid
in class FeatureCalculator
dim
- Desired dimension of output object.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.