Index: trunk/psModules/src/camera/pmReadoutStack.c
===================================================================
--- trunk/psModules/src/camera/pmReadoutStack.c	(revision 15974)
+++ trunk/psModules/src/camera/pmReadoutStack.c	(revision 16600)
@@ -9,14 +9,15 @@
 
 bool pmReadoutUpdateSize(pmReadout *readout, int minCols, int minRows,
-                         int numCols, int numRows, bool mask)
+                         int numCols, int numRows, bool mask, bool weight,
+                         psMaskType blank)
 {
     PS_ASSERT_PTR_NON_NULL(readout, false);
 
     if (readout->image) {
-        *(psS32*) &(readout->col0) = PS_MIN(minCols, readout->col0);
-        *(psS32*) &(readout->row0) = PS_MIN(minRows, readout->row0);
+        readout->col0 = PS_MIN(minCols, readout->col0);
+        readout->row0 = PS_MIN(minRows, readout->row0);
     } else {
-        *(psS32*) &(readout->col0) = minCols;
-        *(psS32*) &(readout->row0) = minRows;
+        readout->col0 = minCols;
+        readout->row0 = minRows;
     }
 
@@ -28,5 +29,5 @@
         // Generate the new output image by extending the current one, or making a whole new one
         psImage *newImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-        psImageInit(newImage, 0.0);
+        psImageInit(newImage, NAN);
         psImageOverlaySection(newImage, readout->image, readout->col0, readout->row0, "=");
         psFree(readout->image);
@@ -40,8 +41,21 @@
         if (readout->mask->numCols < numCols || readout->mask->numRows < numRows) {
             psImage *newMask = psImageAlloc(numCols, numRows, PS_TYPE_MASK);
-            psImageInit(newMask, 0);
+            psImageInit(newMask, blank);
             psImageOverlaySection(newMask, readout->mask, readout->col0, readout->row0, "=");
             psFree(readout->mask);
             readout->mask = newMask;
+        }
+    }
+
+    if (weight) {
+        if (!readout->weight) {
+            readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
+        }
+        if (readout->weight->numCols < numCols || readout->weight->numRows < numRows) {
+            psImage *newWeight = psImageAlloc(numCols, numRows, PS_TYPE_F32);
+            psImageInit(newWeight, NAN);
+            psImageOverlaySection(newWeight, readout->weight, readout->col0, readout->row0, "=");
+            psFree(readout->weight);
+            readout->weight = newWeight;
         }
     }
@@ -51,5 +65,5 @@
 
 bool pmReadoutStackValidate(int *minInputColsPtr, int *maxInputColsPtr, int *minInputRowsPtr,
-                            int *maxInputRowsPtr, int *numColsPtr, int *numRowsPtr, 
+                            int *maxInputRowsPtr, int *numColsPtr, int *numRowsPtr,
                             const psArray *inputs)
 {
