Index: trunk/psphot/src/psphot.c
===================================================================
--- trunk/psphot/src/psphot.c	(revision 4215)
+++ trunk/psphot/src/psphot.c	(revision 4216)
@@ -1,4 +1,3 @@
 # include "psphot.h"
-void dump_image (psImage *image, char *filename);
 
 int main (int argc, char **argv) {
@@ -32,16 +31,16 @@
 
     // use stellar objects SN > PSF_SN_LIM
-    psf = choose_psf_model (image, config, sources);
+    psf = choose_psf_model (imdata, config, sources);
 
     if (0) { 
-      psImage *zap = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
+      psImage *zap = psImageAlloc (imdata->image->numCols, imdata->image->numRows, PS_TYPE_F32);
       psImageInit (zap, 0);
       find_defects (zap, sources, config, psf);
-      dump_image (zap, argv[2]);
+      DumpImage (zap, argv[2]);
       exit (0);
     }
 
     // test PSF on all except SATURATE and DEFECT (artifacts)
-    apply_psf_model (image, config, sources, psf, sky);
+    apply_psf_model (imdata, config, sources, psf, sky);
 
     // XXX this test compares dSx,dSy distribution with model.
@@ -49,20 +48,10 @@
     // test_psf_scatter (sources);
 
-    // fit_galaxies (image, config, sources);
+    // fit_galaxies (imdata, config, sources);
 
     // subtract_galaxies (sources, config);
  
-    dump_image (image, argv[2]);
+    DumpImage (imdata->image, argv[2]);
     DumpModelPSF (sources, "sources.dat");
     exit (0);
 }
-
-void dump_image (psImage *image, char *filename) {
-
-    unlink (filename);
-    psFits *fits = psFitsAlloc (filename);
-    psFitsWriteImage (fits, NULL, image, 0, NULL);
-    psFree (fits);
-    return;
-}
-
