Class GenerateGaussian


  • public class GenerateGaussian
    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 double[] dgaussianData  
      private int[] dimLengths
      length of function in pixel in each dim.
      private double[] dsigmas  
      private float[] gaussianData
      data storage buffer.
      private boolean invert
      DOCUMENT ME!
      private int nDims
      number of dimensions.
      private int[] pt
      temp point storage.
      private float[] sigmas
      standard dev. in each direction
    • Constructor Summary

      Constructors 
      Constructor Description
      GenerateGaussian​(double[] data, int[] dimLengths, double[] sigmas, int[] derivOrder)
      Initializes class that calculates an n-dim Gaussian.
      GenerateGaussian​(double[] data, int[] dimLengths, double[] sigmas, int[] derivOrder, double denom)
      Initializes class that calculates an n-dim Gaussian.
      GenerateGaussian​(float[] data, int[] dimLengths, float[] sigmas, int[] derivOrder)
      Initializes class that calculates an n-dim Gaussian.
      GenerateGaussian​(float[] data, int[] dimLengths, float[] 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 dcalc​(boolean invert)
      Starts the Gaussian calculation.
      private double dgaussPt​(int[] pt)
      Calculates the Gaussian function at a point.
      private void drecursiveCalc​(int offset, int dim)
      Starts the Gaussian calculation.
      void finalize()
      Prepares this class for destruction.
      private float 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 float 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 float[] gaussianData
        data storage buffer.
      • dgaussianData

        private double[] dgaussianData
      • invert

        private boolean invert
        DOCUMENT ME!
      • nDims

        private int nDims
        number of dimensions.
      • pt

        private int[] pt
        temp point storage.
      • sigmas

        private float[] sigmas
        standard dev. in each direction
      • dsigmas

        private double[] dsigmas
    • Constructor Detail

      • GenerateGaussian

        public GenerateGaussian​(float[] data,
                                int[] dimLengths,
                                float[] 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
      • GenerateGaussian

        public GenerateGaussian​(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
      • GenerateGaussian

        public GenerateGaussian​(float[] data,
                                int[] dimLengths,
                                float[] 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
      • GenerateGaussian

        public GenerateGaussian​(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
      • dcalc

        public void dcalc​(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 float buffer to image model object.
        Parameters:
        UI - pointer to user interface
        Returns:
        image model object containing the gaussian data
      • gaussPt

        private float 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!
      • dgaussPt

        private double dgaussPt​(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
      • drecursiveCalc

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