FITS

Also Known As: Flexible Image Transport System, FTI


Type General data format
Colors Unlimited gray scale
Compression Uncompressed
Maximum Image Size NA
Multiple Images Per File Yes
Numerical Format Two's complement/big-endian
Originator NOST
Platform All
Supporting Applications

FITSview, IMDISP, xv, pbmplus, SAOImage

See Also VICAR2, PDS

Usage
FITS is a general-purpose data storage format used primarily for the interchange of data between hardware platforms and software applications.

Comments
FITS is the standard image data storage format for many astronomical organizations, including the astrophysics branch of NASA.

Vendor specifications are available for this format.

Code fragments are available for this format.

Sample images are available for this format.


The FITS image file format is used primarily as a method of exchanging bitmap data between different hardware platforms and software applications that do not support a common image file format. FITS is used mostly by scientific organizations and government agencies that require the storage of astronomical image data (e.g., image data returned by orbital satellites, manned spacecraft, and planetary probes) and ground-based image data (e.g., data obtained from CCD imagery, radio astronomy, and digitized photographic plates).

Contents:
File Organization
File Details
For Further Information

Although the I in FITS stands for Image, FITS is actually a general-purpose data interchange format. In fact, there is nothing in the FITS specification that limits its use to bitmapped image data.

FITS was originally designed explicitly to facilitate the interchange of data between different hardware platforms, rather than between software applications. Much of the FITS data in existence today is (and traditionally, always has been) ground-based and most, if not all, of the agencies and organizations requiring the use of FITS are astronomical in nature.

FITS was originally created by Eric Greisen, Don Wells, Ron Harten, and P. Grosbol and described in a series of papers published in the journal Astronomy & Astrophysics Supplement. The NASA/OSSA Office of Standards and Technology (NOST) codified FITS by consolidating these papers into a draft standard of a format for the interchange of astronomical data between scientific organizations. Many such organizations use proprietary imaging software and image file formats not supported by other organizations. FITS, along with VICAR2 and PDS, became a standard interchange format that allows the successful exchange of image data.

FITS is supported by all astronomical image processing facilities and astrophysics data archives. Much of the solar, lunar, and planetary data that is retrieved by the Astrophysics branch of the National Aeronautics and Space Administration (NASA) is distributed using the FITS file format. FITS is currently maintained by a Working Group of the International Astronomical Union (IAU).

Image data normally is converted to FITS not to be stored, but to be imported into another image processing system. Astronomical image data is generally stored in another format, such as the VICAR2 (Video Image Communication and Retrieval) format used by the Multi-Mission Image Processing Laboratory (MIPL).

FITS itself is a very general format capable of storing many types of data, including bitmaps, ASCII text, multidimensional matrices, and binary tables. The simplest FITS file contains a header and a single data stream, called a multidimensional binary array. This is the type of FITS image file we will be examining in this article.

File Organization

In FITS terminology, a basic FITS file contains a primary header and single primary data array. This data structure is known collectively as a Header and Data Unit (HDU). An HDU may contain a header followed by data records, or may contain only a header. All data in a FITS file is organized into logical records 2880 bytes in length.

Basically, a FITS file is a header, normally followed by a data stream. Every FITS file begins with an ASCII header which contains one or more logical records. Each logical record is 2880 bytes in size. The last logical record in the header must be padded to 2880 bytes with spaces (ASCII 32).

Each logical record contains 36 records, called card images. A card image is a logical field similar to a data field in a binary image file header. Each card image contains 80 bytes of ASCII data, which describes some aspect of the organization of the FITS image file data. Card images are padded with spaces when necessary to fill out the 80 bytes and do not have delimiters. Card images that are not needed for the storage of a particular set of data contain only spaces.

Most card images may appear in any order within the header, with a few exceptions. The SIMPLE card image must always be first, followed by BITPIX second, NAXIS third, and END last.

Every card image has the following syntax:

keyword = value /comment

keyword is a 1- to 8-character, left-justified ASCII string that specifies the format and use of the data stored in the card image. If a keyword contains fewer than eight characters, it is padded with spaces. A keyword always occupies columns one through eight in a card image. Only uppercase alphanumerics, hyphens (-), and underscores (_) may be used as characters in a keyword. No lowercase characters, other punctuation, or control codes may be used. If a card image does not have a keyword (the keyword is all spaces), then the card image is treated as a comment.

