Class AlgorithmGaussianBlurSep

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

    public class AlgorithmGaussianBlurSep
    extends AlgorithmBase
    implements AlgorithmInterface
    Calculates the gaussian blur of an image at a scale defined by the user (using separable convolutions). Adapted from AlgorithmGaussianBlur. This version should be faster but uses significantly more memory.

    The application of this algorithm blurs an image or VOI region of the image with a Gaussian function at a user defined scale (sigma - standard deviation). In essence, convolving a Gaussian function produces the same result as a low-pass or smoothing filter. A low-pass filter attenuates high frequency components of the image (i.e. edges) and passes low frequency components and thus results in the blurring of the image. Smoothing filters are typically used for noise reduction and for blurring. The standard deviation (SD) of the Gaussian function controls the amount of blurring:a large SD (i.e. > 2) significantly blurs while a small SD (i.e. 0.5) blurs less. If the objective is to achieve noise reduction, a rank filter (median) might be more useful.

    1D Gaussian = (1/sqrt(2*PI*sigma*sigma))*exp(-x*x/(2*sigma*sigma));

    Advantages to convolving the Gaussian function to blur an image include:

    1. Structure will not be added to the image. 2. Can be analytically calculated, as well as the Fourier Transform of the Gaussian. 3. By varying the SD a Gaussian scale-space can easily be constructed.

    Version:
    0.1 Feb 11, 1998
    Author:
    Matthew J. McAuliffe, Ph.D.
    See Also:
    GenerateGaussian, AlgorithmConvolver
    • Field Detail

      • 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.
      • red

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

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

        private boolean blue
        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.
      • gaussianKernel

        private Kernel gaussianKernel
      • inputBuffer

        private float[] inputBuffer
      • outputBuffer

        private float[] outputBuffer
    • Constructor Detail

      • AlgorithmGaussianBlurSep

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

      • finalize

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

        public void beforeExecute()
      • execute

        public void execute()
      • afterExecute

        public void afterExecute()
      • 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()
      • algorithmPerformed

        public void algorithmPerformed​(AlgorithmBase algorithm)
        Description copied from interface: AlgorithmInterface
        Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.
        Specified by:
        algorithmPerformed in interface AlgorithmInterface
        Parameters:
        algorithm - the algorithm which has just completed