Changeset 20808 for trunk/magic/remove/src/streaksremove.c
- Timestamp:
- Nov 20, 2008, 12:29:36 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/streaksremove.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksremove.c
r20807 r20808 18 18 psFree(sfile); 19 19 } 20 21 // TODO: get these by reading the recipe22 #define MASK_STREAK 0x2023 #define MASK_BAD_WARP 0x1024 25 20 26 21 … … 1308 1303 1309 1304 static void 1310 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, double newMaskValue)1305 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue) 1311 1306 { 1312 1307 // we clip so that the streak calculation code doesn't have to … … 1323 1318 psImageSet (sfiles->outImage->image, x, y, NAN); 1324 1319 } else { 1325 if (newMaskValue == MASK_BAD_WARP) { 1326 psImageSet (sfiles->outImage->image, x, y, NAN); 1327 } else { 1320 if (streak) { 1328 1321 // as a visualization aid don't mask the pixel, just change the intensity 1329 1322 psImageSet (sfiles->outImage->image, x, y, imageValue + sfiles->transparentStreaks); 1323 } else { 1324 psImageSet (sfiles->outImage->image, x, y, NAN); 1330 1325 } 1331 1326 } … … 1373 1368 for (int xCell = 0; xCell < numCols; xCell++, pixels++) { 1374 1369 if (! *pixels ) { 1375 excisePixel(sfiles, xCell, yCell, newMaskValue);1370 excisePixel(sfiles, xCell, yCell, false, newMaskValue); 1376 1371 } 1377 1372 } … … 1382 1377 for (int xCell = numCols - 1; xCell >= 0 ; xCell--, pixels++) { 1383 1378 if (!*pixels) { 1384 excisePixel(sfiles, xCell, yCell, newMaskValue);1379 excisePixel(sfiles, xCell, yCell, false, newMaskValue); 1385 1380 } 1386 1381 } … … 1502 1497 { 1503 1498 long i; 1504 double imageValue, weightValue, maskValue;1499 bool status; 1505 1500 StreakPixels *pixels; 1506 1501 PixelPos *pixelPos; … … 1514 1509 } 1515 1510 1511 psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS"); 1512 if (!status) { 1513 psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n"); 1514 return PS_EXIT_CONFIG_ERROR; 1515 } 1516 double maskStreak = (double) psMetadataLookupU8(&status, masks, "STREAK"); 1517 if (!status) { 1518 psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n"); 1519 return PS_EXIT_CONFIG_ERROR; 1520 } 1521 1516 1522 psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS"); 1523 1517 1524 Streaks *streaks = readStreaksFile(streaksFileName); 1518 1519 1525 if (!streaks) { 1520 1526 psErrorStackPrint(stderr, "failed to read streaks file: %s", streaksFileName); … … 1526 1532 bool exciseAll = false; 1527 1533 // --keepnonwarped is a test and debug mode 1528 bool status;1529 1534 bool keepNonWarpedPixels = psMetadataLookupBool(&status, config->arguments, "KEEP_NON_WARPED"); 1530 1535 … … 1585 1590 1586 1591 if (checkNonWarpedPixels) { 1587 exciseNonWarpedPixels(sfiles, MASK_BAD_WARP);1592 exciseNonWarpedPixels(sfiles, maskStreak); 1588 1593 } 1589 1594 … … 1594 1599 if (!checkNonWarpedPixels || warpedPixel(sfiles, pixelPos)) { 1595 1600 1596 excisePixel(sfiles, pixelPos->x, pixelPos->y, MASK_STREAK);1601 excisePixel(sfiles, pixelPos->x, pixelPos->y, true, maskStreak); 1597 1602 1598 1603 } else { 1599 // This pixel was not included in any warp and has thus already excised above 1604 // This pixel was not included in any warp and has thus already excised 1605 // by exciseNonWarpedPixels 1600 1606 } 1601 1607 }
Note:
See TracChangeset
for help on using the changeset viewer.
