de.unihalle.informatik.MiToBo.segmentation.thresholds
Class ImgThresh

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.segmentation.thresholds.ImgThresh
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener

@ALDAOperator(genericExecutionMode=ALL,
              level=STANDARD)
public class ImgThresh
extends MTBOperator

Image thresholding operator with lower threshold (threshold and upper threshold (upperThreshold.

All pixels with threshold < intensity <= upperThreshold are defined as foreground pixels.


Nested Class Summary
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
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.
 
Method Summary
 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)
 
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator
readResolve
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImgThresh

public ImgThresh(MTBImage img,
                 double thres)
          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor for thresholding using 255 as foreground and 0 as background value. The result image will be of type MTB_BYTE

Parameters:
img - input image
thres - values < threshold are set to 0, value >= threshold are set to 255
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ImgThresh

public ImgThresh(MTBImage img,
                 double thres,
                 double fg,
                 double bg)
          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Constructor for thresholding using 'fgValue' as foreground and 'bgValue' as background value. The result image will have the same type as the input image.

Parameters:
img - input image
thres - 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)
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ImgThresh

public ImgThresh()
          throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

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. Specify values for foreground and background value. If fgValue/bgValue is Double.POSITIVE_INFINITY the original image values are used for foreground/background pixels. If fgValue == 255 and bgValue == 0 and !actualSliceOnly, the result image will be of type MTB_BYTE

Parameters:
img - source MTBImage
thresh - 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)
Returns:
new thresholded MTBImage object

threshold

protected void threshold(MTBImage img,
                         MTBImage threshImg,
                         double thresh,
                         double upperThresh,
                         double fgValue,
                         double bgValue,
                         boolean actualSliceOnly)
                  throws IllegalArgumentException
Apply threshold to an MTBImage and write results to a destination MTBImage. Specify values for foreground and background value. If fgValue/bgValue is Double.POSITIVE_INFINITY the original image values are used for foreground/background pixels.

Parameters:
img - source MTBImage
threshImg - destination image to write the thresholded result to
thresh - 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)
Throws:
IllegalArgumentException

getInputImage

public MTBImage getInputImage()
Get input image

Returns:
input image

setInputImage

public void setInputImage(MTBImage img)
Set input image


getThreshold

public Double getThreshold()
Get threshold. Might be null if no threshold was specified, but this will cause an exception on runtime

Returns:
threshold

setThreshold

public void setThreshold(double thres)
Set threshold


getFGValue

public double getFGValue()
Get foreground value

Returns:
foreground value

getBGValue

public double getBGValue()
Get background value

Returns:
background value

isFGOriginalValue

public boolean isFGOriginalValue()
Test if foreground pixels keep their original pixel values

Returns:
true if foreground pixels keep their original pixel values

isBGOriginalValue

public boolean isBGOriginalValue()
Test if background pixels keep their original pixel values

Returns:
true if background pixels keep their original pixel values

setFGOriginalValue

public void setFGOriginalValue()
Tell the thresholder to use the original pixel value for foreground pixels


setBGOriginalValue

public void setBGOriginalValue()
Tell the thresholder to use the original pixel value for background pixels


getActualSliceOnly

public boolean getActualSliceOnly()
Get flag for thresholding only the actual slice (true) or the whole image (false)


setActualSliceOnly

public 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)


unsetActualSliceOnly

public void unsetActualSliceOnly()
The whole image is thresholded (default)


getResultImage

public MTBImage getResultImage()
Get the result image

Returns:
result image

setResultImage

protected void setResultImage(MTBImage img)
Set result image. You may specify a destination image to which the thresholding results are written. Otherwise the operator sets a new resulting image.

Parameters:
img - result image

setFGValue

public void setFGValue(double value)
Set value of Parameter argument FGValue.

Parameters:
value - New value for FGValue

setBGValue

public void setBGValue(double value)
Set value of Parameter argument BGValue.

Parameters:
value - New value for BGValue

getDestinationImage

public MTBImage getDestinationImage()
Get value of Input argument DestinationImage.

Returns:
value of DestinationImage

setDestinationImage

public void setDestinationImage(MTBImage img)
Set value of Input argument DestinationImage.

Parameters:
img - destination image


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.