If the keyword has an associated value, it is then followed by a two-character value indicator (=). This indicator always occupies columns nine and ten in the card image, and if it is present, a value follows the keyword. If the keyword does not have an associated value, then any other ASCII characters may appear in place of the value indicator.

value is an ASCII representation of the numerical or string data associated with the keyword. The value is an ASCII representation of boolean, string, integer, or real (floating-point) data.

comment is an optional field which may follow any value within a card image. A comment is separated from the value by a slash (/) or a space and a slash (/); the latter is recommended. A comment may contain any ASCII characters.

The data in a card image is stored in specific columns. For example, the keyword identifier always occupies columns one through seven in a card image. The keyword value indicator, if present, always occupies columns eight and nine. A boolean value always occupies column 30. And a complex-integer value always occupies columns 31 through 50. Columns that do not contain data are filled with spaces.

Character strings are contained within single quotes. If a string contains a single quote, then it is represented by two consecutive single quotes (`O'Reilly' becomes `O''Reilly'). All strings contain only 7-bit ASCII values and must be at least eight characters in length, padded with spaces, if necessary. Strings may contain a maximum of 68 characters. Strings may begin with leading spaces, but trailing spaces are considered padding.

All boolean, integer, and floating-point values are represented by their ASCII string equivalents. Boolean variables are represented by the value T or F and are always found in column 30 of the card image. Integer and floating-point values are located in columns 11 through 30 and are right-justified with spaces, if necessary. Complex integers and complex floating-point values are located in columns 31 through 50 and are also right-justified when necessary. All letters used in exponential forms are uppercase.

Examples of valid values are shown below.

Name

Size in Bits

Example

ASCII character

8

`Saturn'

Integer

Unsigned, one byte

8

127

Unsigned, two bytes

16

32767

Unsigned, four bytes

32

1451342181

Single-precision real

Fixed-point notation

32

3.14159

Exponential notation

32

0.314159E+01

Double-precision real

Exponential notation

64

0.3141592653525D+01

File Details

This section describes FITS headers and image data.

Keywords

There are many keywords that may be included in FITS headers, and it is unlikely that any FITS reader will understand them all (unrecognized keywords are treated as comments by FITS readers). There are five keywords that are required in every FITS file: SIMPLE, BITPIX, NAXIS, NAXISn, and END. (EXTEND is also a required keyword if extensions are present in the file.) These mandatory keywords are described below:

SIMPLE

The SIMPLE keyword always appears first in any FITS header. The value of this keyword is a boolean value indicating the conformance level of the file to the FITS specification. If the file conforms to the FITS standard, this value is T. If the value is F, then the file differs in some way from the requirements specified in the FITS standard.

BITPIX

The BITPIX card image contains an integer value which specifies the number of bits used to represent each data value. For image data, this is the number of bits per pixel.

BITPIX Value

Data

8

Character or unsigned binary integer

16

16-bit two's complement binary integer

32

32-bit two's complement binary integer

-32

32-bit floating point, single precision

-64

64-bit floating point, double precision

NAXIS

The NAXIS card image contains an integer value in the range of 0 to 999, indicating the number of axes in the data array. Conventional bitmaps have an NAXIS value of 2. A value of 0 signifies that no data follows the header, although an extension may be present.

NAXISn

The NAXISn card image indicates the length of each axis in BITPIX units. No NAXISn card images are present if the NAXIS value is 0. The value field of this indexed keyword contains a non-negative integer, representing the number of positions along axis n of an ordinary data array. The NAXISn card image must be present for all values n = 1,..., NAXIS. A value of 0 for any of the NAXISn card images signifies that no data follows the header in the HDU. If NAXIS is equal to 0, there should not be any NAXISn keywords.

EXTEND

The EXTEND card image may be included if there are extensions in the FITS file. If there are no extensions, there are no EXTEND card images.

END

The END keyword indicates the end of the header and is always the last card image in a header. END has no value. The card image contains spaces in columns 9 though 80 and is padded out with spaces so that the length of the header is a multiple of 2880 bytes.

Sample Header

The header of a basic FITS image file might appear as follows (the first two lines are for positional information only and are not included in the FITS file):

         1         2         3         4         5         6         7
1234567890123456789012345678901234567890123456789012345678901234567890123456
SIMPLE  =                    T
BITPIX  =                    8/ 8 bits per pixel
NAXIS   =                    2/ Table is a 2D matrix
NAXIS1  =                  168/ Width of table row in bytes
NAXIS2  =                    5/ Number of rows in table
DATE    = '09/17/93'
ORIGIN  = 'O''Reilly & Associates'/ Publisher
AUTHOR  = 'James D. Murray'/ Creator
REFERENC= 'Graphics File Formats'/ Where referenced
COMMENT = 'Sample FITS header'
END

For a description of all other valid FITS header keywords, refer to the FITS specification.

FITS Image Data

Immediately following the header is the binary image data. This data is stored in 8-bit bytes and is currently never compressed. At the time of this writing, an extension to the FITS standard has been proposed to the FITS community, so future revisions to the FITS standard may incorporate data compression.

The presence or absence of a primary data array is indicated by the values of either the NAXIS or the NAXISn keyword in the primary header.

Data in a FITS file may be stored as bytes, 16- or 32-bit words, and 32- or 64-bit floating-point values that conform to the ANSI/IEEE-754 standard. Fill (ASCII 00h) is added to the data to pad the data out to end on a 2880-byte boundary.

The number of bits of image data, not including the padding added to the end of the image data, may be calculated from the BITPIX, NAXIS, and NAXISn card image values:

NumberOfBits = BITBIX * (NAXIS1 * NAXIS2 *...* NAXIS[NAXIS])

For Further Information

The specification for FITS is contained in the NOST document included on the CD-ROM:

Implementation of the Flexible Image Transport System (FITS), Draft Implementation Standard NOST 100-0.3b., December 1991.

A tutorial and historical guide to FITS is included in the following document, also on the CD-ROM:

A User's Guide for FITS, January 1993.

Both of these documents are also available from the NASA/OSSA Office of Standards and Technology (NOST) FITS Support Office:

NASA/OSSA Office of Standards and Technology
Code 633.2
Goddard Space Flight Center
Greenbelt, MD 20771
Voice: 301-441-4189
Voice: 301-513-1634
Email: nost@nssdca.gsfc.nasa.gov
Email: fits@nssdca.gsfc.nasa.gov
WWW: http://www.gsfc.nasa.gov/astro/fits/fits_home.htm

The FITS standard is also described in the following references, known collectively as the "Four FITS Papers:"

Wells, D.C., E.W. Greisen, and R.H. Harten, "FITS: a flexible image transport system," Astronomy and Astrophysics Supplement Series, vol. 44, 1981, pp. 363-370.

Greisen, E.W. and R.H. Harten, "An extension of FITS for small arrays of data," Astronomy and Astrophysics Supplement Series, vol. 44, 1981, pp. 371-374.

Grosbol, P., R.H. Harten, E.W. Greisen, and D.C. Wells, "Generalized extensions and blocking factors for FITS," Astronomy and Astrophysics Supplement Series, vol. 73, 1988, pp. 359-364.

Harten, R.H., P. Grosbol, E.W. Greisen, and D.C. Wells, "The FITS tables extension," Astronomy and Astrophysics Supplement Series, vol. 73, 1988, pp. 365-372.

Updated information on FITS, including new software applications, frequently appears on the USENET newsgroups sci.astro.fits and sci.data.formats. Additional software and information on FITS may also be obtained from the following FTP sites:

ftp://fits.cv.nrao.edu/FITS/
ftp://ames.arc.nasa.gov/pub/SPACE/SOFTWARE/
ftp://hypatia.gsfc.nasa.gov/pub/software/

You will find the sci.data FAQ at:

http://fits.cv.nrao.edu/traffic/scidataformats/faq.htm#fits

You can find FITS images at:

http://astrosun.tn.cornell.edu/FITS.htm

FITS is also one of the primary responsibilities of the Working Group on Astronomical Software (WGAS) of the American Astronomical Society. The North American FITS Committee (Dr. Robert J. Hanisch at Space Telescope Science Institute is the chairman) is appointed under the auspices of the WGAS. The WGAS also has a list server, which may be reached by sending a mail message to the following for information on the WGAS mail exploder:

listserv@hypatia.gsfc.nasa.gov

Several programs on the CD-ROM display FITS images.

The NSSDC Coordinated Request and Support Office (CRUSO) will provide IMDISP on floppy for a nominal fee. Contact them at:

Voice: 301-286-6695
Email: request@nssdc.gsfc.nasa.gov

The FITSIO package contains a collection of subroutines for reading and writing data in the FITS format. This library supports most machines, including Sun, VAX/VMS, Amiga, and the IBM PC and mainframes. It is available via FTP from:

ftp://tetra.gsfc.nasa.gov/pub/fitsio/



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.

Hosted by uCoz