Applications Note
This application note describes the file formats used to save ST-4X thru ST-8 images on both the IBM PC and compatible computers and the Macintosh computers. The files contain the image data as well as header information describing the image in terms of exposure time, telescope, etc. The files come in two varieties: Compressed and Uncompressed. In addition the file format has evolved throughout the development of these CCD cameras and has finally settled down to the "Type 3" format described herein.
Type 3 Format
The Type 3 format starts with a 2048 byte header of ASCII information followed by the image data in one of two varieties: Compressed or Uncompressed. The ASCII information for Type 3 files consists of a line showing the type of camera used to acquire the image and the variety of image data (Compressed or Uncompressed) as shown in the example below:
ST-6 Compressed Image<lf><cr>
or
ST-6 Image<lf><cr>
where <lf> and <cr> represent the linefeed (hex 0A) and carriage return (hex 0D) characters. Other camera images replace the "ST-6" with the camera name ("ST-4X", ST-5", "ST-7" or "ST-8") in the lines above respectively. After the 1st line are several lines of parameters in the format:
Parameter = Value<lf><cr>
where "Parameter = " is a string describing the parameter and "Value" is a string containing the value of the parameter. At the end of all the parameters is the line:
End<lf><cr><ctrl-z>
used to signify the end of the of the image information. The <ctrl-z> is used to tell DOS commands like type to stop and not display any further data. The remainder of the 2048 bytes in the header are unused. The parameters for a Type 3 file are shown below in Table 1:
Table 1
Type 3 Parameters
ST-6 Compressed Image File_version = 1 Data_version = 1 Exposure = xxx Focal_length = xx.xxx Aperture = xx.xxx Response_factor = xx.xxx Note = xxxxxxxx Background = xxx Range = xxx Height = xxx Width = xxx Date = xx/xx/xx Time = xx:xx:xx Exposure_state = xx Temperature = xx.xx Number_exposures = xx Each_exposure = xx History = xxxxxx Observer = xxxxxxxx X_pixel_size = xx.xx Y_pixel_size = xx.xx Pedestal =xx E_gain = x.xx
The following parameters are optional and may be present:
User_1 = xxxxxxxx User_2 = xxxxxxxx User_3 = xxxxxxxx User_4 = xxxxxxxx Filter = xxxxxxxx Readout_mode = xx Track_time = xxx Sat_level = xxx End
Table 2 below describes each of the parameters found in the Type 3 header.
Table 2
Parameter Descriptions
@ - Modifications made before history A - Co-addition of image. established. B - Image linearly scaled. D - Image dark subtracted. E - Cool pixels removed. F - Flat field corrected. G - Image smoothed. H - Image sharpened. I - Image pseudo flat field corrected. J - Image quantized or posterized to less than 16 bits precision. K - Warm pixels removed. L - Image flipped horizontally. M - Image flipped vertically. N - Image zoomed with pixel interpolation. O - More than 40 operations performed. P - Image log scaled. Q - Pixels combined. R - Image auto dark subtracted. S - Image zoomed with pixel T - Image clipped and filled replication. (ST6COLOR) U - Image converted to 8 bit log V - Image merged to color using 2 format (ST6COLOR). color merge (ST6COLOR). W - Image merged to color using 3 X - Image translated and back filled color merge (ST6COLOR). (ST6COLOR) Y - Image pixels inverted. Z - Image sharpened with unipolar algorithm. [ - Image sharpened with one-sided \ - Image modernized by replacing sharpening. ST6COLOR history characters1 ] - Image resampled to make square ^ - Image averaged. pixels. _ - Constant added to or subtracted ` - Constant multiplied by or divided from image. into image. 0 - (Zero) The history string is set a - Image enlarged 2X by pixel to '0' for new images. This is interpolation. not a C null string, it is actually the '0' character. b - Image reduced 2X by pixel c - Column or Row repair. combining. d - Adaptive dark subtraction.
Please note the SBIG reserves the use of the characters '@' through '~' (decimal 64 through 126) for their use, and that any other characters added to the history string by other users should not use those characters. [1]
The following fields are optional. They may or may not be present in the header. As the CCDOPS software has evolved these fields have been added to the header a few at a time. If present they will be in the order shown:
Image Compression
Type 3 images can be saved using a simple form of image compression. The image compression consists of saving the differences between adjacent pixels and using single bytes for small differences rather than double bytes.
Each line of compressed image data starts with a two-byte integer (least significant byte first) indicating the compressed length of the line in bytes followed by the compressed image data. The 1st pixel of the actual image data is written using two-bytes and is the actual pixel value. Subsequent pixels are written as follows depending on the difference between that pixel and the previous pixel:
Delta = Pixel(m,n) - Pixel(m, n-1)
If -127 <= Delta <= 127 then write Delta as a single byte in 2's complement format, otherwise write hex 80 (-128) followed by the actual pixel value using two-bytes (least significant byte first).
The last caveat to the compressed image data is that if any line after being compressed has as many or more bytes than if it were stored uncompressed then that line is stored uncompressed with the 2 bytes of length followed by the actual pixel values written using 2-bytes per pixel (least significant byte first).
Note also that the compression algorithm described above used in saving images is similar though different than the compression algorithm used in downloading images from the CPU. You can not simply read a compressed image from the CPU and write it to file, adding a header. You must the CPU data and then compress the file data. This unfortunate consequence stems from the desire to have the CPU compression occur on the fly to keep the image throughput up.
1
The ST6COLOR software used history codes 'S', 'T' and 'V' differently than described in this table. Modernizing replaces 'S' with 'T' (clip operation), 'T' with 'U' (compress operation) and 'U' with 'X' (translate operation).2 All image pixels have a bias of 100
counts added to them to stop underflow due to noise. If you need to flat field correct an
image the pixel value that is due to light is:
Actual Counts = Image Counts - 100 + Pedestal
where Image Counts is what is read from the file and Actual Counts is the light response.
For flat field correcting images you would multiply the Actual Counts by the flat field
correction, not the Image Counts.
Revised: September 23, 1998 01:44:36 PM.
Copyright © 1998 Santa Barbara Instrument Group, Inc. All rights reserved.
Please report any problems with this page directly to the Webmaster