Class GenerateDGaussian


  • public class GenerateDGaussian
    extends java.lang.Object
    Calculates an n-dimensional gaussian volume at a given scale, kernel size, and normalized derivative (through the fourth order) in any of the dimensions. Explanation of normalized derivative: The derivative of n = (1/sqrt(2*PI*sigma*sigma))*exp(-x*x/(2*sigma*sigma)) with respect to x = -(x/(sigma*sigma))*n. 1/2 the integral of the derivative from -infinity to infinity with respect to x or the integral of the derivative from 0 to infinity with respect to x = 1/(sigma * sqrt(2*PI)). Hence, the derivative is normalized by multiplying by the normalizing constant sigma. GenerateGaussian returns the Gaussian, sigma times the first derivative of the Gaussian, sigma squared times the second derivative of the Gaussian, sigma cubed times the third derivative of the Gaussian.
    Version:
    0.8 Aug 4, 1998
    Author:
    Matthew J. McAuliffe, Ph.D.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double denom
      denominator of gaussian coeff.
      private int[] derivOrder
      derivative order in each dimension.
      private int[] dimLengths
      length of function in pixel in each dim.
      private double[] gaussianData
      data storage buffer.
      private boolean invert
      DOCUMENT ME!
      private int nDims
      number of dimensions.
      private int[] pt
      temp point storage.
      private double[] sigmas
      standard dev. in each direction
    • Constructor Summary

      Constructors 
      Constructor Description
      GenerateDGaussian​(double[] data, int[] dimLengths, double[] sigmas, int[] derivOrder)
      Initializes class that calculates an n-dim Gaussian.
      GenerateDGaussian​(double[] data, int[] dimLengths, double[] sigmas, int[] derivOrder, double denom)
      Initializes class that calculates an n-dim Gaussian.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void calc​(boolean invert)
      Starts the Gaussian calculation.
      void finalize()
      Prepares this class for destruction.
      private double gaussPt​(int[] pt)
      Calculates the Gaussian function at a point.
      private double hermite​(int order, double num)
      Factor to include when calculating derivatives.
      ModelImage makeImage()
      Converts gaussian double buffer to image model object.
      private void recursiveCalc​(int offset, int dim)
      Starts the Gaussian calculation.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • denom

        private double denom
        denominator of gaussian coeff.
      • derivOrder

        private int[] derivOrder
        derivative order in each dimension.
      • dimLengths

        private int[] dimLengths
        length of function in pixel in each dim.
      • gaussianData

        private double[] gaussianData
        data storage buffer.
      • invert

        private boolean invert
        DOCUMENT ME!
      • nDims

        private int nDims
        number of dimensions.
      • pt

        private int[] pt
        temp point storage.
      • sigmas

        private double[] sigmas
        standard dev. in each direction
    • Constructor Detail

      • GenerateDGaussian

        public GenerateDGaussian​(double[] data,
                                 int[] dimLengths,
                                 double[] sigmas,
                                 int[] derivOrder)
        Initializes class that calculates an n-dim Gaussian.
        Parameters:
        data - storage area of Gaussian function
        dimLengths - length of function in pixels in each dimension
        sigmas - standard dev. in each direction
        derivOrder - derivative order in each dimension
      • GenerateDGaussian

        public GenerateDGaussian​(double[] data,
                                 int[] dimLengths,
                                 double[] sigmas,
                                 int[] derivOrder,
                                 double denom)
        Initializes class that calculates an n-dim Gaussian.
        Parameters:
        data - storage area of Gaussian function
        dimLengths - length of function in pixels in each dimension
        sigmas - standard dev. in each direction
        derivOrder - derivative order in each dimension
        denom - denominator of the gaussian scale coeffient
    • Method Detail

      • calc

        public void calc​(boolean invert)
        Starts the Gaussian calculation.
        Parameters:
        invert - Flag indicating inversion
      • finalize

        public void finalize()
        Prepares this class for destruction.
        Overrides:
        finalize in class java.lang.Object
      • makeImage

        public ModelImage makeImage()
        Converts gaussian double buffer to image model object.
        Parameters:
        UI - pointer to user interface
        Returns:
        image model object containing the gaussian data
      • gaussPt

        private double gaussPt​(int[] pt)
        Calculates the Gaussian function at a point.
        Parameters:
        pt - array of ints representing a point where the Gaussian should be calculated.
        Returns:
        DOCUMENT ME!
      • hermite

        private double hermite​(int order,
                               double num)
        Factor to include when calculating derivatives.
        Parameters:
        order - derivative order
        num - input factor to correct
        Returns:
        hermite factor
      • recursiveCalc

        private void recursiveCalc​(int offset,
                                   int dim)
        Starts the Gaussian calculation.
        Parameters:
        offset - offset in data
        dim - present dimension