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 often 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 data type of the `nulval' and `array' pointers and can have one of the following values: TBYTE, TSBYTE, TSHORT, TUSHORT, TINT, TUINT, TLONG, TLONGLONG, TULONG, TULONGLONG, 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_equivtype / ffgiet (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_sizell / ffgiszll (fitsfile *fptr, int maxdim, > LONGLONG *naxes, int *status) int fits_get_img_param / ffgipr (fitsfile *fptr, int maxdim, > int *bitpix, int *naxis, long *naxes, int *status) int fits_get_img_paramll / ffgiprll (fitsfile *fptr, int maxdim, > int *bitpix, int *naxis, LONGLONG *naxes, int *status)
int fits_create_img / ffcrim ( fitsfile *fptr, int bitpix, int naxis, long *naxes, > int *status) int fits_create_imgll / ffcrimll ( fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, > int *status)
The 'cell2image' routine will append a new image extension (or primary array) to the output file. Any WCS keywords associated with the input column image will be translated into the appropriate form for an image extension. Any other keywords in the table header that are not specifically related to defining the binary table structure or to other columns in the table will also be copied to the header of the output image.
The 'image2cell' routine will copy the input image into the specified row and column of the current binary table in the output file. The binary table HDU must exist before calling this routine, but it may be empty, with no rows or columns of data. The specified column (and row) will be created if it does not already exist. The 'copykeyflag' parameter controls which keywords are copied from the input image to the header of the output table: 0 = no keywords will be copied, 1 = all keywords will be copied (except those keywords that would be invalid in the table header), and 2 = copy only the WCS keywords.
int fits_copy_cell2image (fitsfile *infptr, fitsfile *outfptr, char *colname, long rownum, > int *status) int fits_copy_image2cell (fitsfile *infptr, fitsfile *outfptr, char *colname, long rownum, int copykeyflag > 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, LONGLONG nelements, DTYPE *array, int *status); int fits_write_pixll / ffppxll (fitsfile *fptr, int datatype, LONGLONG *fpixel, LONGLONG nelements, DTYPE *array, int *status); int fits_write_pixnull / ffppxn (fitsfile *fptr, int datatype, long *fpixel, LONGLONG nelements, DTYPE *array, DTYPE *nulval, > int *status); int fits_write_pixnullll / ffppxnll (fitsfile *fptr, int datatype, LONGLONG *fpixel, LONGLONG nelements, DTYPE *array, DTYPE *nulval, > int *status);
int fits_write_null_img / ffpprn (fitsfile *fptr, LONGLONG firstelem, LONGLONG 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 2 routines 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 2 routines are similar except that any undefined pixels will have the corresponding nullarray element set equal to TRUE (= 1).
int fits_read_pix / ffgpxv (fitsfile *fptr, int datatype, long *fpixel, LONGLONG nelements, DTYPE *nulval, > DTYPE *array, int *anynul, int *status) int fits_read_pixll / ffgpxvll (fitsfile *fptr, int datatype, LONGLONG *fpixel, LONGLONG nelements, DTYPE *nulval, > DTYPE *array, int *anynul, int *status) int fits_read_pixnull / ffgpxf (fitsfile *fptr, int datatype, long *fpixel, LONGLONG nelements, > DTYPE *array, char *nullarray, int *anynul, int *status) int fits_read_pixnullll / ffgpxfll (fitsfile *fptr, int datatype, LONGLONG *fpixel, LONGLONG nelements, > DTYPE *array, char *nullarray, int *anynul, int *status)
int fits_copy_image_section / ffcpimg (fitsfile *infptr, fitsfile *outfptr, char *section, int *status)