These routines read or write data values in the primary data array (i.e., the first HDU in a FITS file) or an IMAGE extension. There are also routines to get information about the data type and size of the image. Users should also read the following chapter on the CFITSIO iterator function which provides a more `object oriented' method of reading and writing images. The iterator function is a little more complicated to use, but the advantages are that it usually takes less code to perform the same operation, and the resulting program oftens runs faster because the FITS files are read and written using the most efficient block size.
C programmers should note that the ordering of arrays in FITS files, and hence in all the CFITSIO calls, is more similar to the dimensionality of arrays in Fortran rather than C. For instance if a FITS image has NAXIS1 = 100 and NAXIS2 = 50, then a 2-D array just large enough to hold the image should be declared as array[50][100] and not as array[100][50].
The `datatype' parameter specifies the datatype of the `nulval' and `array' pointers and can have one of the following values: TBYTE, TSHORT, TUSHORT, TINT, TUINT, TLONG, TLONGLONG, TULONG, TFLOAT, TDOUBLE. Automatic data type conversion is performed if the data type of the FITS array (as defined by the BITPIX keyword) differs from that specified by 'datatype'. The data values are also automatically scaled by the BSCALE and BZERO keyword values as they are being read or written in the FITS array.
int fits_get_img_type / ffgidt
(fitsfile *fptr, > int *bitpix, int *status)
int fits_get_img_dim / ffgidm
(fitsfile *fptr, > int *naxis, int *status)
int fits_get_img_size / ffgisz
(fitsfile *fptr, int maxdim, > long *naxes, int *status)
int fits_get_img_param / ffgipr
(fitsfile *fptr, int maxdim, > int *bitpix, int *naxis, long *naxes,
int *status)
int fits_create_img / ffcrim
( fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status)
int fits_write_subset / ffpss
(fitsfile *fptr, int datatype, long *fpixel, long *lpixel,
DTYPE *array, > int *status)
int fits_write_pix / ffppx
(fitsfile *fptr, int datatype, long *fpixel, long nelements,
DTYPE *array, int *status);
int fits_write_pixnull / ffppxn
(fitsfile *fptr, int datatype, long *fpixel, long nelements,
DTYPE *array, DTYPE *nulval, > int *status);
int fits_write_null_img / ffpprn
(fitsfile *fptr, long firstelem, long nelements, > int *status)
int fits_read_subset / ffgsv
(fitsfile *fptr, int datatype, long *fpixel, long *lpixel, long *inc,
DTYPE *nulval, > DTYPE *array, int *anynul, int *status)
The first routine will return any undefined pixels in the FITS array equal to the value of *nullval (note that this parameter gives the address of the null value, not the null value itself) unless nulval = 0 or *nulval = 0, in which case no checks for undefined pixels will be performed. The second routine is similar except that any undefined pixels will have the corresponding nullarray element set equal to TRUE.
int fits_read_pix / ffgpxv
(fitsfile *fptr, int datatype, long *fpixel, long nelements,
DTYPE *nulval, > DTYPE *array, int *anynul, int *status)
int fits_read_pixnull / ffgpxf
(fitsfile *fptr, int datatype, long *fpixel, long nelements,
> DTYPE *array, char *nullarray, int *anynul, int *status)