@ALDAOperator(genericExecutionMode=ALL, level=STANDARD) public class ImgThresh extends MTBOperator
threshold
and upper threshold
(upperThreshold
.
All pixels with threshold < intensity <= upperThreshold
are
defined as foreground pixels.
Modifier and Type | Field and Description |
---|---|
private boolean |
actualSliceOnly |
private double |
bgValue |
private MTBImage |
destinationImage |
private double |
fgValue |
private MTBImage |
inputImage |
private MTBImage |
resultImage |
private MTBDoubleData |
threshold |
private MTBDoubleData |
upperThreshold |
Constructor and Description |
---|
ImgThresh() |
ImgThresh(MTBImage img,
double thres)
Constructor for thresholding using 255 as foreground and 0 as background value.
|
ImgThresh(MTBImage img,
double thres,
double fg,
double bg)
Constructor for thresholding using 'fgValue' as foreground and 'bgValue' as background value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getActualSliceOnly()
Get flag for thresholding only the actual slice (true) or the whole image (false)
|
double |
getBGValue()
Get background value
|
MTBImage |
getDestinationImage()
Get value of Input argument DestinationImage.
|
double |
getFGValue()
Get foreground value
|
MTBImage |
getInputImage()
Get input image
|
MTBImage |
getResultImage()
Get the result image
|
Double |
getThreshold()
Get threshold.
|
boolean |
isBGOriginalValue()
Test if background pixels keep their original pixel values
|
boolean |
isFGOriginalValue()
Test if foreground pixels keep their original pixel values
|
protected void |
operate() |
void |
setActualSliceOnly()
Only actual slice is thresholded, this will force the output image type to be of the same type as the input image (or destination image type)
|
void |
setBGOriginalValue()
Tell the thresholder to use the original pixel value for background pixels
|
void |
setBGValue(double value)
Set value of Parameter argument BGValue.
|
void |
setDestinationImage(MTBImage img)
Set value of Input argument DestinationImage.
|
void |
setFGOriginalValue()
Tell the thresholder to use the original pixel value for foreground pixels
|
void |
setFGValue(double value)
Set value of Parameter argument FGValue.
|
void |
setInputImage(MTBImage img)
Set input image
|
protected void |
setResultImage(MTBImage img)
Set result image.
|
void |
setThreshold(double thres)
Set threshold
|
protected MTBImage |
threshold(MTBImage img,
double thresh,
double upperThres,
double _fgValue,
double _bgValue,
boolean _actualSliceOnly)
Apply threshold to an MTBImage and create a new thresholded MTBImage.
|
protected void |
threshold(MTBImage img,
MTBImage threshImg,
double thresh,
double upperThresh,
double fgValue,
double bgValue,
boolean actualSliceOnly)
Apply threshold to an MTBImage and write results to a destination MTBImage.
|
void |
unsetActualSliceOnly()
The whole image is thresholded (default)
|
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
@Parameter(label="Lower Threshold", required=true, direction=IN, mode=STANDARD, dataIOOrder=2, description="Lower threshold, all pixels with intensity less this lower threshold are background pixels") private MTBDoubleData threshold
@Parameter(label="Upper Threshold", required=true, direction=IN, mode=STANDARD, dataIOOrder=2, description="Upper threshold, all pixels with intensity greater equal this upper threshold are background pixels") private MTBDoubleData upperThreshold
@Parameter(label="Current slice only", required=false, direction=IN, mode=STANDARD, dataIOOrder=5, description="Threshold only the current slice") private boolean actualSliceOnly
@Parameter(label="FG-value", required=true, direction=IN, mode=STANDARD, dataIOOrder=3, description="Gray value for foreground pixel). If value is INFINITY then the original pixel values are used.") private double fgValue
@Parameter(label="BG-value", required=true, direction=IN, mode=STANDARD, dataIOOrder=4, description="Gray value for background pixels. If value is INFINITY then the original pixel values are used.") private double bgValue
@Parameter(label="Input image", required=true, direction=IN, mode=STANDARD, dataIOOrder=1, description="Input image") private transient MTBImage inputImage
@Parameter(label="Destination image", required=false, direction=IN, mode=STANDARD, dataIOOrder=6, description="Optional destination image to draw to. If ommited a new image is created.") private transient MTBImage destinationImage
@Parameter(label="Result image", required=true, direction=OUT, mode=STANDARD, dataIOOrder=1, description="Result image") private transient MTBImage resultImage
public ImgThresh(MTBImage img, double thres) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- input imagethres
- values < threshold are set to 0, value >= threshold are set to 255de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ImgThresh(MTBImage img, double thres, double fg, double bg) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- input imagethres
- values < threshold are set to 'fgValue', value >= threshold are set to 'bgValue'fg
- foreground value (POSITIVE_INFINITY is interpreted as use original value)bg
- background value (POSITIVE_INFINITY is interpreted as use original value)de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ImgThresh() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected MTBImage threshold(MTBImage img, double thresh, double upperThres, double _fgValue, double _bgValue, boolean _actualSliceOnly)
img
- source MTBImagethresh
- Lower threshold.upperThres
- Uppper threshold._fgValue
- Foreground pixel value. If set to Double.POSITIVE_INFINITY, pixels higher than/equal to the threshold are set to their original values._bgValue
- Background pixel value. If set to Double.POSITIVE_INFINITY, pixels lower to the threshold are set to their original values._actualSliceOnly
- flag for only thresholding actual slice (true) or whole image (false)protected void threshold(MTBImage img, MTBImage threshImg, double thresh, double upperThresh, double fgValue, double bgValue, boolean actualSliceOnly) throws IllegalArgumentException
img
- source MTBImagethreshImg
- destination image to write the thresholded result tothresh
- ThresholdfgValue
- Foreground pixel value. If set to Double.POSITIVE_INFINITY, pixels higher than/equal to the threshold are set to their original values.bgValue
- Background pixel value. If set to Double.POSITIVE_INFINITY, pixels lower to the threshold are set to their original values.actualSliceOnly
- flag for only thresholding actual slice (true) or whole image (false)IllegalArgumentException
public MTBImage getInputImage()
public void setInputImage(MTBImage img)
public Double getThreshold()
public void setThreshold(double thres)
public double getFGValue()
public double getBGValue()
public boolean isFGOriginalValue()
public boolean isBGOriginalValue()
public void setFGOriginalValue()
public void setBGOriginalValue()
public boolean getActualSliceOnly()
public void setActualSliceOnly()
public void unsetActualSliceOnly()
public MTBImage getResultImage()
protected void setResultImage(MTBImage img)
img
- result imagepublic void setFGValue(double value)
value
- New value for FGValuepublic void setBGValue(double value)
value
- New value for BGValuepublic MTBImage getDestinationImage()
public void setDestinationImage(MTBImage img)
img
- destination imageCopyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.