Index: /trunk/psModules/src/imcombine/pmReadoutCombine.c
===================================================================
--- /trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 9610)
+++ /trunk/psModules/src/imcombine/pmReadoutCombine.c	(revision 9611)
@@ -1,15 +1,2 @@
-/** @file  pmReadoutCombine.c
- *
- *  This file will contain a module which will combine multiple readout images.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-10-13 22:11:02 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -27,43 +14,5 @@
 #include "pmReadoutCombine.h"
 
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// File-static (private) functions
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-// Return the statistic of interest
-static inline double getStat(const psStats *stats, // Statistics structure
-                             psStatsOptions option // Statistics option
-                            )
-{
-    assert(stats);
-
-    switch (option) {
-    case PS_STAT_SAMPLE_MEAN:
-        return stats->sampleMean;
-    case PS_STAT_SAMPLE_MEDIAN:
-        return stats->sampleMedian;
-    case PS_STAT_SAMPLE_STDEV:
-        return stats->sampleStdev;
-    case PS_STAT_ROBUST_MEDIAN:
-        return stats->robustMedian;
-    case PS_STAT_ROBUST_STDEV:
-        return stats->robustStdev;
-    case PS_STAT_FITTED_MEAN:
-        return stats->fittedMean;
-    case PS_STAT_FITTED_STDEV:
-        return stats->fittedStdev;
-    case PS_STAT_CLIPPED_MEAN:
-        return stats->clippedMean;
-    case PS_STAT_CLIPPED_STDEV:
-        return stats->clippedStdev;
-    case PS_STAT_MAX:
-        return stats->max;
-    case PS_STAT_MIN:
-        return stats->min;
-    default:
-        psAbort(__func__, "Bad option: %x\n", option);
-    }
-    return NAN;
-}
+//#define SHOW_BUSY 1                   // Show that the function is busy
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -82,5 +31,5 @@
     params->fracHigh = 0.0;
     params->iter = 1;
-    params->rej = 3.0;
+    params->rej = INFINITY;
 
     return params;
@@ -88,17 +37,11 @@
 
 
-/******************************************************************************
-XXX: Maybe add support for S16 and S32 types.  Currently, only F32 supported.
- *****************************************************************************/
-bool pmReadoutCombine(pmReadout *output,
-                      psArray *inputs,
-                      const psVector *zero,
-                      const psVector *scale,
-                      pmCombineParams *params
-                     )
+// XXX: Maybe add support for S16 and S32 types.  Currently, only F32 supported.
+bool pmReadoutCombine(pmReadout *output, const psArray *inputs, const psVector *zero, const psVector *scale,
+                      const pmCombineParams *params)
 {
     // Check inputs
     PS_ASSERT_PTR_NON_NULL(output, false);
-    PS_ASSERT_PTR_NON_NULL(inputs, false);
+    PS_ASSERT_ARRAY_NON_NULL(inputs, false);
     PS_ASSERT_PTR_NON_NULL(params, false);
     if (zero) {
@@ -307,5 +250,5 @@
     for (int i = minInputRows; i < maxInputRows; i++) {
         int yOut = i - output->row0; // y position on output readout
-        #if 0
+        #ifdef SHOW_BUSY
 
         if (psTraceGetLevel("psModules.imcombine") > 9) {
@@ -325,6 +268,5 @@
                 psImage *image = readout->image; // The readout image
 
-                #if 0
-                // This should have been taken care of already:
+                #if 0 // This should have been taken care of already:
                 // Check bounds
                 if (xIn < 0 || xIn >= image->numCols || yIn < 0 || yIn >= image->numRows) {
@@ -382,12 +324,12 @@
             // Combination
             psVectorStats(stats, pixels, weights, mask, 1);
-            outputImage[yOut][xOut] = getStat(stats, params->combine);
+            outputImage[yOut][xOut] = psStatsGetValue(stats, params->combine);
             if (haveWeights) {
-                float stdev = getStat(stats, combineStdev);
+                float stdev = psStatsGetValue(stats, combineStdev);
                 outputWeight[yOut][xOut] = PS_SQR(stdev); // Variance
             }
         }
     }
-    #if 0
+    #ifdef SHOW_BUSY
     if (psTraceGetLevel("psModules.imcombine") > 9) {
         printf("\n");
Index: /trunk/psModules/src/imcombine/pmReadoutCombine.h
===================================================================
--- /trunk/psModules/src/imcombine/pmReadoutCombine.h	(revision 9610)
+++ /trunk/psModules/src/imcombine/pmReadoutCombine.h	(revision 9611)
@@ -1,49 +1,50 @@
-/** @file  pmReadoutCombine.h
- *
- *  This file will contain a module which will combine multiple readout images.
- *
- *  @author GLG, MHPCC
- *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-01 02:26:32 $
- *
- *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
- *
- */
+/// @file  pmReadoutCombine.h
+///
+/// @brief Combine multiple readouts
+///
+/// @ingroup Image combination
+///
+/// @author George Gusciora, MHPCC
+/// @author Paul Price, IfA
+///
+/// @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+/// @date $Date: 2006-10-17 20:13:04 $
+///
+/// Copyright 2004-2006 Institute for Astronomy, University of Hawaii
+///
+///
 
-#if !defined(PM_READOUT_COMBINE_H)
+#ifndef PM_READOUT_COMBINE_H
 #define PM_READOUT_COMBINE_H
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
 
 #include <pslib.h>
 #include "pmFPA.h"
 
-// Combination parameters for pmReadoutCombine.  These values define how the combination is performed, and
-// should not vary by detector, so that it can be re-used for multiple combinations.
+/// Combination parameters for pmReadoutCombine.
+///
+/// These values define how the combination is performed, and should not vary by detector, so that it can be
+/// re-used for multiple combinations.
 typedef struct
 {
-    psStatsOptions combine;             // Statistic to use when performing the combination
-    psMaskType maskVal;                 // Mask value
-    int nKeep;                          // Mimimum number of pixels to keep
-    float fracHigh;                     // Fraction of high pixels to immediately throw
-    float fracLow;                      // Fraction of low pixels to immediately throw
-    int iter;                           // Number of iterations for clipping (for CLIPPED_MEAN only)
-    float rej;                          // Rejection threshould for clipping (for CLIPPED_MEAN only)
+    psStatsOptions combine;             ///< Statistic to use when performing the combination
+    psMaskType maskVal;                 ///< Mask value
+    int nKeep;                          ///< Mimimum number of pixels to keep
+    float fracHigh;                     ///< Fraction of high pixels to immediately throw
+    float fracLow;                      ///< Fraction of low pixels to immediately throw
+    int iter;                           ///< Number of iterations for clipping (for CLIPPED_MEAN only)
+    float rej;                          ///< Rejection threshould for clipping (for CLIPPED_MEAN only)
 }
 pmCombineParams;
 
-// Allocator
-pmCombineParams *pmCombineParamsAlloc(psStatsOptions statsOptions // Statistic to use for combination
+// Allocator for pmCombineParams
+pmCombineParams *pmCombineParamsAlloc(psStatsOptions statsOptions ///< Statistic to use for combination
                                      );
 
-// Combine multiple readouts, applying zero and scale, with optional minmax clipping
-bool pmReadoutCombine(pmReadout *output,// Output readout; altered and returned
-                      psArray *inputs,  // Array of input readouts (F32 image and weight, U8 mask)
-                      const psVector *zero, // Zero corrections to subtract from input, or NULL
-                      const psVector *scale, // Scale corrections to divide into input, or NULL
-                      pmCombineParams *params // Combination parameters
+/// Combine multiple readouts, applying zero and scale, with optional minmax clipping
+bool pmReadoutCombine(pmReadout *output,///< Output readout; altered and returned
+                      const psArray *inputs,  ///< Array of input readouts (F32 image and weight, U8 mask)
+                      const psVector *zero, ///< Zero corrections to subtract from input, or NULL
+                      const psVector *scale, ///< Scale corrections to divide into input, or NULL
+                      const pmCombineParams *params ///< Combination parameters
                      );
 
