Index: trunk/psModules/src/imcombine/pmImageCombine.c
===================================================================
--- trunk/psModules/src/imcombine/pmImageCombine.c	(revision 7868)
+++ trunk/psModules/src/imcombine/pmImageCombine.c	(revision 8004)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-30 23:59:49 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-28 03:21:19 $
  *
  *  XXX: pmRejectPixels() has a known bug with the pmImageTransform() call.
@@ -45,5 +45,5 @@
     psS32 numIter,                      ///< Number of rejection iterations
     psF32 sigmaClip,                    ///< Number of standard deviations at which to reject
-    const psStats *stats)               ///< Statistics to use in the combination
+    psStats *stats)               ///< Statistics to use in the combination
 {
 
@@ -98,4 +98,9 @@
     }
     PS_ASSERT_PTR_NON_NULL(stats, combine);
+    psStatsOptions statistic = psStatsSingleOption(stats->options);
+    if (statistic == 0) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Multiple or no statistics options set: %x\n", statistic);
+        return combine;
+    }
 
     // Allocate and initialize the combined image, if necessary.
@@ -185,10 +190,7 @@
                 // Combine all the pixels, using the specified stat.
 
-                stats = psVectorStats((psStats *) stats, pixelData, pixelErrors, pixelMask, maskVal);
-                psF64 combinedPixel;
-                psBool rc = p_psGetStatValue(stats, &combinedPixel);
-                if (rc != true) {
-                    psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not combine pixels (%d, %d) with the specified stat.\n", row, col);
-                }
+                stats = psVectorStats(stats, pixelData, pixelErrors, pixelMask, maskVal);
+                psF64 combinedPixel = psStatsGetValue(stats, statistic);
+
                 if (iter == 0) {
                     combine->data.F32[row][col] = (psF32) combinedPixel;
@@ -202,10 +204,5 @@
                 for (psS32 im = 0 ; im < numImages ; im++) {
                     stdevStats = psVectorStats(stdevStats, pixelData, pixelErrors, pixelMask, maskVal);
-                    psF64 stdev;
-                    psBool rc = p_psGetStatValue(stdevStats, &stdev);
-                    if (rc != true) {
-                        psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not compute the standard deviation of pixel (%d, %d).\n", row, col);
-                        psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not combine pixels (%d, %d) with the specified stat.\n", row, col);
-                    }
+                    psF64 stdev = stdevStats->sampleStdev;
 
                     if (!(pixelMask->data.U8[im] & maskVal)) {
@@ -289,11 +286,6 @@
                 }
                 // Combine all the pixels, using the specified stat.
-                stats = psVectorStats((psStats *) stats, pixelData, pixelErrors, pixelMask, maskVal);
-                psF64 tmpF64;
-                psBool rc = p_psGetStatValue(stats, &tmpF64);
-                combine->data.F32[row][col] = (psF32) tmpF64;
-                if (rc != true) {
-                    psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not combine pixels (%d, %d) with the specified stat.\n", row, col);
-                }
+                stats = psVectorStats(stats, pixelData, pixelErrors, pixelMask, maskVal);
+                combine->data.F32[row][col] = psStatsGetValue(stats, statistic);
             }
         }
Index: trunk/psModules/src/imcombine/pmImageCombine.h
===================================================================
--- trunk/psModules/src/imcombine/pmImageCombine.h	(revision 7868)
+++ trunk/psModules/src/imcombine/pmImageCombine.h	(revision 8004)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-28 20:43:52 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-28 03:21:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +36,5 @@
     psS32 numIter,                      ///< Number of rejection iterations
     psF32 sigmaClip,                    ///< Number of standard deviations at which to reject
-    const psStats *stats                ///< Statistics to use in the combination
+    psStats *stats                      ///< Statistics to use in the combination
 );
 
