Index: /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.c
===================================================================
--- /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.c	(revision 14771)
+++ /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.c	(revision 14772)
@@ -18,5 +18,5 @@
 // XXX allow the user to choose the stats method?
 // (SAMPLE_MEAN, CLIPPED_MEAN, ROBUST_MEDIAN, FITTED_MEAN)
-bool psImageBackground(psStats *stats, const psImage *image, const psImage *mask, psMaskType maskValue, psRandom *rng)
+bool psImageBackground(psStats *stats, psVector **sample, const psImage *image, const psImage *mask, psMaskType maskValue, psRandom *rng)
 {
     PS_ASSERT_IMAGE_NON_NULL(image, NULL);
@@ -115,5 +115,9 @@
     }
 
-    psFree(values);
+    if (sample != NULL) {
+	*sample = values;
+    } else {
+	psFree(values);
+    }
     return true;
 }
Index: /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.h
===================================================================
--- /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.h	(revision 14771)
+++ /branches/eam_branch_20070830/psLib/src/imageops/psImageBackground.h	(revision 14772)
@@ -5,6 +5,6 @@
  *  @author EAM, IfA
  *
- *  $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  $Date: 2007-01-23 22:47:23 $
+ *  $Revision: 1.4.12.1 $ $Name: not supported by cvs2svn $
+ *  $Date: 2007-09-07 20:18:03 $
  *  Copyright 2004-2005 IfA, University of Hawaii
  */
@@ -22,4 +22,5 @@
 // Get the background for an image
 bool psImageBackground(psStats *stats, // desired measurement and options
+		       psVector **sample, // vector of data used for analysis
                        const psImage *image, // Image for which to get the background
                        const psImage *mask, // Mask image
@@ -30,2 +31,5 @@
 /// @}
 #endif // #ifndef PS_IMAGE_BACKGROUND_H
+
+/* the user may supply a psVector ** or NULL to sample.  if a vector is supplied,
+   the user must free the resulting vector */
