IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12750


Ignore:
Timestamp:
Apr 4, 2007, 6:55:16 PM (19 years ago)
Author:
eugene
Message:

support for triangular images

Location:
trunk/Ohana/src/opihi/dvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/gimages.c

    r12727 r12750  
    44 
    55  int i, j, N, Nimage, Nfound, *subset, Nsubset, status;
    6   double ra, dec, Ra, Dec, X, Y;
     6  double ra, dec, Ra, Dec, X, Y, Yo;
    77  double trange, t;
    88  int TimeSelect, PixelCoords, TimeFormat, PhotCodeSelect;
    99  time_t tzero, TimeReference;
    1010  char name[64], *date;
     11  int typehash;
    1112
    1213  PhotCode *code;
     
    7677  BuildChipMatch (image, Nimage);
    7778
     79  int DistortImage = wordhash ("-DIS");
     80  int TriangleUp   = wordhash ("TRP-");
     81  int TriangleDn   = wordhash ("TRM-");
     82
    7883  Nfound = 0;
    7984  for (j = 0; j < Nsubset; j++) {
     
    9398    if (!finite(Y)) continue;
    9499    if (!status) continue;
    95     if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
    96         if (X < -0.5*image[i].NX) continue;
    97         if (Y < -0.5*image[i].NY) continue;
    98         if (X > +0.5*image[i].NX) continue;
    99         if (Y > +0.5*image[i].NY) continue;
    100     } else {
    101         if (X < 0) continue;
    102         if (Y < 0) continue;
    103         if (X > image[i].NX) continue;
    104         if (Y > image[i].NY) continue;
     100
     101    typehash = wordhash (&image[i].coords.ctype[4]);
     102
     103    if (typehash == DistortImage) {
     104      if (X < -0.5*image[i].NX) continue;
     105      if (Y < -0.5*image[i].NY) continue;
     106      if (X > +0.5*image[i].NX) continue;
     107      if (Y > +0.5*image[i].NY) continue;
     108      goto got_spot;
     109    }
     110
     111    typehash = wordhash (image[i].coords.ctype);
     112    if (typehash == TriangleUp) {
     113      if (Y < -0.5*image[i].NY) continue;
     114      Yo = +0.5*image[i].NY + 2.0*(image[i].NY/image[i].NX)*X;
     115      if (Y > Yo) continue;
     116      Yo = +0.5*image[i].NY - 2.0*(image[i].NY/image[i].NX)*X;
     117      if (Y > Yo) continue;
     118      goto got_spot;
     119    }
     120    if (typehash == TriangleDn) {
     121      if (Y > +0.5*image[i].NY) continue;
     122      Yo = -0.5*image[i].NY + 2.0*(image[i].NY/image[i].NX)*X;
     123      if (Y < Yo) continue;
     124      Yo = -0.5*image[i].NY - 2.0*(image[i].NY/image[i].NX)*X;
     125      if (Y < Yo) continue;
     126      goto got_spot;
     127    }
     128
     129    {
     130      if (X < 0) continue;
     131      if (Y < 0) continue;
     132      if (X > image[i].NX) continue;
     133      if (Y > image[i].NY) continue;
    105134    }
    106135
     
    109138    ***/
    110139
     140  got_spot:
    111141    date = sec_to_date (image[i].tzero);
    112142
  • trunk/Ohana/src/opihi/dvo/images.c

    r12728 r12750  
    22# define BETA 0.41421
    33
     4int wordhash (char *word) {
     5  int value;
     6
     7  value = *(int *)word;
     8  return value;
     9}
     10
    411int images (int argc, char **argv) {
    512
    613  int i, j, Nimage, status, InPic, leftside, *plist, TimeSelect, ByName;
    7   int WITH_MOSAIC, SOLO_MOSAIC;
     14  int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN;
    815  time_t tzero, tend;
    916  int N, NPTS, n, npts, Npts;
     
    1320  Graphdata graphmode;
    1421  char name[256];
     22  int typehash;
    1523
    1624  if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;
     
    2634    remove_argument (N, &argc, argv);
    2735    SOLO_MOSAIC = TRUE;
     36    WITH_MOSAIC = TRUE;
     37  }
     38
     39  HIDDEN = FALSE;
     40  if ((N = get_argument (argc, argv, "-hidden"))) {
     41    remove_argument (N, &argc, argv);
     42    HIDDEN = TRUE;
    2843  }
    2944
     
    96111  Rmid = 0.5*(Rmin + Rmax);
    97112 
     113  int DistortImage = wordhash ("-DIS");
     114  int TriangleUp   = wordhash ("TRP-");
     115  int TriangleDn   = wordhash ("TRM-");
     116
    98117  npts = NPTS = 200;
    99118  ALLOCATE (Xvec.elements, float, NPTS);
     
    106125    if (!FindMosaicForImage (image, Nimage, i)) continue;
    107126
    108     if (!strcmp(&image[i].coords.ctype[4], "-DIS") && !WITH_MOSAIC) continue;
    109     if ( strcmp(&image[i].coords.ctype[4], "-DIS") &&  SOLO_MOSAIC) continue;
    110 
    111     /* project this image to screen display coords */
     127    Npts = 4;
     128    status = TRUE;
     129    leftside = FALSE;
     130
     131    typehash = wordhash (&image[i].coords.ctype[4]);
     132
    112133    /* DIS images represent a field, not a chip */
    113     if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
     134    if ((typehash == DistortImage) && !WITH_MOSAIC) continue;
     135    if ((typehash != DistortImage) &&  SOLO_MOSAIC) continue;
     136    if (typehash == DistortImage) {
    114137      x[0] = -0.5*image[i].NX; y[0] = -0.5*image[i].NY;
    115138      x[1] = +0.5*image[i].NX; y[1] = -0.5*image[i].NY;
    116139      x[2] = +0.5*image[i].NX; y[2] = +0.5*image[i].NY;
    117140      x[3] = -0.5*image[i].NX; y[3] = +0.5*image[i].NY;
    118     } else {
     141      goto got_type;
     142    }
     143
     144    typehash = wordhash (image[i].coords.ctype);
     145    if (typehash == TriangleUp) {
     146      Npts = 3;
     147      x[0] =                0; y[0] = +0.5*image[i].NY;
     148      x[1] = +0.5*image[i].NX; y[1] = -0.5*image[i].NY;
     149      x[2] = -0.5*image[i].NX; y[2] = -0.5*image[i].NY;
     150      goto got_type;
     151    }
     152    if (typehash == TriangleDn) {
     153      Npts = 3;
     154      x[0] =                0; y[0] = -0.5*image[i].NY;
     155      x[1] = +0.5*image[i].NX; y[1] = +0.5*image[i].NY;
     156      x[2] = -0.5*image[i].NX; y[2] = +0.5*image[i].NY;
     157      goto got_type;
     158    }
     159
     160    // default layout
     161    {
    119162      x[0] = 0;           y[0] = 0;
    120163      x[1] = image[i].NX; y[1] = 0;
     
    123166    }
    124167
    125     Npts = 4;
    126     status = TRUE;
    127     leftside = FALSE;
    128     for (j = 0; j < 4; j++) {
     168  got_type:
     169
     170    /* project this image to screen display coords */
     171    // check for boundary overlap?
     172    for (j = 0; j < Npts; j++) {
    129173      status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[i].coords);
    130174      if (!status) break;
     
    203247        InPic = TRUE;
    204248    }
     249    if (!status && HIDDEN) status = TRUE;
    205250    if (InPic && status) {
    206251      plist[n] = i;
Note: See TracChangeset for help on using the changeset viewer.