Package gov.nih.mipav.model.algorithms
Class GenerateDGaussian
java.lang.Object
gov.nih.mipav.model.algorithms.GenerateDGaussian
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
FieldsModifier and TypeFieldDescriptionprivate doubledenominator of gaussian coeff.private int[]derivative order in each dimension.private int[]length of function in pixel in each dim.private double[]data storage buffer.private booleanDOCUMENT ME!private intnumber of dimensions.private int[]temp point storage.private double[]standard dev. in each direction -
Constructor Summary
ConstructorsConstructorDescriptionGenerateDGaussian(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
Modifier and TypeMethodDescriptionvoidcalc(boolean invert) Starts the Gaussian calculation.voidfinalize()Prepares this class for destruction.private doublegaussPt(int[] pt) Calculates the Gaussian function at a point.private doublehermite(int order, double num) Factor to include when calculating derivatives.Converts gaussian double buffer to image model object.private voidrecursiveCalc(int offset, int dim) Starts the Gaussian calculation.
-
Field Details
-
denom
private double denomdenominator of gaussian coeff. -
derivOrder
private int[] derivOrderderivative order in each dimension. -
dimLengths
private int[] dimLengthslength of function in pixel in each dim. -
gaussianData
private double[] gaussianDatadata storage buffer. -
invert
private boolean invertDOCUMENT ME! -
nDims
private int nDimsnumber of dimensions. -
pt
private int[] pttemp point storage. -
sigmas
private double[] sigmasstandard dev. in each direction
-
-
Constructor Details
-
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 functiondimLengths- length of function in pixels in each dimensionsigmas- standard dev. in each directionderivOrder- 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 functiondimLengths- length of function in pixels in each dimensionsigmas- standard dev. in each directionderivOrder- derivative order in each dimensiondenom- denominator of the gaussian scale coeffient
-
-
Method Details
-
calc
public void calc(boolean invert) Starts the Gaussian calculation.- Parameters:
invert- Flag indicating inversion
-
finalize
public void finalize()Prepares this class for destruction. -
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 ordernum- input factor to correct- Returns:
- hermite factor
-
recursiveCalc
private void recursiveCalc(int offset, int dim) Starts the Gaussian calculation.- Parameters:
offset- offset in datadim- present dimension
-