qfitsloader Struct Reference

qfits loader control object. More...

#include <qfits.h>


Data Fields

int _init
char* filename
int xtnum
int pnum
int ptype
int map
int exts
int lx
int ly
int np
int bitpix
int seg_start
int seg_size
double bscale
double bzero
int* ibuf
float* fbuf
double* dbuf


Detailed Description

qfits loader control object.

This structure serves two purposes: input and output for the qfits pixel loading facility. To request pixels from a FITS file, you need to allocate (statically or dynamically) such a structure and fill up the input fields (filename, xtension number, etc.) to specify the pixels you want from the file.

Before performing the actual load, you must pass the initialized structure to qfitsloader_init() which will check whether the operation is feasible or not (check its returned value).

If the operation was deemed feasible, you can proceed to load the pixels, passing the same structure to qfits_loadpix() which will fill up the output fields of the struct. Notice that a pixel buffer will have been allocated (through malloc or mmap) and placed into the structure. You need to call free() on this pointer when you are done with it, typically in the image or cube destructor.

The qfitsloader_init() function is also useful to probe a FITS file for useful informations, like getting the size of images in the file, the pixel depth, or data offset.

Example of a code that prints out various informations about a plane to load, without actually loading it:

int main(int argc, char * argv[])
{
    qfitsloader ql ;

    ql.filename = argv[1] ;
    ql.xtnum    = 0 ;
    ql.pnum     = 0 ;

    if (qfitsloader_init(&ql)!=0) {
        printf("cannot read info about %s\n", argv[1]);
        return -1 ;
    }

    printf( "file         : %s\n"
            "xtnum        : %d\n"
            "pnum         : %d\n"
            "# xtensions  : %d\n"
            "size X       : %d\n"
            "size Y       : %d\n"
            "planes       : %d\n"
            "bitpix       : %d\n"
            "datastart    : %d\n"
            "datasize     : %d\n"
            "bscale       : %g\n"
            "bzero        : %g\n",
            ql.filename,
            ql.xtnum,
            ql.pnum,
            ql.exts,
            ql.lx,
            ql.ly,
            ql.np,
            ql.bitpix,
            ql.seg_start,
            ql.seg_size,
            ql.bscale,
            ql.bzero);
    return 0 ;
}


Field Documentation

int qfitsloader::_init
 

Private field to see if structure has been initialized

int qfitsloader::bitpix
 

output: BITPIX for this extension

double qfitsloader::bscale
 

output: BSCALE found for this extension

double qfitsloader::bzero
 

output: BZERO found for this extension

double * qfitsloader::dbuf
 

output: Pointer to pixel buffer loaded as double values

int qfitsloader::exts
 

output: Total number of extensions found in file

float * qfitsloader::fbuf
 

output: Pointer to pixel buffer loaded as float values

char * qfitsloader::filename
 

input: Name of the file you want to read pixels from

int * qfitsloader::ibuf
 

output: Pointer to pixel buffer loaded as integer values

int qfitsloader::lx
 

output: Size in X of the requested plane

int qfitsloader::ly
 

output: Size in Y of the requested plane

int qfitsloader::map
 

input: Guarantee file copy or allow file mapping

int qfitsloader::np
 

output: Number of planes present in this extension

int qfitsloader::pnum
 

input: Index of the plane you want, from 0 to np-1

int qfitsloader::ptype
 

input: Pixel type you want (PTYPE_FLOAT, PTYPE_INT or PTYPE_DOUBLE)

int qfitsloader::seg_size
 

output: Size of the data segment (in bytes) for your request

int qfitsloader::seg_start
 

output: Start of the data segment (in bytes) for your request

int qfitsloader::xtnum
 

input: xtension number you want to read


The documentation for this struct was generated from the following file: