Changeset 14401 for trunk/Ohana/src/opihi/dvo/ImageOps.c
- Timestamp:
- Aug 4, 2007, 10:15:51 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/ImageOps.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/ImageOps.c
r7680 r14401 2 2 3 3 void image_subset (Image *image, int Nimage, int **Subset, int *Nsubset, 4 Graphdata *graph, int RegionSelect,4 SkyRegionSelection *selection, 5 5 unsigned long int tzero, double trange, int TimeSelect) 6 6 { … … 10 10 int N, n, npts; 11 11 double r, d, X, Y, x[4], y[4], Rmin, Rmax, Rmid; 12 Graphdata graph; 13 SkyRegion patch; 12 14 13 15 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; 17 24 Rmid = 0.5*(Rmin + Rmax); 18 25 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); 19 33 } 20 34 … … 29 43 for (i = 0; i < Nimage; i++) { 30 44 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) { 32 46 if (!FindMosaicForImage (image, Nimage, i)) continue; 33 47 /* project this image to screen display coords */ … … 44 58 while (flipped && (r < Rmid)) r+= 360.0; 45 59 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); 47 61 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; 52 93 goto in_region; 53 94 /** we miss any images which surround the region. we are also
Note:
See TracChangeset
for help on using the changeset viewer.
