IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2008, 12:29:36 PM (17 years ago)
Author:
bills
Message:

get mask value from recipe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r20807 r20808  
    1818    psFree(sfile);
    1919}
    20 
    21 // TODO: get these by reading the recipe
    22 #define MASK_STREAK   0x20
    23 #define MASK_BAD_WARP 0x10
    24 
    2520
    2621
     
    13081303
    13091304static void
    1310 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, double newMaskValue)
     1305excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue)
    13111306{
    13121307    // we clip so that the streak calculation code doesn't have to
     
    13231318        psImageSet (sfiles->outImage->image,  x, y, NAN);
    13241319    } else {
    1325         if (newMaskValue == MASK_BAD_WARP) {
    1326             psImageSet (sfiles->outImage->image,  x, y, NAN);
    1327         } else {
     1320        if (streak) {
    13281321            // as a visualization aid don't mask the pixel, just change the intensity
    13291322            psImageSet (sfiles->outImage->image,  x, y, imageValue + sfiles->transparentStreaks);
     1323        } else {
     1324            psImageSet (sfiles->outImage->image,  x, y, NAN);
    13301325        }
    13311326    }
     
    13731368            for (int xCell = 0; xCell < numCols; xCell++, pixels++) {
    13741369                if (! *pixels ) {
    1375                     excisePixel(sfiles, xCell, yCell, newMaskValue);
     1370                    excisePixel(sfiles, xCell, yCell, false, newMaskValue);
    13761371                }
    13771372            }
     
    13821377            for (int xCell = numCols - 1; xCell >= 0 ; xCell--, pixels++) {
    13831378                if (!*pixels) {
    1384                     excisePixel(sfiles, xCell, yCell, newMaskValue);
     1379                    excisePixel(sfiles, xCell, yCell, false, newMaskValue);
    13851380                }
    13861381            }
     
    15021497{
    15031498    long i;
    1504     double imageValue, weightValue, maskValue;
     1499    bool status;
    15051500    StreakPixels *pixels;
    15061501    PixelPos *pixelPos;
     
    15141509    }
    15151510
     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
    15161522    psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
     1523
    15171524    Streaks *streaks = readStreaksFile(streaksFileName);
    1518 
    15191525    if (!streaks) {
    15201526        psErrorStackPrint(stderr, "failed to read streaks file: %s", streaksFileName);
     
    15261532    bool exciseAll = false;
    15271533    // --keepnonwarped is a test and debug mode
    1528     bool status;
    15291534    bool keepNonWarpedPixels = psMetadataLookupBool(&status, config->arguments, "KEEP_NON_WARPED");
    15301535
     
    15851590
    15861591            if (checkNonWarpedPixels) {
    1587                 exciseNonWarpedPixels(sfiles, MASK_BAD_WARP);
     1592                exciseNonWarpedPixels(sfiles, maskStreak);
    15881593            }
    15891594           
     
    15941599                    if (!checkNonWarpedPixels || warpedPixel(sfiles, pixelPos)) {
    15951600
    1596                         excisePixel(sfiles, pixelPos->x, pixelPos->y, MASK_STREAK);
     1601                        excisePixel(sfiles, pixelPos->x, pixelPos->y, true, maskStreak);
    15971602
    15981603                    } 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
    16001606                    }
    16011607                }
Note: See TracChangeset for help on using the changeset viewer.