Index: trunk/psModules/src/camera/pmFPARead.c
===================================================================
--- trunk/psModules/src/camera/pmFPARead.c	(revision 16365)
+++ trunk/psModules/src/camera/pmFPARead.c	(revision 16366)
@@ -108,4 +108,5 @@
                                   pmReadout *readout, // Readout of interest
                                   int numScans, // Number of scans to read at a time
+                                  int overlap, // Number of scans to overlap with previous read
                                   fpaReadType type // Type of image
     )
@@ -173,5 +174,5 @@
             *next = trimsec->x0;
         } else {
-            *next = image ? readout->row0 + numScans : 0;
+            *next = image ? readout->row0 + numScans - overlap : 0;
         }
         *last = trimsec->y1;
@@ -181,5 +182,5 @@
             *next = trimsec->y0;
         } else {
-            *next = image ? readout->row0 + numScans : 0;
+            *next = image ? readout->col0 + numScans - overlap : 0;
         }
         *last = trimsec->x1;
@@ -210,4 +211,5 @@
                         int z,          // Plane number
                         int numScans,   // Number of scans to read at a time
+                        int overlap,    // Number of scans to overlap with last read
                         fpaReadType type // Type of image
     )
@@ -237,5 +239,5 @@
     int next;                           // Next position
     int last;                           // Last position
-    if (!readoutScanProperties(&next, &last, readout, numScans, type)) {
+    if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
         return false;
@@ -393,4 +395,5 @@
                              int z,     // Desired image plane
                              int numScans, // Number of scans (row or col depends on CELL.READDIR); 0 for all
+                             int overlap, // Number of scans (row/col) to overlap between scans
                              fpaReadType type // Type of image
     )
@@ -400,7 +403,8 @@
     assert(z >= 0);
     assert(numScans >= 0);
-
-    psImage **imagePtr = readoutImageByType(readout, type); // Pointer to the image of interest
-    if (*imagePtr && numScans == 0) {
+    assert(overlap >= 0);
+
+    psImage **image = readoutImageByType(readout, type); // Pointer to the image of interest
+    if (*image && numScans == 0) {
         psError(PS_ERR_UNKNOWN, true, "Already read entire image --- won't clobber.");
         return false;
@@ -422,5 +426,5 @@
     int next;                           // Next position
     int last;                           // Last position
-    if (!readoutScanProperties(&next, &last, readout, numScans, type)) {
+    if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
         return false;
@@ -441,8 +445,4 @@
     }
     float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level
-    if (!mdok) {
-        psLogMsg(__func__, PS_LOG_WARN, "CELL.BAD is not set --- assuming zero.\n");
-        bad = 0.0;
-    }
     psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim sections
     if (!mdok || !trimsec || psRegionIsNaN(*trimsec)) {
@@ -479,8 +479,10 @@
     }
     int upper = next + numScans;        // Upper limit to next section
+    if (!*image) {
+        upper += overlap;
+    }
 
     // Blow away existing data.
     // Do this before returning, so that we're not returning data from a previous read
-    psImage **image = readoutImageByType(readout, type);
     psFree(*image);
     *image = NULL;
@@ -880,13 +882,13 @@
 
 
-bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans)
+bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
 {
     PS_ASSERT_PTR_NON_NULL(readout, false);
     PS_ASSERT_FITS_NON_NULL(fits, false);
 
-    return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);
-}
-
-bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans)
+    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE);
+}
+
+bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
 {
     PS_ASSERT_PTR_NON_NULL(readout, false);
@@ -895,5 +897,5 @@
     PS_ASSERT_INT_NONNEGATIVE(numScans, false);
 
-    return readoutReadChunk(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);
+    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE);
 }
 
@@ -903,5 +905,5 @@
     PS_ASSERT_FITS_NON_NULL(fits, false);
 
-    return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_IMAGE);
+    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE);
 }
 
@@ -943,4 +945,22 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
+bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
+{
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
+
+    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK);
+}
+
+bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
+{
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_INT_NONNEGATIVE(z, false);
+    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
+
+    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK);
+}
+
 bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z)
 {
@@ -948,5 +968,5 @@
     PS_ASSERT_FITS_NON_NULL(fits, false);
 
-    return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_MASK);
+    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK);
 }
 
@@ -979,4 +999,22 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
+bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
+{
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
+
+    return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT);
+}
+
+bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap)
+{
+    PS_ASSERT_PTR_NON_NULL(readout, false);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
+    PS_ASSERT_INT_NONNEGATIVE(z, false);
+    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
+
+    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT);
+}
+
 bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z)
 {
@@ -984,5 +1022,5 @@
     PS_ASSERT_FITS_NON_NULL(fits, false);
 
-    return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_WEIGHT);
+    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT);
 }
 
