Class AlgorithmThresholdDual

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmThresholdDual
    extends AlgorithmBase
    This algorithm has two modes of operation:

    1. Generates binary image based on threshold values passed in by the constructor. Inside the volume of interest: If the image intensity is greater than or equal to the threshold[0] and less than or equal to the threshold[1], the binary image is set to one. Otherwise, it is set to zero. Outside the volume of interest: The binary image is set equal to zero.

    2. Inside the volume of interest: Preserves all grey scale values from threshold[0] to threshold[1] and sets all values less than the lower threshold and all values greater than the upper threshold to the fillValue supplied to this algorithm via the constructor. Outside the volume of interest: Sets all gray scale values to the fill value.

    Version:
    1.0 March 8, 2000
    Author:
    Matthew J. McAuliffe, Ph.D.
    • Field Detail

      • UNSIGNED_BYTE_TYPE

        public static final int UNSIGNED_BYTE_TYPE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • entireImage

        private boolean entireImage
        Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
      • fillValue

        private float fillValue
        All values outside the thresholds are set to this value.
      • isInverse

        private boolean isInverse
        Inverse threshold: false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value (fill value can also be binary (0)).
      • outputType

        private int outputType
        Type of output (same type, binary, or unsigned byte).
      • threshold

        private float[] threshold
        Array of two thresholds. threshold[0] = Minimum threshold, threshold[1] = Maximum threshold.
      • pixelsInRange

        private int pixelsInRange
        Variable that will store the total number of pixels in thresholding range
    • Constructor Detail

      • AlgorithmThresholdDual

        public AlgorithmThresholdDual​(ModelImage srcImg,
                                      float[] threshold,
                                      float fillValue,
                                      int output_type,
                                      boolean maskFlag,
                                      boolean isInverse)
        Creates a new AlgorithmThresholdDual object.
        Parameters:
        srcImg - source image model
        threshold - array of two thresholds
        fillValue - all values outside the thresholds are set to this value
        output_type - same type, binary, or unsigned byte
        maskFlag - true indicates that the whole image should be processed
        isInverse - false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value
      • AlgorithmThresholdDual

        public AlgorithmThresholdDual​(ModelImage destImg,
                                      ModelImage srcImg,
                                      float[] threshold,
                                      float fillValue,
                                      int output_type,
                                      boolean maskFlag,
                                      boolean isInverse)
        Creates a new AlgorithmThresholdDual object.
        Parameters:
        destImg - image model where result image is to be stored
        srcImg - source image model
        threshold - array of two thresholds
        fillValue - all values outside the thresholds are set to this value
        output_type - same type, binary, or unsigned byte
        maskFlag - true indicates that the whole image should be processed
        isInverse - false means turn all pixels outside of the lower and upper thresholds to the given fill value, true means turn all data within the lower and upper thresholds to the fill value
    • Method Detail

      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class AlgorithmBase
      • calcInPlace2D

        private void calcInPlace2D()
        Replace 2D source image with the thresholded image.
      • calcInPlace34D

        private void calcInPlace34D()
        Replace 3D or 4D source image with the thresholded image.
      • calcStoreInDest2D

        private void calcStoreInDest2D()
        Stores the thresholded image into the destination image.
      • calcStoreInDest34D

        private void calcStoreInDest34D()
        Stores the thresholded image into the destination image.
      • setThresholdStatistics

        private void setThresholdStatistics()