Index: trunk/psModules/src/camera/pmFPA_JPEG.c
===================================================================
--- trunk/psModules/src/camera/pmFPA_JPEG.c	(revision 7311)
+++ trunk/psModules/src/camera/pmFPA_JPEG.c	(revision 7382)
@@ -5,6 +5,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-03 01:02:08 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-06-07 03:27:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,7 +17,4 @@
 
 #include <pslib.h>
-# include "psImageJpeg.h"
-# include "psImageUnbin.h"
-# include "psAdditionals.h"
 
 #include "pmHDU.h"
@@ -141,8 +138,6 @@
 
         // XXX we need to decide where the scale will come from in the long term
-        unsigned long seed = 0;
-        psImageClippedStatsInit (10000, seed);
-
-        psStats *stats = psImageClippedStats (readout->image, NULL, 0, 0.25, 0.75);
+        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
+        psStats *stats = psImageBackground(readout->image, NULL, 0, 0.25, 0.75, 10000, rng);
         float delta = stats->robustUQ - stats->robustLQ;
         float min = stats->robustMedian - 3*delta;
@@ -162,11 +157,11 @@
         psImageJpeg (map, readout->image, name, min, max);
 
-        psFree (name);
-        psFree (mode);
-        psFree (word);
-        psFree (mapname);
-        psFree (map);
-        psFree (stats);
-        psImageClippedStatsCleanup ();
+        psFree(name);
+        psFree(mode);
+        psFree(word);
+        psFree(mapname);
+        psFree(map);
+        psFree(stats);
+        psFree(rng);
 
         return true;
