FITS Format Definition
FITS format, or the "Flexible Image Transport System", is a file format standardized and maintained by NASA that allows data to be transported between systems and interpreted according to exact specifications. A FITS format file consists of a data array (pixel data for an image) and a header containing metadata describing the pixel data and providing other documentation about the file. The FITS header and data follow a rigid structure defined in the standard. It is critical to note that FITS format is a file format, not an image format, as other types of data may be encoded in a FITS file
A FITS format image consists of a human readable and printable text format "header" followed by the image pixel data. The header contains image documentation such as number of rows and columns, the data and time the image was taken, etc. The header is comprised of discrete header records that are each 80 bytes long and contain a specific piece of information such as the number of image rows. There must be an integral number of 80 byte header records in a FITS header, and the total header length must be an integral multiple of 36 records, or 2880 bytes. The END keyword line terminates the header and is followed by blank characters that pad the header to a multiple of 2880 bytes. The pixel data begins on the next 2880 byte boundary after the header. The complete file containing the header and pixel data must be padded with blank characters at its end in order to reach a size that is a multiple of 2880 bytes. These 2880 byte intervals are necessary for storing a FITS image on a blocked medium such as a magnetic tape. FITS also allows super blocks of multiples of 2880 bytes.
All FITS header characters must be in the range of ASCII codes 32 through 126 (hex 0x20 through 0x7e). Mira automatically scans the header and replaces characters outside this range. Some special replacements include 'd' to replace the degrees symbol, and 'k' to replace the Greek beta character. Other values outside this range are replaced with a tilde '~' character.
Each line of the header is called a header record, and has a length of 80 bytes. In the present documentation, a header record unit is often termed a keyword line. The FITS Standard refers to a header record as a "card image", since FITS was developed when keypunched cards were used for data input. A header record consists of the following components:
A keyword, starting in column 1, that identifies the information contained in the header record.
A value, sometimes called the keyword value, beginning in column 10.
An optional slash in column 32 that separates the value from an optional comment.
An optional comment starting in or after column 33 that describes the keyword.
There are other details relating to issues such as the range of columns used for specific types of keyword values, but these will not be addressed here. A typical header record looks similar to the following one:
NAXIS1 = 512 / number of image columns
Beyond the last non-blank character, the remainder of the 80-byte line is padded with blanks (ASCII code 32, or hex 20). The format shown in this NAXIS header record is typical of all FITS keyword lines.
The keyword name, including spaces, is exactly 8 bytes long and is left justified in the 80-byte header record. Except for HISTORY, COMMENT, and <blank> keywords, an equals sign, =, follows in column 9. An optional slash may be placed in column 32. Between columns 9 and 32 is placed the value of the keyword, in this example, the number 512. Notice that the value 512 is right justified with one blank space after. Right justification to column 30 is required for integer, real, and character values, although this detail is sometimes missed by software authors.
Keywords that contain character string data must have a left justified character string enclosed within single quotation marks (') beginning after the ‘=’ sign. The string must also be padded to a minimum length of 8 characters between quotation marks. Character value keywords such as SIMPLE do not use quotation marks, but use a single character such as T (true) or F (false).
Some examples of proper FITS keyword format, omitting comments after the slash, are listed below.
SIMPLE = T NAXIS1 = 512 EXPTIME = 500.0 BSCALE = 1.512E16 / DATE-OBS= '1999-21-05T05:20:45.005' TIME-OBS= '05:20:45.005' / MIRATYPE= '16 bit unsigned' / OBJECT = 'This string requires quotes.' HISTORY This string uses no quotes. COMMENT This string uses no quotes. |
The NAXIS1 keyword used in the example is an essential FITS keyword because it specifies the image dimension in the direction of the most rapidly varying subscript. The term most rapidly varying subscript is intended for those who write computer programs to read and write FITS format. For a 2-D image, the value of NAXIS1 corresponds to the number of columns in the image, which would be 512 columns in the example. The number of image dimensions is specified using the NAXIS keyword, and this would have a value of either 1 or 2 for MIRA compatible images. If the image has 2 dimensions, there must be an NAXIS2 keyword in the header.
The 5 mandatory keywords for every FITS format image are SIMPLE, BITPIX, NAXIS, NAXIS1, and END. The first four keywords define a basic image and the END keyword signifies the end of the header. Note that these 5 keywords total only 400 bytes of header. But since headers are padded to a multiple of 2880 bytes, in this case, the pixel data would start at byte offset 2880.
Mira Pro x64 8.67 User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc.
All Rights Reserved.