Index: trunk/psModules/src/pmReadoutCombine.c
===================================================================
--- trunk/psModules/src/pmReadoutCombine.c	(revision 2276)
+++ trunk/psModules/src/pmReadoutCombine.c	(revision 2277)
@@ -1,3 +1,3 @@
-/** @file  pmReadoutCombine.c
+p/** @file  pmReadoutCombine.c
  *
  *  This file will contain a module which will combine multiple readout images.
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 19:18:50 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-11-04 19:22:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -55,5 +55,5 @@
     PS_PTR_CHECK_NULL(inputs, NULL);
     PS_PTR_CHECK_NULL(params, NULL);
-    //    unsigned int maskVal = params->maskVal;
+    unsigned int maskVal = params->maskVal;
     psStats *stats = params->stats;
     int i;
@@ -146,65 +146,68 @@
         for (j = 0; j < output->numCols ; j++) {
 
+            // XXX: put code in here to figure out for each readout if it has
+            a pixel that corresponds to this output pixel.
+
             for (int r = 0; r < numInputs ; r++) {
-                // if (i,j are valid for this readout) {
-                if (0) {
-                    // tmpPixels->data.F32[r] = WHATEVER;
-                    tmpPixelMask->data.U8[r] = 0;
-                } else {
-                    tmpPixels->data.F32[r] = 0.0;
-                    tmpPixelMask->data.U8[r] = 1;
-                }
-            }
-
-            // Determine how many pixels lie between fracLow and fracHigh.
-            int pixelCount = 0;
-            for (int r = 0; r < numInputs ; r++) {
-                if (tmpPixelMask->data.U8[r] == 0) {
-                    if ((params->fracLow <= tmpPixels->data.F32[r]) &&
-                            (params->fracHigh >= tmpPixels->data.F32[r])) {
-                        pixelCount++;
+                if (i,j are valid for this readout) {
+                        if (0) {
+                            tmpPixels->data.F32[r] = WHATEVER;
+                            tmpPixelMask->data.U8[r] = 0;
+                        } else {
+                            tmpPixels->data.F32[r] = 0.0;
+                            tmpPixelMask->data.U8[r] = 1;
+                        }
                     }
-                }
-            }
-
-            // If more than params->nKeep pixels lie between the valid range,
-            // then loop through the pixels, and mask away any pixels outside
-            // that range.
-            if (pixelCount >= params->nKeep) {
+
+                // Determine how many pixels lie between fracLow and fracHigh.
+                int pixelCount = 0;
                 for (int r = 0; r < numInputs ; r++) {
                     if (tmpPixelMask->data.U8[r] == 0) {
                         if ((params->fracLow <= tmpPixels->data.F32[r]) &&
                                 (params->fracHigh >= tmpPixels->data.F32[r])) {
-                            tmpPixelMaskNKeep->data.U8[r] = 0;
-                        } else {
-                            tmpPixelMaskNKeep->data.U8[r] = 1;
+                            pixelCount++;
                         }
                     }
                 }
+
+                // If more than params->nKeep pixels lie between the valid range,
+                // then loop through the pixels, and mask away any pixels outside
+                // that range.
+                if (pixelCount >= params->nKeep) {
+                    for (int r = 0; r < numInputs ; r++) {
+                        if (tmpPixelMask->data.U8[r] == 0) {
+                            if ((params->fracLow <= tmpPixels->data.F32[r]) &&
+                                    (params->fracHigh >= tmpPixels->data.F32[r])) {
+                                tmpPixelMaskNKeep->data.U8[r] = 0;
+                            } else {
+                                tmpPixelMaskNKeep->data.U8[r] = 1;
+                            }
+                        }
+                    }
+                }
+
+                // Calculate the specified statistic on the stack of pixels.
+                stats = psVectorStats(stats,
+                                      tmpPixels,
+                                      tmpPixelMaskNKeep,
+                                      1);
+
+                // Set the pixel value in the output image to the stat value.
+                double statValue;
+                if (!p_psGetStatValue(stats, &statValue)) {
+                    psError(PS_ERR_UNKNOWN,true, "Could not determine stats value.\n");
+                    return(NULL);
+                } else {
+                    output->data.F32[i][j] = (float) statValue;
+                }
             }
-
-            // Calculate the specified statistic on the stack of pixels.
-            stats = psVectorStats(stats,
-                                  tmpPixels,
-                                  tmpPixelMaskNKeep,
-                                  1);
-
-            // Set the pixel value in the output image to the stat value.
-            double statValue;
-            if (!p_psGetStatValue(stats, &statValue)) {
-                psError(PS_ERR_UNKNOWN,true, "Could not determine stats value.\n");
-                return(NULL);
-            } else {
-                output->data.F32[i][j] = (float) statValue;
-            }
-        }
-    }
-
-    psFree(tmpPixels);
-    psFree(tmpPixels);
-    psFree(tmpPixelMask);
-    psFree(tmpPixelMaskNKeep);
-    psFree(tmpReadouts);
-
-    return(output);
-}
+        }
+
+        psFree(tmpPixels);
+        psFree(tmpPixels);
+        psFree(tmpPixelMask);
+        psFree(tmpPixelMaskNKeep);
+        psFree(tmpReadouts);
+
+        return(output);
+    }
