public class ImageMomentsLayout extends Object implements Serializable
CentralMoments this class
calculates image moments meaning statistic properties in a two-dimensional
image. Suppose you have an array of pixel values
I_ij = I(x,y)
Sampled at integer x/y pixel values, thus representable as a
two-dimensional
double array ADU[y][x] like returned from
fits.FitsTools (note the counter-intuitive indexing
within the array; this stems from the FITS standard.
Passing this to the constructor of this class immediately calculates
I_0, x_c and y_c via the formulars:
I_0=ΣADU_ij,Further calls to
xc=Σ(x_ij·ADU_ij)/I_0,
yc=Σ(y_ij·ADU_ij)/I_0.
#getImageMoment first check, if the moment to
n,k has already been cached, otherwise it is calculated according to
M_nk=Σ(x_ij-xc)n (y_ij-yc)k /I_0
| Modifier and Type | Class and Description |
|---|---|
static class |
ImageMomentsLayout.Focus
This class reads an fits image and calculates the requested image
moment.
|
| Modifier and Type | Field and Description |
|---|---|
private double[] |
adu
This is the image array, description from layout.
|
private double |
bias
If a bias is set, only adus above this are considered.
|
private Map<Integer,Double> |
cache
Cache is updated at each call to
#getImageMoment with no hit. |
private LayoutImpl |
dim2
How the image array is to be read as a 2-dim image.
|
private double |
high
The multiplicator to the RN for maximum ADU still considered BG.
|
private double |
low
The multiplicator to the RN for minimum ADU still considered BG.
|
private double |
readnoise
The standard deviation estimate for background rejection.
|
private double |
sum0
Once the image is set, this is the ADU-sum.
|
private double |
xc
Once the image is set, this is the center-of-gravity, x coordinate.
|
private double |
yc
Once the image is set, this is the center-of-gravity, y coordinate.
|
| Constructor and Description |
|---|
ImageMomentsLayout(double[] image,
ArrayLayout d2)
Takes an image array and readily calculates the count sum plus the
center of gravity.
|
ImageMomentsLayout(double[] image,
ArrayLayout d2,
double bias,
double rn)
Takes an image array and readily calculates the count sum plus the
center of gravity.
|
ImageMomentsLayout(double[] image,
ArrayLayout d2,
double bias,
double rn,
double hi,
double lo)
Takes an image array and readily calculates the count sum plus the
center of gravity.
|
| Modifier and Type | Method and Description |
|---|---|
private double |
calculateMnk(int n,
int m) |
Point2D |
getCenter()
Returns xc yc as a Point2D object.
|
double |
getMoment(int x0,
int y0)
If the queried moment has not been calculated, we evaluate it by
M_nk=Σ(x_ij-xc) |
void |
setImage(double[] image,
ArrayLayout d2,
double bs,
double rn,
double hisig,
double losig)
Sets a new pixel array, erasing the cache, but immediately calculating
the new count sum plus center of gravity.
|
private double[] adu
private LayoutImpl dim2
private double bias
private double readnoise
private double high
private double low
private double sum0
private double xc
private double yc
public ImageMomentsLayout(double[] image,
ArrayLayout d2)
public ImageMomentsLayout(double[] image,
ArrayLayout d2,
double bias,
double rn)
public ImageMomentsLayout(double[] image,
ArrayLayout d2,
double bias,
double rn,
double hi,
double lo)
public void setImage(double[] image,
ArrayLayout d2,
double bs,
double rn,
double hisig,
double losig)
public double getMoment(int x0,
int y0)
M_nk=Σ(x_ij-xc)n (y_ij-yc)k /I_0.
The moment is also cached for further queries. The special case
with
x0=y0=0 returns the ADU-sum, I_0, while queries with
x0=1,y0=0 or x0=0,y0=1 return the center of gravity coordinate.x0 - The leading index in M_nky0 - The trailing index in M_nkpublic Point2D getCenter()
private double calculateMnk(int n,
int m)