Index: trunk/pswarp/src/pswarpTransformReadout.c
===================================================================
--- trunk/pswarp/src/pswarpTransformReadout.c	(revision 40354)
+++ trunk/pswarp/src/pswarpTransformReadout.c	(revision 41382)
@@ -27,4 +27,6 @@
     int nGridX = psMetadataLookupS32(NULL, config->arguments, "GRID.NX"); ///< Number of grid points in x
     int nGridY = psMetadataLookupS32(NULL, config->arguments, "GRID.NY"); ///< Number of grid points in y
+    bool doApplyMaskNaN = psMetadataLookupBool(NULL, config->arguments, "APPLY.PIXELNAN"); ///NaN the pixels underneath masks
+
     psImageInterpolateMode interpolationMode = psMetadataLookupS32(NULL, config->arguments,
                                                                    "INTERPOLATION.MODE"); ///< Mode for interp
@@ -37,5 +39,9 @@
 
     // output mask bits
-    psImageMaskType maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
+    psImageMaskType maskIn   = 0 ;
+    if(doApplyMaskNaN) {
+      maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
+      psAssert(mdok, "MASK.INPUT was not defined");
+    } 
     psImageMaskType maskPoor = pmConfigMaskGet("CONV.POOR", config);
     if (!maskPoor) {
@@ -46,5 +52,4 @@
         maskBad  = pmConfigMaskGet("BAD.WARP", config);
     }
-    psAssert(mdok, "MASK.INPUT was not defined");
 
     if (!input->covariance) {
