[fitsbits] Any bad pixel mask convention?
Rob Seaman
seaman at noao.edu
Wed Dec 4 15:58:06 EST 2013
Hi Richard,
> Is there something like a bad pixel mask FITS standard that stores bad pixels
> with a boolen value or perhaps a float where 1=good, NaN=bad in FITS images?
> Should one use a BLANK value combined with a byte or integer image or is
> it best to invent a private ASCII format for this purpose?
I guess I'm not entirely sure what's being requested here. Are you looking for a way to represent a separate full size array of flags, one per pixel? Or a way to embed special values within a particular data array itself? I guess a "private ASCII format" would be something like a pixel list concept?
As others have said there isn't really a mask standard in FITS since the concept is too generalized, e.g., support for MEFs and world coordinates and other features would have to be factored in. However, the IRAF pixel list format was created to efficiently represent per-pixel masks, and this algorithm is supported by FPACK:
http://heasarc.nasa.gov/fitsio/fpack/fpackguide.pdf
If the general concept of a mask is a separate array of per-pixel integer flags mapped one-to-one with one or more data arrays in an MEF, then the default FPACK Rice algorithm is pretty efficient itself. Just create an integer array the same size as your data array(s) and fill it with whatever values make sense. Copy over the WCS and other metadata as needed from your data arrays. NOAO uses zeroes for good pixels and non-zero for bad. Perhaps use different values to represent different kinds of bad - which is something that will vary from project to project. Compress it using FPACK and it will get dramatically smaller since such a file will be very low entropy. Try the -p flag to compare PLIO versus Rice for your application, both speed and size.
Without compression of some sort such a mask will be the same size as data image of the same BITPIX. But Rice will squeeze a 32-bit image into the same output size as a 16-bit image containing the same pixel values.
Rob
More information about the fitsbits
mailing list