IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39690


Ignore:
Timestamp:
Sep 11, 2016, 2:36:59 PM (10 years ago)
Author:
eugene
Message:

allow user to specify keyword to define Nx,Ny for the image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20160809/Ohana/src/opihi/dvo/imbox.c

    r37807 r39690  
    1515
    1616  if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE;
     17
     18  char *xaxis = NULL;
     19  if ((N = get_argument (argc, argv, "-xaxis"))) {
     20    remove_argument (N, &argc, argv);
     21    xaxis = strcreate (argv[N]);
     22    remove_argument (N, &argc, argv);
     23  }
     24  char *yaxis = NULL;
     25  if ((N = get_argument (argc, argv, "-yaxis"))) {
     26    remove_argument (N, &argc, argv);
     27    yaxis = strcreate (argv[N]);
     28    remove_argument (N, &argc, argv);
     29  }
    1730
    1831  SOLO_PHU = FALSE;
     
    6174    // XXX currently, image uses an unsigned short for NX,XY. this is rather restrictive
    6275    // and needs to be at least checked.
    63     haveNx = gfits_scan (&header, "IMNAXIS1",   "%d", 1, &Nx);
    64     haveNy = gfits_scan (&header, "IMNAXIS2",   "%d", 1, &Ny);
     76    haveNx = FALSE;
     77    if (xaxis) {
     78      haveNx = gfits_scan (&header, xaxis, "%d", 1, &Nx);
     79    }
     80    if (!haveNx) {
     81      haveNx = gfits_scan (&header, "IMNAXIS1",   "%d", 1, &Nx);
     82    }
     83    if (!haveNx) {
     84        haveNx = gfits_scan (&header, "ZNAXIS1",   "%d", 1, &Nx);
     85    }
     86    if (!haveNx) {
     87        haveNx = gfits_scan (&header, "NAXIS1",   "%d", 1, &Nx);
     88    }
    6589
    66     if (!haveNx && !haveNy) {
    67         haveNx = gfits_scan (&header, "ZNAXIS1",   "%d", 1, &Nx);
     90    haveNy = FALSE;
     91    if (yaxis) {
     92      haveNy = gfits_scan (&header, yaxis, "%d", 1, &Ny);
     93    }
     94    if (!haveNy) {
     95      haveNy = gfits_scan (&header, "IMNAXIS2",   "%d", 1, &Ny);
     96    }
     97    if (!haveNy) {
    6898        haveNy = gfits_scan (&header, "ZNAXIS2",   "%d", 1, &Ny);
    6999    }
    70 
    71     if (!haveNx && !haveNy) {
    72         haveNx = gfits_scan (&header, "NAXIS1",   "%d", 1, &Nx);
     100    if (!haveNy) {
    73101        haveNy = gfits_scan (&header, "NAXIS2",   "%d", 1, &Ny);
    74102    }
     
    137165  free (Xvec.elements.Flt);
    138166  free (Yvec.elements.Flt);
     167  if (xaxis) free (xaxis);
     168  if (yaxis) free (yaxis);
    139169  return (TRUE);
    140170
Note: See TracChangeset for help on using the changeset viewer.