From: newberry@aquarius.as.arizona.edu (Mike Newberry)
Newsgroups: sci.astro
Subject: Re: st6 images wanted
Date: 23 Nov 92 21:50:25 GMT
Organization: University of Arizona, Tucson, AZ

In article <1992Nov19.225316.24612@nrao.edu> cflatter@nrao.edu writes:
>In article 6479@organpipe.uug.arizona.edu, newberry@kepler.as.arizona.edu (Mike Newberry) writes:
>>Skip the first 2880 bytes of the file, as this contains the file information
>>"header" in FITS format. Starting at byte offset 2880 will be found binary,
>>uncompressed, unpadded pixel data. The pixels are unsigned 16-bit integers,
>                                                   ^^^^^^^^^^^^^^^^^^^^^^^^
>>so watch out if unsigned integers might choke your software--these images do
>>have values above 32767. To turn this binary raster file into a 2-dimensional
>>image, note that there are 375 2-byte pixels in each row. There are 242 rows.
>
>If this description is accurate the files do not conform to accepted FITS
>standards.  Either 16-bit integers are twos complement or SIMPLE = F.
>
>	Chris Flatters
>	cflatter@nrao.edu

Absolutely, Chris.  I don't know how many images you've seen lately coming
out of CCD systems at major observatories, but images with values above
32767 in short integer format and the header flag SIMPLE='T' are typical.
They do not conform to FITS standards.  On the other hand, since 16 bit A/D
converters are the de facto standard for professional CCD cameras as well as
for many used by amateurs these days, you'll have to get used to seeing
16 bit unsigned pixels. I've complained about the problem and tried holding
out on writing software that would accomodate it. The problem is that people
who write the CCD controller software refuse to chop values above 32767 and
allow their "WFITS" programs to write files or tapes that have SIMPLE='T',
thereby assuming that the image processing software will know how to deal
with it. If observers want to keep pixels in short integer format throughout
data reduction to save disk space and provide much faster processing speed,
then they will need to allow for the negative values given by signed integers.
With unsigned integer data, they'll either have to live with big negative
holes in the centers of bright images or they will have to manually chop
their pixels values at 32767 anyway! Since real world images must allow for
negative intensity, the founding fathers of FITS, Wells and Griesen, made
the right decision in allowing only for signed integers for 2-byte pixels.
However, the world hasn't followed the rules. 

To accomodate this ambiguity with 2-byte integers, we have a flag for
specifying unsigned integer data in the "read FITS file" function of MIRA.
This is better than forcing people to write their data using SIMPLE='F'.
Recall that setting SIMPLE='F' doesn't then tell the FITS translator
specifically what in the heck is wrong with the image format. For this
reason, it is better, I think, to simply allow the user to use SIMPLE='T'
and then specify with a flag that their images contain unsigned 16 bit
integers. The reader can then chop the values at 32767 to get the pixels
into the domain of signed integers. This is an issue I had planned on
bringing up at the FITS committee meeting at the AAS in January.

It would make life easy again if people would use only 15 bits of their
16 bit A/D converts, but that doesn't seem to be in the cards yet.

Mike Newberry
Axiom Research, Inc.
.
Newsgroups: sci.astro