de.unihalle.informatik.MiToBo.apps.scratchAssay
Class ScratchAssaySegmenter
java.lang.Object
de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.MiToBo.core.operator.MTBOperator
de.unihalle.informatik.MiToBo.apps.scratchAssay.ScratchAssaySegmenter
- All Implemented Interfaces:
- de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator
@ALDAOperator(genericExecutionMode=SWING,
level=STANDARD)
public class ScratchAssaySegmenter
- extends MTBOperator
class for segmenting the wound area of a scratch assay image
First the image is smoothed.
Subsequently, the shannon entropy for every pixel is calculated.
Then a 2-phase topology preserving levelset segmentation is performed on the
entropy image to separate the cells from the scratch area.
Finally, the resulting scratch area is measured.
- Author:
- glass
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
completeDAG, name, portHashAccess, verbose, versionProvider |
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 |
closingMaskSize
private java.lang.Integer closingMaskSize
entropyFilterSize
@Parameter(label="entropy filter size",
required=true,
direction=IN,
supplemental=false,
description="size of entropy filter mask",
mode=STANDARD,
dataIOOrder=3)
private java.lang.Integer entropyFilterSize
entropyImg
@Parameter(label="entropy image",
required=false,
direction=OUT,
supplemental=true,
description="entropy image")
private transient MTBImage entropyImg
inImg
@Parameter(label="input image",
required=true,
direction=IN,
supplemental=false,
description="input image",
mode=STANDARD,
dataIOOrder=0)
private transient MTBImage inImg
isHorizontal
@Parameter(label="horizontal scratch",
required=true,
direction=IN,
supplemental=false,
description="horizontally or vertically oriented scratch",
mode=STANDARD,
dataIOOrder=1)
private java.lang.Boolean isHorizontal
maxIter
@Parameter(label="maximum iterations",
required=false,
direction=IN,
supplemental=false,
description="maximum number of iterations of level set segmentation",
mode=ADVANCED,
dataIOOrder=0)
private java.lang.Integer maxIter
modelFile
private java.lang.String modelFile
noCheck
@Parameter(label="don\'t check for scratch presence",
required=false,
direction=IN,
supplemental=false,
description="don\'t check for scratch presence prior to segmentation",
mode=STANDARD,
dataIOOrder=1)
private java.lang.Boolean noCheck
numIterations
@Parameter(label="number of iterations",
required=false,
direction=OUT,
supplemental=true,
description="number of iterations required for the segmentation")
private java.lang.Integer numIterations
resultImg
@Parameter(label="result image",
required=true,
direction=OUT,
supplemental=false,
description="resulting segmented image")
private transient MTBImage resultImg
runtime
@Parameter(label="runtime",
required=false,
direction=OUT,
supplemental=true,
description="time required to perform the segmentation")
private java.lang.Long runtime
scratchArea
@Parameter(label="scratch area",
required=true,
direction=OUT,
supplemental=false,
description="detected scratch area")
private java.lang.Double scratchArea
scratchFeatures
private double[] scratchFeatures
sigma
@Parameter(label="\u03c3",
required=true,
direction=IN,
supplemental=false,
description="standard deviation of gauss filter",
mode=STANDARD,
dataIOOrder=2)
private java.lang.Integer sigma
sizeX
private int sizeX
sizeY
private int sizeY
svmFile
@Parameter(label="external svm file",
required=false,
direction=IN,
supplemental=false,
description="absolute path to external svm model file",
mode=ADVANCED,
dataIOOrder=3)
private de.unihalle.informatik.Alida.datatypes.ALDFileString svmFile
useExternalSVM
@Parameter(label="use external svm file",
required=false,
direction=IN,
supplemental=false,
description="should an external svm file be used for classification",
mode=ADVANCED,
dataIOOrder=2)
private java.lang.Boolean useExternalSVM
ScratchAssaySegmenter
public ScratchAssaySegmenter()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
ScratchAssaySegmenter
public ScratchAssaySegmenter(MTBImage inImg,
int sigma,
int entropyFilterSize,
boolean isHorizontal,
boolean noCheck,
int maxIter)
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Parameters:
inImg
- input imagesigma
- variance of gauss filterentropyFilterSize
- size of mask for entropy filteringisHorizontal
- is scratch horizontally oriented (assumed to be vertically oriented else)noCheck
- don't check for scratch presence prior to segmentationmaxIter
- maximum number of iterations
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
classify
private double classify(MTBImage entropyImg,
MTBImage scratchMask,
java.lang.String modelFile)
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException,
java.io.IOException
- decide, whether the given entropy image contains an open scratch or not
- Parameters:
entropyImg
- scratchMask
- modelFile
-
- Returns:
- 1, if a scratch is present; -1, if not
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
java.io.IOException
createInitBar
private MTBImage createInitBar(boolean horizontal)
- create rectangular shaped bar as initialization for the scratch
- Parameters:
horizontal
- should the craeted bar be horizontally oriented
- Returns:
- Image containing a rectangular bar in the middle of the image
getBhattacharyyaCoefficient
private double getBhattacharyyaCoefficient(MTBImage entropyImg,
MTBImage scratchMask)
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Parameters:
entropyImg
- scratchMask
-
- Returns:
- Bhattacharyya coefficient of histograms for segmented scratch area and the rest of the image (cell area)
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
getEntropyImage
public MTBImage getEntropyImage()
- Returns:
- entropy filter image
getEntropyMeanDifference
private double getEntropyMeanDifference(MTBImage entropyImg,
MTBImage scratchMask)
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Parameters:
entropyImg
- scratchMask
-
- Returns:
- the difference between the mean entropies of the segmented scratch and cell areas
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
getKolmogorovSmirnovStatistic
private double getKolmogorovSmirnovStatistic(MTBImage entropyImg,
MTBImage scratchMask)
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Parameters:
entropyImg
- scratchMask
-
- Returns:
- Kolmogorov-Smirnov statistic of histograms for segmented scratch area and the rest of the image (cell area)
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
getNumIterations
public java.lang.Integer getNumIterations()
- Returns:
- the number of iterations required for the level set segmentation
getResultImage
public MTBImage getResultImage()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Returns:
- the resulting image
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
getRuntime
public java.lang.Long getRuntime()
- Returns:
- time in sec required for the segmentation
getScratchArea
public java.lang.Double getScratchArea()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Returns:
- the measured scratch area
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
getScratchFeatures
public double[] getScratchFeatures()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
measure
private double measure()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- measures the scratch area, i.e. number of pixels that don't have value 0
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
protected void operate()
throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Specified by:
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
- Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
setSVMFile
public void setSVMFile(java.lang.String path)