Object o = _sourceImage.getProperty("#fits_image");
_reverseY = false;
_invertedYAxis = false;
if (o instanceof FITSImage) {
FITSImage fitsImage = (FITSImage) o;
_invertedYAxis = fitsImage.isYFlipped();
_reverseY = !_invertedYAxis;
// check for BZERO and BSCALE keywords and, if needed, apply the values
_bzero = fitsImage.getKeywordValue("BZERO", 0.);
_bscale = fitsImage.getKeywordValue("BSCALE", 1.);
_bitpix = fitsImage.getKeywordValue("BITPIX", 0);
_rescaledSourceImage = rescaleImage(_sourceImage);
// check for grayscale images
// (Note: GIF images can have _numBands == 1 and IndexColorModel, which is already color)
if (_numBands == 1 && ! (_sourceImage.getColorModel() instanceof IndexColorModel)) {
// get value of blank or bad pixels
_blank = fitsImage.getKeywordValue("BLANK", Float.NaN);
if (Float.isNaN(_blank))
_blank = fitsImage.getKeywordValue("BADPIXEL", Float.NaN);
if (!Float.isNaN(_blank)) {
// assume blank value needs to be rescaled in the same way as the image
// (the resulting image is float data, so make sure the "blank" value is treated the same)
_blank = _blank * (float) _bscale + (float) _bzero;
}
// min/max pixel values, if specified in image properties
_dataMin = fitsImage.getKeywordValue("DATAMIN", 0.);
_dataMax = fitsImage.getKeywordValue("DATAMAX", 0.);
_dataMean = fitsImage.getKeywordValue("DATAMEAN", Double.NaN);
}
} else {
_bzero = 0.;
_bscale = 1.;
_bitpix = 0;