IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 4, 2007, 10:15:51 AM (19 years ago)
Author:
eugene
Message:

extensive updates to the avextract / mextract / skyregion system

File:
1 edited

Legend:

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

    r7680 r14401  
    22
    33void image_subset (Image *image, int Nimage, int **Subset, int *Nsubset,
    4                    Graphdata *graph, int RegionSelect,
     4                   SkyRegionSelection *selection,
    55                   unsigned long int tzero, double trange, int TimeSelect)
    66{
     
    1010  int N, n, npts;
    1111  double r, d, X, Y, x[4], y[4], Rmin, Rmax, Rmid;
     12  Graphdata graph;
     13  SkyRegion patch;
    1214
    1315  Rmin = Rmax = Rmid = 0;
    14   if (RegionSelect) {
    15     Rmin = graph[0].coords.crval1 - 182.0;
    16     Rmax = graph[0].coords.crval1 + 182.0;
     16
     17  if (selection->useDisplay) {
     18    if (!GetGraphData (&graph, NULL, NULL)) {
     19      gprint (GP_ERR, "region display not available\n");
     20      return;
     21    }
     22    Rmin = graph.coords.crval1 - 182.0;
     23    Rmax = graph.coords.crval1 + 182.0;
    1724    Rmid = 0.5*(Rmin + Rmax);
    1825    BuildChipMatch (image, Nimage);
     26  }
     27
     28  if (selection->useSkyregion) {
     29    get_skyregion (&patch.Rmin, &patch.Rmax, &patch.Dmin, &patch.Dmax);
     30    Rmin = patch.Rmin - 182.0;
     31    Rmax = patch.Rmax + 182.0;
     32    Rmid = 0.5*(Rmin + Rmax);
    1933  }
    2034
     
    2943  for (i = 0; i < Nimage; i++) {
    3044    if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue;
    31     if (RegionSelect) {
     45    if (selection->useDisplay) {
    3246      if (!FindMosaicForImage (image, Nimage, i)) continue;
    3347      /* project this image to screen display coords */
     
    4458        while (flipped && (r < Rmid)) r+= 360.0;
    4559        while (flipped && (r > Rmid)) r-= 360.0;
    46         status = RD_to_XY (&X, &Y, r, d, &graph[0].coords);
     60        status = RD_to_XY (&X, &Y, r, d, &graph.coords);
    4761        if (!status) continue;
    48         if (X < graph[0].xmin) continue;
    49         if (X > graph[0].xmax) continue;
    50         if (Y < graph[0].ymin) continue;
    51         if (Y > graph[0].ymax) continue;
     62        if (X < graph.xmin) continue;
     63        if (X > graph.xmax) continue;
     64        if (Y < graph.ymin) continue;
     65        if (Y > graph.ymax) continue;
     66        goto in_region;
     67        /** we miss any images which surround the region.  we are also
     68            missing the DIS images for which the corners don't touch
     69            the region, but which are needed for WRP images with
     70            corners touching the region **/
     71      }
     72      continue;
     73    }
     74    if (selection->useSkyregion) {
     75      if (!FindMosaicForImage (image, Nimage, i)) continue;
     76      /* project this image to screen display coords */
     77      x[0] = 0;           y[0] = 0;
     78      x[1] = image[i].NX; y[1] = 0;
     79      x[2] = image[i].NX; y[2] = image[i].NY;
     80      x[3] = 0;           y[3] = image[i].NY;
     81      InPic = flipped = FALSE;
     82      for (j = 0; j < 4; j++) {
     83        XY_to_RD (&r, &d, x[j], y[j], &image[i].coords);
     84        /* use same side of 0,360 boundary for all corners */
     85        if ((j == 0) && (r < Rmin)) flipped = TRUE;
     86        if ((j == 0) && (r > Rmax)) flipped = TRUE;
     87        while (flipped && (r < Rmid)) r+= 360.0;
     88        while (flipped && (r > Rmid)) r-= 360.0;
     89        if (r < patch.Rmin) continue;
     90        if (r > patch.Rmax) continue;
     91        if (d < patch.Dmin) continue;
     92        if (d > patch.Dmax) continue;
    5293        goto in_region;
    5394        /** we miss any images which surround the region.  we are also
Note: See TracChangeset for help on using the changeset viewer.