Class AlgorithmRegularizedIsotropicDiffusion

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

    public class AlgorithmRegularizedIsotropicDiffusion
    extends AlgorithmBase
    Algorithm to apply Regularized Isotropic Nonlinear Diffusion as described by:

    Joachim Weickert Chapter 15 in Handbook of Computer Vision and Applications, Volume 2 Signal Processing and Pattern Recognition. The book is published by Academic Press, ISBN 0-12-379772-1

    Here is a listing of the author's terminology used in the title.

    • Regularized the computed image is blurred with a Gaussian kernel prior to taking finite derivatives
    • Isotropic the gradient and flux are parallel
    • Nonlinear the weights used for combining pixels change over the image, space variant.
    • Diffusion this model uses the heat equation
    Version:
    1.0; 31, July 2003
    Author:
    Paul F. Hemler, Ph.D.
    • Field Detail

      • numIterations

        int numIterations
        The number of iterations.
      • timeStep

        float timeStep
        The time parameter step size, called tau in the algorithm description In 2D for stability the time step should be
        • contrast

          private float contrast
          Diffusion contrast parameter.
        • do25D

          private boolean do25D
          Flag indicating 2.5D processing.
        • lambda

          private float lambda
          Contrast multiplied by the maximum gradient.
        • sigmas

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

          private float stdDev
          Standard deviation used for the Gaussians.
        • xDataRound

          private float[] xDataRound
          Storage location for the 1D gaussian kernels.
        • xDim

          private int xDim
          Image dimensions.
        • yDim

          private int yDim
          Image dimensions.
        • zDim

          private int zDim
          Image dimensions.
        • yDataRound

          private float[] yDataRound
          Storage location for the 1D gaussian kernels.
        • zDataRound

          private float[] zDataRound
          Storage location for the 1D gaussian kernels.
        • Constructor Detail

          • AlgorithmRegularizedIsotropicDiffusion

            public AlgorithmRegularizedIsotropicDiffusion​(ModelImage destImg,
                                                          ModelImage srcImg,
                                                          int numI,
                                                          float stdDev,
                                                          float contrast,
                                                          boolean do25D)
            Creates a new AlgorithmRegularizedIsotropicDiffusion object.
            Parameters:
            destImg - ModelImage image model where result image is to stored
            srcImg - ModelImage source image model
            numI - int number of iterations
            stdDev - float standard deviation used in the Gaussians
            contrast - float diffusion contrast parameter
            do25D - boolean If true, process each slice separately
        • Method Detail

          • finalize

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

            private float diffusivity​(float d)
            Returns the weighting for values used in computing new (diffused) pixel values.
            Parameters:
            d - float Value to compute the diffusivity
            Returns:
            float The value of the diffusivity corresponding to the d value
          • getVal

            private float getVal​(float[] buffer,
                                 int col,
                                 int row)
            Returns the value in a 2D image buffer of the pixel at location col, row.
            Parameters:
            buffer - float[] The image buffer
            col - int Column index
            row - int Row index
            Returns:
            float The pixel value
          • getVal

            private float getVal​(float[] buffer,
                                 int col,
                                 int row,
                                 int slice)
            Returns the value in a 3D image buffer of the pixel at location col, row, slice.
            Parameters:
            buffer - float[] The image buffer
            col - int Column index
            row - int Row index
            slice - int Slice index
            Returns:
            float The pixel value
          • gradientMagnitude

            private void gradientMagnitude​(float[] img,
                                           float[] mag)
            Computes the gradient magnitude of the buffer passed in. This version computes values for the image borders and corners
            Parameters:
            img - float [] source buffer
            mag - float [] a buffer where the gradient magnitude will be placed
          • gradientMagnitude3D

            private void gradientMagnitude3D​(float[] img,
                                             float[] mag)
            Computes the gradient magnitude of the buffer passed in. This version computes values for the image borders and corners
            Parameters:
            img - float [] source buffer
            mag - float [] a buffer where the gradient magnitude will be placed
          • makeKernels1D

            private void makeKernels1D​(boolean do3D)
            DOCUMENT ME!
            Parameters:
            do3D - boolean Flag indicating if a 3D kernel should be computed
          • run2D

            private void run2D​(int numImages)
            Iterates the Regularized Isotropic Nonlinear Diffusion algorithm for 2D and 2.5D images.
            Parameters:
            numImages - int number of images to be blurred. If 2D image then nImage = 1, if 3D image where each slice is to processed independently then nImages equals the number of slices in the volume.
          • run2DC

            private void run2DC​(int numImages)
            Iterates the Regularized Isotropic Nonlinear Diffusion algorithm for 2D and 2.5D color images.
            Parameters:
            numImages - int number of slices to be blurred. If 2D image then nImage = 1, if 3D image where each slice is to processed independently then nImages equals the number of slices in the volume.
          • run3D

            private void run3D()
            Iterates the Regularized Isotropic Nonlinear Diffusion algorithm for 3D images.
          • run3DC

            private void run3DC()
            Iterates the Regularized Isotropic Nonlinear Diffusion algorithm for 3D color images.
          • upDateImage

            private void upDateImage​(float[] resltBuffer,
                                     float[] srcBuffer,
                                     float[] gradBuffer)
            DOCUMENT ME!
            Parameters:
            resltBuffer - float [] The preallocated result buffer
            srcBuffer - float [] The initialized source buffer containing the input image
            gradBuffer - float [] The initialized buffer containing the magnitude of the gradient of the Gaussian blurred input image
          • upDateImage3D

            private void upDateImage3D​(float[] resltBuffer,
                                       float[] srcBuffer,
                                       float[] gradBuffer)
            DOCUMENT ME!
            Parameters:
            resltBuffer - float [] The preallocated result buffer
            srcBuffer - float [] The initialized source buffer containing the input image
            gradBuffer - float [] The initialized buffer containing the magnitude of the gradient of the Gaussian blurred input image