Pixel loader for FITS images.


Functions

int qfitsloader_init (qfitsloader *ql)
 Initialize a qfitsloader control object.
int qfits_loadpix (qfitsloader *ql)
 Load a pixel buffer for one complete image.
int qfits_loadpix_window (qfitsloader *ql, int llx, int lly, int urx, int ury)
 Load a pixel buffer for one image window.
int qfits_pixdump (qfitsdumper *qd)
 Dump a pixel buffer to an output FITS file in append mode.

Function Documentation

int qfits_loadpix qfitsloader *  ql  ) 
 

Load a pixel buffer for one complete image.

Parameters:
ql Allocated and initialized qfitsloader control object.
Returns:
int 0 if Ok, -1 if error occurred.
See also:
qfits_loadpix_window

int qfits_loadpix_window qfitsloader *  ql,
int  llx,
int  lly,
int  urx,
int  ury
 

Load a pixel buffer for one image window.

Parameters:
ql Allocated and initialized qfitsloader control object.
llx 
lly Position of the window (start with (1,1))
urx 
ury 
Returns:
int 0 if Ok, -1 if error occurred.
This function performs a load of a pixel buffer into memory. It expects an allocated and initialized qfitsloader object in input. See qfitsloader_init() about initializing the object.

This function will fill up the ibuf/fbuf/dbuf field, depending on the requested pixel type (resp. int, float or double).

If llx lly urx and ury do not specify the whole image, ql->map must be 0, we do not want to mmap a file an load only a part of it.

int qfits_pixdump qfitsdumper *  qd  ) 
 

Dump a pixel buffer to an output FITS file in append mode.

Parameters:
qd qfitsdumper control object.
Returns:
int 0 if Ok, -1 otherwise.
This function takes in input a qfitsdumper control object. This object must be allocated beforehand and contain valid references to the data to save, and how to save it.

The minimum fields to fill are:

  • filename: Name of the FITS file to dump to.
  • npix: Number of pixels in the buffer to be dumped.
  • ptype: Type of the passed buffer (PTYPE_FLOAT, PTYPE_INT, PTYPE_DOUBLE)
  • out_ptype: Requested FITS BITPIX for the output.

One of the following fields must point to the corresponding pixel buffer:

  • ibuf for an int pixel buffer (ptype=PTYPE_INT)
  • fbuf for a float pixel buffer (ptype=PTYPE_FLOAT)
  • dbuf for a double pixel buffer (ptype=PTYPE_DOUBLE)

This is a fairly low-level function, in the sense that it does not check that the output file already contains a proper header or even that the file it is appending to is indeed a FITS file. It will convert the pixel buffer to the requested BITPIX type and append the data to the file, without padding with zeros. See qfits_zeropad() about padding.

If the given output file name is "STDOUT" (all caps), the dump will be performed to stdout.

int qfitsloader_init qfitsloader *  ql  ) 
 

Initialize a qfitsloader control object.

Parameters:
ql qfitsloader object to initialize.
Returns:
int 0 if Ok, -1 if error occurred.
This function expects a qfitsloader object with a number of input fields correctly filled in. The minimum fields to set are:

  • filename: Name of the file to examine.
  • xtnum: Extension number to examine (0 for main section).
  • pnum: Plane number in the requested extension.
  • map : loading mode - flag to know if the file has to be mapped

You can go ahead with these fields only if you only want to get file information for this plane in this extension. If you want to later load the plane, you must additionally fill the 'ptype' field to a correct value (PTYPE_INT, PTYPE_FLOAT, PTYPE_DOUBLE) before calling qfits_loadpix() so that it knows which conversion to perform.

This function is basically a probe sent on a FITS file to ask qfits if loading these data would be Ok or not. The actual loading is performed by qfits_loadpix() afterwards.