IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31078


Ignore:
Timestamp:
Mar 29, 2011, 11:04:25 AM (15 years ago)
Author:
eugene
Message:

fix error in CastVector; add -graph option to densify

Location:
branches/eam_branches/ipp-20110213/Ohana/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/Ohana/src/kapa2/src/SetImageData.c

    r27435 r31078  
    128128  Picture_to_Image (&Xmax, &Ymax, image[0].picture.dx, image[0].picture.dy, &image[0].picture);
    129129
    130   KiiSendMessage (sock, "%g %g %g %g", Xmin, Xmax, Ymin, Ymax);
     130  KiiSendMessage (sock, "%g %g %g %g %d %d", Xmin, Xmax, Ymin, Ymax, image[0].picture.dx, image[0].picture.dy);
    131131
    132132  return (TRUE);
  • branches/eam_branches/ipp-20110213/Ohana/src/libkapa/include/kapa.h

    r30889 r31078  
    154154int KapaSetImageCoords (int fd, Coords *coords);
    155155int KapaGetImageCoords (int fd, Coords *coords);
    156 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax);
     156int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax, int *dX, int *dY);
    157157
    158158/* KiiOverlay.c */
  • branches/eam_branches/ipp-20110213/Ohana/src/libkapa/src/KiiPicture.c

    r27761 r31078  
    203203}
    204204
    205 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax) {
     205int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax, int *dX, int *dY) {
    206206
    207207  /* tell kapa to look for the incoming image */
    208208  KiiSendCommand (fd, 4, "GIMR");
    209209 
    210   KiiScanMessage (fd, "%lf %lf %lf %lf", Xmin, Xmax, Ymin, Ymax);
     210  KiiScanMessage (fd, "%lf %lf %lf %lf %d %d", Xmin, Xmax, Ymin, Ymax, dX, dY);
    211211
    212212  KiiWaitAnswer (fd, "DONE");
  • branches/eam_branches/ipp-20110213/Ohana/src/opihi/cmd.data/densify.c

    r29938 r31078  
    11# include "data.h"
     2
     3# define CHECKVAL(ARG) if (!isfinite(ARG)) { gprint (GP_ERR, "illegal value for %s: %f\n", #ARG, ARG); return (FALSE); }
    24
    35int densify (int argc, char **argv) {
    46
    5   int i, Nx, Ny, Xb, Yb, Normalize, N;
    6   float Xmin, Xmax, dX, Ymin, Ymax, dY;
     7  int i, Nx, Ny, Xb, Yb, Normalize, N, Xpix, Ypix, good, UseGraph;
     8  double Xmin, Xmax, dX, Ymin, Ymax, dY;
    79  float *val;
    810  Buffer *bf;
     
    1618  }
    1719
    18   if (argc != 10) {
     20  UseGraph = FALSE;
     21  if ((N = get_argument (argc, argv, "-graph"))) {
     22    remove_argument (N, &argc, argv);
     23    UseGraph = TRUE;
     24  }
     25
     26  good = UseGraph ? (argc == 4) : (argc == 10);
     27  if (!good) {
    1928    gprint (GP_ERR, "USAGE: densify buffer x y Xmin Xmax dX Ymin Ymax dY\n");
     29    gprint (GP_ERR, "   OR: densify buffer x y -graph\n");
    2030    return (FALSE);
    2131  }
     
    3040  REQUIRE_VECTOR_FLT (vy, FALSE);
    3141
    32   Xmin = atof (argv[4]);
    33   Xmax = atof (argv[5]);
    34   dX   = atof (argv[6]);
     42  if (UseGraph) {
     43    int kapa;
     44    Graphdata graphmode;
     45    if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE);
     46    KapaGetImageRange (kapa, &Xmin, &Xmax, &Ymax, &Ymin, &Xpix, &Ypix);
     47    Xmax = graphmode.xmax;
     48    Xmin = graphmode.xmin;
     49    Ymax = graphmode.ymax;
     50    Ymin = graphmode.ymin;
     51    dX = (Xmax - Xmin) / (Xpix - 1);
     52    dY = (Ymax - Ymin) / (Ypix - 1);
     53  } else {
     54    Xmin = atof (argv[4]);
     55    Xmax = atof (argv[5]);
     56    dX   = atof (argv[6]);
    3557
    36   Ymin = atof (argv[7]);
    37   Ymax = atof (argv[8]);
    38   dY   = atof (argv[9]);
     58    Ymin = atof (argv[7]);
     59    Ymax = atof (argv[8]);
     60    dY   = atof (argv[9]);
     61  }
     62
     63  CHECKVAL(Xmin);
     64  CHECKVAL(Xmax);
     65  CHECKVAL(dX);
     66
     67  CHECKVAL(Ymin);
     68  CHECKVAL(Ymax);
     69  CHECKVAL(dY);
    3970
    4071  Nx = (Xmax - Xmin) / dX + 1;
  • branches/eam_branches/ipp-20110213/Ohana/src/opihi/cmd.data/limits.c

    r30610 r31078  
    33int limits (int argc, char **argv) {
    44
    5   int N, APPLY;
     5  int N, APPLY, dX, dY;
    66  int kapa;
    77  char *name;
     
    2828  if ((N = get_argument (argc, argv, "-image"))) {
    2929    remove_argument (N, &argc, argv);
    30     KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin);
     30    KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin, &dX, &dY);
    3131
    3232    set_variable ("XMIN", graphmode.xmin);
     
    3434    set_variable ("YMIN", graphmode.ymin);
    3535    set_variable ("YMAX", graphmode.ymax);
     36
     37    set_variable ("KAPA_XMIN", graphmode.xmin);
     38    set_variable ("KAPA_XMAX", graphmode.xmax);
     39    set_variable ("KAPA_YMIN", graphmode.ymin);
     40    set_variable ("KAPA_YMAX", graphmode.ymax);
     41
     42    set_variable ("KAPA_XPIX", dX);
     43    set_variable ("KAPA_YPIX", dY);
    3644
    3745    // if (!NoClear) KapaClearSections (kapa);
  • branches/eam_branches/ipp-20110213/Ohana/src/opihi/lib.data/graphtools.c

    r20936 r31078  
    5959  set_variable ("YMIN", graphmode[0].ymin);
    6060  set_variable ("YMAX", graphmode[0].ymax);
     61
     62  set_variable ("KAPA_XMIN", graphmode[0].xmin);
     63  set_variable ("KAPA_XMAX", graphmode[0].xmax);
     64  set_variable ("KAPA_YMIN", graphmode[0].ymin);
     65  set_variable ("KAPA_YMAX", graphmode[0].ymax);
    6166}
    6267
     
    95100  SetGraph (graphmode);
    96101
     102  set_variable ("KAPA_XMIN", graphmode[0].xmin);
     103  set_variable ("KAPA_XMAX", graphmode[0].xmax);
     104  set_variable ("KAPA_YMIN", graphmode[0].ymin);
     105  set_variable ("KAPA_YMAX", graphmode[0].ymax);
     106
    97107  set_variable ("XMIN", graphmode[0].xmin);
    98108  set_variable ("XMAX", graphmode[0].xmax);
  • branches/eam_branches/ipp-20110213/Ohana/src/opihi/lib.shell/VectorOps.c

    r30614 r31078  
    218218    }
    219219    free (vec[0].elements.Int);
    220     vec[0].elements.Flt = vo;
     220    vec[0].elements.Flt = temp;
    221221    vec[0].type = OPIHI_FLT;
    222222  } else {
     
    229229    }
    230230    free (vec[0].elements.Flt);
    231     vec[0].elements.Int = vo;
     231    vec[0].elements.Int = temp;
    232232    vec[0].type = OPIHI_INT;
    233233  }
Note: See TracChangeset for help on using the changeset viewer.