Changeset 23789
- Timestamp:
- Apr 9, 2009, 6:00:18 PM (17 years ago)
- Location:
- trunk/psModules/src/imcombine
- Files:
-
- 2 edited
-
pmSubtractionStamps.c (modified) (5 diffs)
-
pmSubtractionStamps.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionStamps.c
r23688 r23789 95 95 if (x < footprint || x >= numCols - footprint || y < footprint || y >= numRows - footprint) { 96 96 clean = false; 97 goto CHECK_STAMP_MASK_DONE; 98 97 99 } 98 100 … … 116 118 // Check the immediate pixel 117 119 if (clean && (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & (maskVal | PM_SUBTRACTION_MASK_REJ))) { 120 goto CHECK_STAMP_MASK_DONE; 118 121 clean = false; 119 122 } 120 123 124 // Check the footprint 121 125 int xMin = PS_MAX(x - footprint, 0), xMax = PS_MIN(x + footprint, numCols - 1); // Bounds in x 122 126 int yMin = PS_MAX(y - footprint, 0), yMax = PS_MIN(y + footprint, numRows - 1); // Bounds in y 123 124 // Check the footprint125 127 if (clean) { 126 128 for (int j = yMin; j <= yMax; j++) { … … 133 135 } 134 136 } 135 CHECK_STAMP_MASK_DONE: 136 137 138 CHECK_STAMP_MASK_DONE: 137 139 if (!clean) { 138 140 // Mask the footprint, so we don't select something near it again … … 314 316 for (int y = subRegion->y0; y <= subRegion->y1; y++) { 315 317 for (int x = subRegion->x0; x <= subRegion->x1; x++) { 316 if ( checkStampMask(x, y, subMask, mode, footprint)&&317 image->data.F32[y][x] > fluxStamp) {318 if (image->data.F32[y][x] > fluxStamp && 319 checkStampMask(x, y, subMask, mode, footprint)) { 318 320 fluxStamp = image->data.F32[y][x]; 319 321 xStamp = x; … … 363 365 } 364 366 367 bool pmSubtractionStampsRegions(pmSubtractionStampList *stamps, const char *filename) 368 { 369 PM_ASSERT_SUBTRACTION_STAMP_LIST_NON_NULL(stamps, false); 370 PS_ASSERT_STRING_NON_EMPTY(filename, false); 371 372 FILE *outFile = fopen(filename, "w"); // File to write 373 if (!outFile) { 374 psError(PS_ERR_IO, false, "Unable to open %s for writing"); 375 return false; 376 } 377 378 for (int i = 0; i < stamps->num; i++) { 379 // Outline the stamp 380 psRegion *region = stamps->regions->data[i]; // Region of interest 381 fprintf(outFile, "image;box(%f,%f,%f,%f,0)\n", 382 0.5 * (region->x0 + region->x1), 0.5 * (region->y0 + region->y1), 383 region->x1 - region->x0, region->y1 - region->y0); 384 385 psVector *xList = stamps->x->data[i], *yList = stamps->y->data[i]; // Coordinate lists 386 387 for (int j = 0; j < xList->n; j++) { 388 fprintf(outFile, "image;circle(%f,%f,%d)\n", 389 xList->data.F32[j], yList->data.F32[j], stamps->footprint); 390 } 391 } 392 393 fclose(outFile); 394 395 return true; 396 } 365 397 366 398 pmSubtractionStampList *pmSubtractionStampsSet(const psVector *x, const psVector *y, -
trunk/psModules/src/imcombine/pmSubtractionStamps.h
r21363 r23789 124 124 ); 125 125 126 127 /// Write a ds9 region file with stamp positions 128 /// 129 /// Intended for debugging 130 bool pmSubtractionStampsRegions(pmSubtractionStampList *stamps, ///< Stamps 131 const char *filename ///< Filename to which to write regions 132 ); 133 134 126 135 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
