Changeset 15590 for trunk/Ohana/src/relastro/src/ImageOps.c
- Timestamp:
- Nov 11, 2007, 4:12:43 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/relastro/src/ImageOps.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/src/ImageOps.c
r15579 r15590 176 176 // return StarData values for detections in the specified image, converting coordinates from the 177 177 // chip positions: X,Y -> L,M -> P,Q -> R,D 178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) {178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) { 179 179 180 180 int i, m, c; 181 182 Image*mosaic;181 182 Mosaic *mosaic; 183 183 Coords *moscoords; 184 184 StarData *raw; … … 188 188 mosaic = NULL; 189 189 moscoords = NULL; 190 if (isMosaic) { 191 mosaic = getMosaicForImage (im); 192 if (mosaic == NULL) { 193 fprintf (stderr, "mosaic not found for image %s\n", image[i].name); 194 exit (1); 195 } 196 moscoords = &mosaic[0].coords; 190 switch (mode) { 191 case MODE_SIMPLE: 192 break; 193 case MODE_CHIP: 194 mosaic = getMosaicForImage (im); 195 if (mosaic == NULL) { 196 fprintf (stderr, "mosaic not found for image %s\n", image[i].name); 197 exit (1); 198 } 199 moscoords = &mosaic[0].coords; 200 break; 201 case MODE_MOSAIC: 202 // XXX find all images which are chips for this mosaic image 203 // XXX count the stars in the superset of lists? 204 fprintf (stderr, "problem with the mosaic mode (need to grab the correct set of stars)"); 205 abort (); 206 break; 197 207 } 198 208 … … 208 218 raw[i].dMag = catalog[c].measure[m].dM; 209 219 210 /* note that for a Simple image, L,M = P,Q */ 211 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 212 if (isMosaic) { 213 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 214 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 215 } else { 216 raw[i].P = raw[i].L; 217 raw[i].Q = raw[i].M; 218 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 220 raw[i].mask = FALSE; 221 222 switch (mode) { 223 case MODE_SIMPLE: 224 /* note that for a Simple image, L,M = P,Q */ 225 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 226 raw[i].P = raw[i].L; 227 raw[i].Q = raw[i].M; 228 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 229 break; 230 case MODE_CHIP: 231 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 232 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 233 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 234 break; 235 case MODE_MOSAIC: 236 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 237 raw[i].P = raw[i].L; 238 raw[i].Q = raw[i].M; 239 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 240 break; 219 241 } 220 } 221 242 } 243 222 244 *Nstars = Nlist[im]; 223 245 return (raw); … … 230 252 int i, m, c, n; 231 253 232 Image*mosaic;254 Mosaic *mosaic; 233 255 Coords *moscoords; 234 256 StarData *ref; … … 251 273 ref[i].R = catalog[c].average[n].R; 252 274 ref[i].D = catalog[c].average[n].D; 275 ref[i].mask = FALSE; 253 276 254 277 /* note that for a Simple image, L,M = P,Q */ 255 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords);256 278 if (isMosaic) { 279 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords); 257 280 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 258 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, moscoords);281 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 259 282 } else { 283 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords); 260 284 ref[i].L = ref[i].P; 261 285 ref[i].M = ref[i].Q;
Note:
See TracChangeset
for help on using the changeset viewer.
