public class Quantize extends Object
Constructor and Description |
---|
Quantize(QuantizeOption quantizeOption) |
Modifier and Type | Method and Description |
---|---|
protected void |
computeMedianOfValuesEachRow(int nrows,
int nrows2,
double[] diffs2,
double[] diffs3,
double[] diffs5) |
protected int |
findNextValidPixelWithNullCheck(int nx,
nom.tam.fits.compression.algorithm.quant.Quantize.DoubleArrayPointer rowpix,
int ii) |
protected double |
getNoise2() |
protected double |
getNoise3() |
protected double |
getNoise5() |
protected boolean |
isNull(double d) |
boolean |
quantize(double[] fdata,
int nxpix,
int nypix)
arguments: long row i: tile number = row number in the binary table
double fdata[] i: tiledImageOperation of image pixels to be compressed
long nxpix i: number of pixels in each row of fdata long nypix i: number
of rows in fdata nullcheck i: check for nullvalues in fdata? double
in_null_value i: value used to represent undefined pixels in fdata float
qlevel i: quantization level int dither_method i; which dithering method
to use int idata[] o: values of fdata after applying bzero and bscale
double bscale o: scale factor double bzero o: zero offset int iminval o:
minimum quantized value that is returned int imaxval o: maximum quantized
value that is returned The function value will be one if the input fdata
were copied to idata; in this case the parameters bscale and bzero can be
used to convert back to nearly the original floating point values: fdata
~= idata * bscale + bzero.
|
public Quantize(QuantizeOption quantizeOption)
protected void computeMedianOfValuesEachRow(int nrows, int nrows2, double[] diffs2, double[] diffs3, double[] diffs5)
protected int findNextValidPixelWithNullCheck(int nx, nom.tam.fits.compression.algorithm.quant.Quantize.DoubleArrayPointer rowpix, int ii)
protected double getNoise2()
protected double getNoise3()
protected double getNoise5()
protected boolean isNull(double d)
public boolean quantize(double[] fdata, int nxpix, int nypix)
In earlier implementations of the compression code, we only used the noise3 value as the most reliable estimate of the background noise in an image. If it is not possible to compute a noise3 value, then this serves as a red flag to indicate that quantizing the image could cause a loss of significant information in the image.
At some later date, we decided to take the more conservative approach of using the minimum of all three of the noise values (while still requiring that noise3 has a defined value) as the best estimate of the noise. Note that if an image contains pure Gaussian distributed noise, then noise2, noise3, and noise5 will have exactly the same value (within statistical measurement errors).
fdata
- the data to quantinizenxpix
- the image widthnypix
- the image hightCopyright © 1996–2016 nom-tam-fits. All rights reserved.