Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 20807)
+++ trunk/magic/remove/src/streaksremove.c	(revision 20808)
@@ -18,9 +18,4 @@
     psFree(sfile);
 }
-
-// TODO: get these by reading the recipe
-#define MASK_STREAK   0x20
-#define MASK_BAD_WARP 0x10
-
 
 
@@ -1308,5 +1303,5 @@
 
 static void
-excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, double newMaskValue)
+excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue)
 {
     // we clip so that the streak calculation code doesn't have to
@@ -1323,9 +1318,9 @@
         psImageSet (sfiles->outImage->image,  x, y, NAN);
     } else {
-        if (newMaskValue == MASK_BAD_WARP) {
-            psImageSet (sfiles->outImage->image,  x, y, NAN);
-        } else {
+        if (streak) {
             // as a visualization aid don't mask the pixel, just change the intensity
             psImageSet (sfiles->outImage->image,  x, y, imageValue + sfiles->transparentStreaks);
+        } else {
+            psImageSet (sfiles->outImage->image,  x, y, NAN);
         }
     }
@@ -1373,5 +1368,5 @@
             for (int xCell = 0; xCell < numCols; xCell++, pixels++) {
                 if (! *pixels ) {
-                    excisePixel(sfiles, xCell, yCell, newMaskValue);
+                    excisePixel(sfiles, xCell, yCell, false, newMaskValue);
                 }
             }
@@ -1382,5 +1377,5 @@
             for (int xCell = numCols - 1; xCell >= 0 ; xCell--, pixels++) {
                 if (!*pixels) {
-                    excisePixel(sfiles, xCell, yCell, newMaskValue);
+                    excisePixel(sfiles, xCell, yCell, false, newMaskValue);
                 }
             }
@@ -1502,5 +1497,5 @@
 {
     long i;
-    double imageValue, weightValue, maskValue;
+    bool status;
     StreakPixels *pixels;
     PixelPos *pixelPos;
@@ -1514,7 +1509,18 @@
     }
 
+    psMetadata *masks = psMetadataLookupMetadata(&status, config->recipes, "MASKS");
+    if (!status) {
+        psError(PM_ERR_CONFIG, false, "failed to lookup MASKS in recipes\n");
+        return PS_EXIT_CONFIG_ERROR;
+    }
+    double maskStreak = (double) psMetadataLookupU8(&status, masks, "STREAK");
+    if (!status) {
+        psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
+        return PS_EXIT_CONFIG_ERROR;
+    }
+
     psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
+
     Streaks *streaks = readStreaksFile(streaksFileName);
-
     if (!streaks) {
         psErrorStackPrint(stderr, "failed to read streaks file: %s", streaksFileName);
@@ -1526,5 +1532,4 @@
     bool exciseAll = false;
     // --keepnonwarped is a test and debug mode
-    bool status;
     bool keepNonWarpedPixels = psMetadataLookupBool(&status, config->arguments, "KEEP_NON_WARPED");
 
@@ -1585,5 +1590,5 @@
 
             if (checkNonWarpedPixels) {
-                exciseNonWarpedPixels(sfiles, MASK_BAD_WARP);
+                exciseNonWarpedPixels(sfiles, maskStreak);
             }
             
@@ -1594,8 +1599,9 @@
                     if (!checkNonWarpedPixels || warpedPixel(sfiles, pixelPos)) {
 
-                        excisePixel(sfiles, pixelPos->x, pixelPos->y, MASK_STREAK);
+                        excisePixel(sfiles, pixelPos->x, pixelPos->y, true, maskStreak);
 
                     } else {
-                        // This pixel was not included in any warp and has thus already excised above
+                        // This pixel was not included in any warp and has thus already excised
+                        // by exciseNonWarpedPixels
                     }
                 }
