next up previous contents
Next: 4. Getting Keyword Values Up: CFHT FITS Handling Library Previous: 2. Opening, Locking, Closing   Contents

Subsections

3. Examining Extensions and Image Data

3.1 fh_ehu()

Use this only if you are making a program which loops through all extensions (see example fhextname.c). In all other cases, you should refer to extensions by IMAGEID or EXTNAME using on of the following two functions:

3.2 fh_ehu_by_imageid()

Returns a HeaderUnit which contains a matching IMAGEID keyword and seeks the file to the start of the data for that extension.

If no matching IMAGEID is found, 0 is returned.

3.3 fh_ehu_by_extname()

Returns a HeaderUnit which contains a matching EXTNAME keyword and seeks the file to the start of the data for that extension.

If no matching EXTNAME is found, 0 is returned.

3.4 fh_extensions()

If no EXTEND keyword is found, or if it is not set to T(rue) then 0 is returned. Otherwise the value of the NEXTEND keyword is returned. Use this to test if you have a mutli-extension FITS file.

3.5 fh_image_bytes()

This returns the expected unpadded image size in bytes. It must be called after valid BITPIX and NAXIS* values have been set. Here is the formula used to obtain the image size in bytes:

$NAXIS1 \times NAXIS2 \times . . . \times BytesPerPixel$

Where $BytesPerPixel$ is 1 for BITPIX=8, 2 for BITPIX=16, 4 for BITPIX=+/-32, and 8 for BITPIX=-64.

3.6 fh_image_blocks()

This returns the following:

$( fh\_image\_bytes() + 2880 - 1 ) / 2880$

3.7 fh_header_blocks()

This returns the number of 2880-byte blocks fh_write() or fh_rewrite() will need for the header.


next up previous contents
Next: 4. Getting Keyword Values Up: CFHT FITS Handling Library Previous: 2. Opening, Locking, Closing   Contents
Sidik Isani
2001-04-22