61 #define PRINT_USAGE(rc) \
62 fprintf(stderr, "Usage: %s [ -s startidx ] [ -c count ] PIXTABLE\n", \
64 cpl_end(); return (rc);
66 int main(
int argc,
char **argv)
68 cpl_init(CPL_INIT_DEFAULT);
76 cpl_size start = 0, count = CPL_SIZE_MAX;
80 for (i = 1; i < argc; i++) {
81 if (strncmp(argv[i],
"-s", 3) == 0) {
85 start = atol(argv[i]);
89 }
else if (strncmp(argv[i],
"-c", 3) == 0) {
93 count = atol(argv[i]);
97 }
else if (strncmp(argv[i],
"-", 1) == 0) {
105 cpl_msg_set_level(CPL_MSG_WARNING);
111 if (count == CPL_SIZE_MAX) {
115 cpl_propertylist *theader = cpl_propertylist_load(tname, 1);
116 cpl_size nrow = cpl_propertylist_get_long_long(theader,
"NAXIS2");
117 cpl_propertylist_delete(theader);
119 printf(
"# MUSE pixel table \"%s\", showing %"CPL_SIZE_FORMAT
" rows starting "
120 "at index %"CPL_SIZE_FORMAT
" of %"CPL_SIZE_FORMAT
"\n", tname, count,
127 case CPL_ERROR_BAD_FILE_FORMAT:
128 fprintf(stderr,
"%s: \"%s\" does not seem to contain a MUSE pixel table!\n",
132 case CPL_ERROR_ILLEGAL_INPUT:
133 fprintf(stderr,
"%s: Illegal data range given (start index=%"CPL_SIZE_FORMAT
134 " count=%"CPL_SIZE_FORMAT
") for table with %"CPL_SIZE_FORMAT
cpl_size muse_pixtable_get_nrow(const muse_pixtable *aPixtable)
get the number of rows within the pixel table
cpl_error_code muse_pixtable_dump(muse_pixtable *aPixtable, cpl_size aStart, cpl_size aCount, unsigned char aDisplayHeader)
Dump a MUSE pixel table to the screen, resolving the origin column.
Structure definition of MUSE pixel table.
muse_pixtable * muse_pixtable_load_window(const char *aFilename, cpl_size aStart, cpl_size aNRows)
Load a range of rows from the table and all the FITS headers of a MUSE pixel table from a file...
void muse_pixtable_delete(muse_pixtable *aPixtable)
Deallocate memory associated to a pixel table object.