Index: trunk/ppStack/src/ppStackSetup.c
===================================================================
--- trunk/ppStack/src/ppStackSetup.c	(revision 23341)
+++ trunk/ppStack/src/ppStackSetup.c	(revision 23573)
@@ -11,4 +11,34 @@
 #include "ppStackLoop.h"
 
+#define BUFFER 16                       // Buffer for name array
+
+// Generate an array of input filenames
+static psArray *stackNameArray(pmConfig *config, // Configuration
+                               const char *name // Name of file
+    )
+{
+    psAssert(config, "Require configuration");
+    psAssert(config, "Require file name");
+
+    psString regex = NULL;             // Regular expression for selecting file
+    psStringAppend(&regex, "^%s$", name);
+    psMetadataIterator *iter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, regex); // Iterator
+    psFree(regex);
+    psMetadataItem *item;               // Item from iteration
+    psArray *array = psArrayAlloc(BUFFER); // Array of file names
+    while ((item = psMetadataGetAndIncrement(iter))) {
+        psAssert(item->type == PS_DATA_UNKNOWN, "Should be this type");
+        pmFPAfile *file = item->data.V; // An input file
+
+        psString filename = psStringCopy(file->filename); // Filename of interest
+        psArrayAdd(array, array->n, filename);
+        psFree(filename);               // Drop reference
+    }
+    psFree(iter);
+
+    return array;
+}
+
+
 bool ppStackSetup(ppStackOptions *options, pmConfig *config)
 {
@@ -18,4 +48,10 @@
     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
     psAssert(recipe, "We've thrown an error on this before.");
+
+    options->convolve = psMetadataLookupBool(NULL, config->arguments, "CONVOLVE"); // Convolve images?
+    if (!psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) {
+        psWarning("No PSFs provided --- unable to convolve to common PSF.");
+        options->convolve = false;
+    }
 
     int num = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs
@@ -36,43 +72,50 @@
     }
 
-    const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images
-    if (!tempDir) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe");
-        return false;
+    // Generate temporary names for convolved images
+    if (options->convolve) {
+        const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images
+        if (!tempDir) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe");
+            return false;
+        }
+
+        psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments,
+                                                               "OUTPUT")); // Name for temporary files
+        const char *tempName = basename(outputName);
+        if (!tempName) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");
+            psFree(outputName);
+            return false;
+        }
+
+        const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for images
+        const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for masks
+        const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for var maps
+        if (!tempImage || !tempMask || !tempVariance) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe");
+            psFree(outputName);
+            return false;
+        }
+
+        options->imageNames = psArrayAlloc(num);
+        options->maskNames = psArrayAlloc(num);
+        options->varianceNames = psArrayAlloc(num);
+        for (int i = 0; i < num; i++) {
+            psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images
+            psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage);
+            psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask);
+            psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance);
+            psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName);
+            options->imageNames->data[i] = imageName;
+            options->maskNames->data[i] = maskName;
+            options->varianceNames->data[i] = varianceName;
+        }
+        psFree(outputName);
+    } else {
+        options->imageNames = stackNameArray(config, "PPSTACK.INPUT");
+        options->maskNames = stackNameArray(config, "PPSTACK.INPUT.MASK");
+        options->varianceNames = stackNameArray(config, "PPSTACK.INPUT.VARIANCE");
     }
-
-    psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments,
-                                                           "OUTPUT")); // Name for temporary files
-    const char *tempName = basename(outputName);
-    if (!tempName) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");
-        psFree(outputName);
-        return false;
-    }
-
-    const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for temporary images
-    const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for temporary masks
-    const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for temp var maps
-    if (!tempImage || !tempMask || !tempVariance) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
-                "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe");
-        psFree(outputName);
-        return false;
-    }
-
-    options->imageNames = psArrayAlloc(num);
-    options->maskNames = psArrayAlloc(num);
-    options->varianceNames = psArrayAlloc(num);
-    for (int i = 0; i < num; i++) {
-        psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images
-        psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage);
-        psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask);
-        psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance);
-        psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName);
-        options->imageNames->data[i] = imageName;
-        options->maskNames->data[i] = maskName;
-        options->varianceNames->data[i] = varianceName;
-    }
-    psFree(outputName);
 
     if (!pmConfigMaskSetBits(NULL, NULL, config)) {
