Index: trunk/psphot/src/psphot.h
===================================================================
--- trunk/psphot/src/psphot.h	(revision 30624)
+++ trunk/psphot/src/psphot.h	(revision 31154)
@@ -12,4 +12,12 @@
 
 #define PSPHOT_RECIPE_PSF_FAKE_ALLOW "PSF.FAKE.ALLOW" // Name for recipe component permitting fake PSFs
+
+# define READOUT_OR_INTERNAL(VIEW,FILE)((FILE)->mode == PM_FPA_MODE_INTERNAL) ? (FILE)->readout : pmFPAviewThisReadout((VIEW), (FILE)->fpa)
+
+typedef enum {
+    PSPHOT_SINGLE,
+    PSPHOT_FORCED,
+    PSPHOT_MAKE_PSF,
+} psphotImageLoopMode;
 
 // top-level psphot functions
@@ -22,4 +30,6 @@
 void            psphotVersionPrint(void);
 
+bool            psphotImageLoop (pmConfig *config, psphotImageLoopMode mode);
+
 bool            psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe);
 bool            psphotInit (void);
@@ -53,4 +63,7 @@
 bool            psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filerule, int index);
 
+bool            psphotMaskBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
+bool            psphotMaskBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
+
 bool            psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule);
 bool            psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
@@ -168,8 +181,8 @@
 
 // used by psphotFindDetections
-psImage        *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal);
-psArray        *psphotFindPeaks (psImage *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax);
-bool            psphotFindFootprints (pmDetections *detections, psImage *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal);
-psErrorCode     psphotCullPeaks(const pmReadout *readout, const psMetadata *recipe, psArray *footprints);
+pmReadout      *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal);
+psArray        *psphotFindPeaks (pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax);
+bool            psphotFindFootprints (pmDetections *detections, pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal);
+psErrorCode     psphotCullPeaks(const pmReadout *readout, const pmReadout *signifRO, const psMetadata *recipe, psArray *footprints);
 
 // in psphotApResid.c:
@@ -248,4 +261,5 @@
 bool            psphotVisualShowLogSignificance (psImage *image, float min, float max);
 bool            psphotVisualShowPeaks (pmDetections *detections);
+bool            psphotVisualShowSources (psArray *sources);
 bool            psphotVisualShowFootprints (pmDetections *detections);
 bool            psphotVisualShowMoments (psArray *sources);
@@ -305,9 +319,7 @@
 
 pmConfig *psphotForcedArguments(int argc, char **argv);
-bool psphotForcedImageLoop (pmConfig *config);
 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule);
 
 pmConfig *psphotMakePSFArguments(int argc, char **argv);
-bool psphotMakePSFImageLoop (pmConfig *config);
 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule);
 
@@ -430,5 +442,5 @@
 bool psphotRadialApertures (pmConfig *config, const pmFPAview *view, const char *filerule);
 bool psphotRadialAperturesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe);
-bool psphotRadialApertureSource (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal, const psVector *radMax, int entry);
+bool psphotRadialApertureSource (pmSource *source, psMetadata *recipe, psImageMaskType maskVal, const psVector *radMax, int entry);
 
 bool psphotExtendedSourceAnalysisByObject (pmConfig *config, psArray *objects, const pmFPAview *view, const char *filerule);
