funimagerowget(3)

πŸ’– funimagerowget(3) πŸ’–

okay bestie, gather round, because this one is from SAORD Documentation and it's literally about pulling rows out of an image like it's nothing. sit with me. 🫢


✨ NAME ✨

FunImageRowGet β€” get row(s) of an image 🌈


πŸŽ€ SYNOPSIS πŸŽ€

#include <funtools.h>

void *FunImageRowGet(Fun fun, void *buf, int rstart, int rstop,
                     char *plist)

πŸ’… DESCRIPTION πŸ’…

so the FunImageRowGet() routine hands you back one or more image rows from the section you specified in a Funtools data file. that's the whole vibe. ✨

now here's the tea on how it builds that array, because it depends on what you fed it:

  • if your input data are of type image, the array gets generated by extracting the specified image rows and then binning them according to the specified bin factor. cute, simple. πŸ’–
  • if your input data live in a binary table or a raw event file, then the rows get binned on the columns specified by the bincols= keyword (using appropriate default columns as needed) β€” and after all that, the image section and bin factors get applied. periodt. πŸ‘‘

let's go through the arguments one by one, no skipping:

  • the first argument is the Funtools handle that FunOpen() gave you. that's your ticket. 🎟️
  • the second buf argument is a pointer to a data buffer to fill. and if you pass NULL? iconic behaviour, honestly β€” FunImageGet() will allocate a buffer of the appropriate size for you. no cap. πŸ’«
  • the third and fourth arguments specify the first and last row to retrieve. and listen: rows are counted starting from 1, all the way up to the value of FUN_YMAX(fun). don't be out here counting from zero, bestie, it's not that kind of party. πŸ™ˆ
  • the final plist (i.e., parameter list) argument is a string containing one or more comma-delimited keyword=value parameters. you can use it to specify the return data type with the bitpix= keyword. and if you don't put that keyword in the plist string? then the data type of the image is the same as the data type of the original input file β€” or it's of type int for FITS binary tables. that's just how it is. πŸ’

so if you do supply bitpix=value in the plist string, the data type of the returned image will be one of the supported FITS image data types:

  • 8 unsigned char
  • 16 short
  • 32 int
  • -32 float
  • -64 double

here's an example, and yes it's giving main character energy:

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] ...
    }
}
...
ok now the return value, and this part matters: on success, a pointer to the image buffer is returned. (and yes, that will be the same as the second argument, if you didn't pass NULL to the latter. see how it all comes back around? πŸ¦‹) on error, NULL is returned. 😭

and one last thing, don't scroll past this: note that the considerations described above for specifying binning columns in FunImageGet() also apply to FunImageRowGet(). so if you already know that lore, you're set. iykyk. πŸ’œ


🌸 SEE ALSO 🌸

see funtools(7) for a list of Funtools help pages 🧚


mwah, that's the whole page, bestie πŸ’– this was version 1.4.5, dated April 14, 2011 β€” go forth and get those rows, you absolute icon πŸ‘‘βœ¨