Index: trunk/ppImage/src/ppImageDetrendMask.c
===================================================================
--- trunk/ppImage/src/ppImageDetrendMask.c	(revision 5857)
+++ trunk/ppImage/src/ppImageDetrendMask.c	(revision 5858)
@@ -1,14 +1,17 @@
 # include "ppImage.h"
 
-bool ppDetrendMask (pmCell *cell, pmReadout *readout, pmImage *mask) {
+# define MASK_MODE (PM_MASK_TRAP | PM_MASK_BADCOL | PM_MASK_SAT)
+
+// XXX pass 'concepts' not 'cell' to this function?
+
+bool ppDetrendMask (pmCell *cell, pmReadout *input, pmReadout *mask) {
 
     float saturation = psMetadataLookupF32(NULL, cell->concepts, "CELL.SATURATION");
 
     // Need to change this later to grow the mask by the size of the convolution kernel
-    (void)pmMaskBadPixels(readout, mask, 
-			  PM_MASK_TRAP | PM_MASK_BADCOL | PM_MASK_SAT, saturation,
-			  PM_MASK_TRAP, 0);
+    // XXX does this function respect the mask / image cell region information?
+    // XXX should probably take pmRegion *mask
+    pmMaskBadPixels(input, mask->image, MASK_MODE, saturation, PM_MASK_TRAP, 0);
 
     return true;
 }
-
