Index: trunk/psModules/src/imcombine/pmSubtractionMatch.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 23851)
+++ trunk/psModules/src/imcombine/pmSubtractionMatch.c	(revision 23937)
@@ -64,5 +64,6 @@
                       psImage *variance,  // Variance map
                       const psRegion *region, // Region of interest, or NULL
-                      float threshold,  // Threshold for stamp finding
+                      float thresh1,  // Threshold for stamp finding on readout 1
+                      float thresh2,  // Threshold for stamp finding on readout 2
                       float stampSpacing, // Spacing between stamps
                       int size,         // Kernel half-size
@@ -72,6 +73,9 @@
 {
     psTrace("psModules.imcombine", 3, "Finding stamps...\n");
-    *stamps = pmSubtractionStampsFind(*stamps, ro1->image, subMask, region, threshold, size, footprint,
-                                      stampSpacing, mode);
+
+    psImage *image1 = ro1 ? ro1->image : NULL, *image2 = ro2 ? ro2->image : NULL; // Images of interest
+
+    *stamps = pmSubtractionStampsFind(*stamps, image1, image2, subMask, region, thresh1, thresh2,
+                                      size, footprint, stampSpacing, mode);
     if (!*stamps) {
         psError(psErrorCodeLast(), false, "Unable to find stamps.");
@@ -392,13 +396,25 @@
     }
 
+    float stampThresh1 = NAN, stampThresh2 = NAN; // Stamp thresholds for images
     {
         psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for backgroun
-        if (!psImageBackground(bg, NULL, ro1->image, ro1->mask, maskVal, rng)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
-            psFree(bg);
-            psFree(rng);
-            goto MATCH_ERROR;
-        }
-        threshold = bg->robustMedian + threshold * bg->robustStdev;
+        if (ro1) {
+            if (!psImageBackground(bg, NULL, ro1->image, ro1->mask, maskVal, rng)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
+                psFree(bg);
+                psFree(rng);
+                goto MATCH_ERROR;
+            }
+            stampThresh1 = bg->robustMedian + threshold * bg->robustStdev;
+        }
+        if (ro2) {
+            if (!psImageBackground(bg, NULL, ro2->image, ro2->mask, maskVal, rng)) {
+                psError(PS_ERR_UNKNOWN, false, "Unable to measure background statistics.");
+                psFree(bg);
+                psFree(rng);
+                goto MATCH_ERROR;
+            }
+            stampThresh2 = bg->robustMedian + threshold * bg->robustStdev;
+        }
         psFree(bg);
     }
@@ -428,6 +444,6 @@
             // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
             // doesn't matter.
-            if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, threshold, stampSpacing,
-                           size, footprint, subMode)) {
+            if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2,
+                           stampSpacing, size, footprint, subMode)) {
                 goto MATCH_ERROR;
             }
@@ -490,6 +506,6 @@
                 psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
 
-                if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, threshold, stampSpacing,
-                               size, footprint, subMode)) {
+                if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2,
+                               stampSpacing, size, footprint, subMode)) {
                     goto MATCH_ERROR;
                 }
