T
- the type of the given image, must extend RealType
, for
we operate on real values.public class GaussianPeakFitterND<T extends RealType<T>> extends Object
The gaussian can have a different sigma in any direction, but the ellipse main axes still need to be aligned with the image axes. Note that there is no constant term in this equation, thus the need for a 0-background image.
The fitting uses a plain Levenberg-Marquardt least-square curve fitting algorithm, with various small tweaks for robustness and speed, mainly a first step to derive a crude estimate, based on maximum-likelihood analytic formulae.
A fitter is instantiated for an image, but can be easily processed in parallel for multiple spots on this image.
Constructor and Description |
---|
GaussianPeakFitterND(Image<T> image)
Instantiate a 2D gaussian peak fitter that will operate on the given image.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkInput()
Ensure the image is not null.
|
String |
getErrorMessage() |
double[] |
process(Localizable point,
double[] typical_sigma)
Fit an elliptical gaussian to a peak in the image, using the formula:
|
public boolean checkInput()
public double[] process(Localizable point, double[] typical_sigma)
g(xᵢ) = A * exp ( - ∑ cᵢ × (xᵢ - x₀ᵢ)² )
First observation arrays are built by collecting pixel positions and intensities around the given peak location. These arrays are then used to guess a starting set of parameters, that is then fed to least-square optimization procedure, using the Levenberg-Marquardt curve fitter.
Calls to this function does not generate any class field, and can therefore by readily parallelized with multiple peaks on the same image.
point
- the approximate coordinates of the peaktypical_sigma
- the typical sigma of the peak (in pixel unit, array of one
element per dimension), that will be used to derive the size of a block that will
be inspected around the peak by the fit (the actual block size will of of size
2 * 2 * ceil(typical_sigma) + 1)
.2*ndims+1
elements double array containing fit estimates,
in the following indices:
0. A 1 → ndims x₀ᵢ ndims+1 → 2 × ndims cᵢ = 1 / σᵢ²
public String getErrorMessage()
Copyright © 2015–2021 Fiji. All rights reserved.