Class AlgorithmGradientMagnitudeSep

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

    public class AlgorithmGradientMagnitudeSep
    extends AlgorithmBase
    Calculates the gradient magnitude of an image at a scale defined by the user (using separable convolutions). Adapted from AlgorithmGradientMagnitude. This version should be faster but uses significantly more memory.

    Produces equivalent result images to AlgorithmGradientMagnitude (aside from some rounding error that seems to be at most 10^-4)

    Version:
    0.1 July 31, 2003
    Author:
    Evan McCreedy
    See Also:
    AlgorithmGradientMagnitude
    • Field Detail

      • blue

        private boolean blue
        DOCUMENT ME!
      • entireImage

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

        private boolean green
        DOCUMENT ME!
      • gaussianKernel

        private Kernel gaussianKernel
      • red

        private boolean red
        Flags indicate which color channel to process. True indicates the channel should be processed.
      • sigmas

        private float[] sigmas
        Standard deviations of the gaussian used to calculate the kernels.
      • outputBuffer

        private float[] outputBuffer
      • normalized

        private boolean normalized
      • directionNeeded

        private boolean directionNeeded
      • xDerivativeDirections

        private float[] xDerivativeDirections
      • yDerivativeDirections

        private float[] yDerivativeDirections
      • zEnd

        private int zEnd
      • doEndSlices

        private boolean doEndSlices
      • kExtents

        private int[] kExtents
    • Constructor Detail

      • AlgorithmGradientMagnitudeSep

        public AlgorithmGradientMagnitudeSep​(ModelImage srcImg,
                                             float[] sigmas,
                                             boolean maskFlag,
                                             boolean img25D)
        Creates a new AlgorithmGradientMagnitudeSep object.
        Parameters:
        srcImg - source image model
        sigmas - Gaussian standard deviations in each dimension
        maskFlag - Flag, if true, indicates that the gradient magnitude will be calculated for the whole image
        img25D - Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D images disregard this flag.
    • Method Detail

      • beforeExecute

        public void beforeExecute()
      • execute

        public void execute()
      • afterExecute

        public void afterExecute()
      • calculateDerivativeImage

        private float[] calculateDerivativeImage​(float[] imgData,
                                                 int[] imgExtents,
                                                 boolean color,
                                                 float[][] kernelData,
                                                 int progressFrom,
                                                 int progressTo)
      • magnitude

        private float[] magnitude​(float[] buffer,
                                  int cFactor,
                                  float[] xDerivatives,
                                  float[] yDerivatives,
                                  float[] zDerivatives,
                                  int progressFrom,
                                  int progressTo)
      • finalize

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

        public void setBlue​(boolean flag)
        Sets the flag for the blue channel.
        Parameters:
        flag - if set to true then the blue channel is processed.
      • setGreen

        public void setGreen​(boolean flag)
        Sets the flag for the green channel.
        Parameters:
        flag - if set to true then the green channel is processed.
      • setRed

        public void setRed​(boolean flag)
        Sets the flag for the red channel.
        Parameters:
        flag - if set to true then the red channel is processed.
      • getResultBuffer

        public float[] getResultBuffer()
      • getXDerivativeDirections

        public float[] getXDerivativeDirections()
      • getYDerivativeDirections

        public float[] getYDerivativeDirections()
      • isNormalized

        public boolean isNormalized()
      • setNormalized

        public void setNormalized​(boolean normalized)
      • isDirectionNeeded

        public boolean isDirectionNeeded()
      • setDirectionNeeded

        public void setDirectionNeeded​(boolean directionNeeded)
      • is3DKernel

        private boolean is3DKernel()
      • calculateValidStartZIndex

        public int calculateValidStartZIndex()
      • calculateValidEndZIndex

        public int calculateValidEndZIndex()
      • getKExtents

        public int[] getKExtents()