Get row(s) of an image
#include <funtools.h>
void *FunImageRowGet(Fun fun, void *buf, int rstart, int rstop, char *plist)
The FunImageRowGet() routine returns one or more image rows from the specified section of a Funtools data file. If the input data are of type image, the array is generated by extracting the specified image rows and then binning them according to the specified bin factor. If the input data are contained in a binary table or raw event file, the rows are binned on the columns specified by the bincols= keyword (using appropriate default columns as needed), after which the image section and bin factors are applied.
The first argument is the Funtools handle returned by FunOpen(). The second buf argument is a pointer to a data buffer to fill. If \s-1NULL\s0 is specified, FunImageGet() will allocate a buffer of the appropriate size.
The third and fourth arguments specify the first and last row to retrieve. Rows are counted starting from 1, up to the value of \s-1FUN_YMAX\s0(fun). The final plist (i.e., parameter list) argument is a string containing one or more comma-delimited keyword=value parameters. It can be used to specify the return data type using the bitpix= keyword. If no such keyword is specified in the plist string, the data type of the image is the same as the data type of the original input file, or is of type int for \s-1FITS\s0 binary tables.
If the bitpix=value is supplied in the plist string, the data type of the returned image will be one of the supported \s-1FITS\s0 image data types:
8 unsigned char
16 short
32 int
\-32 float
\-64 double
For example:
double *drow; Fun fun; ... open files ... /* get section dimensions */ FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0); /* allocate one line's worth */ drow = malloc(dim1*sizeof(double)); /* retrieve and process each input row (starting at 1) */ for(i=1; i <= dim2; i++){ if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") ) gerror(stderr, "can't FunImageRowGet: %d %s\n", i, iname); /* reverse the line */ for(j=1; j<=dim1; j++){ ... process drow[j-1] ... } } ...
On success, a pointer to the image buffer is returned. (This will be the same as the second argument, if \s-1NULL\s0 is not passed to the latter.) On error, \s-1NULL\s0 is returned. Note that the considerations described above for specifying binning columns in FunImageGet() also apply to FunImageRowGet().
See funtools(7) for a list of Funtools help pages