Index: trunk/ppStack/src/ppStackCamera.c
===================================================================
--- trunk/ppStack/src/ppStackCamera.c	(revision 13493)
+++ trunk/ppStack/src/ppStackCamera.c	(revision 13515)
@@ -13,49 +13,54 @@
 bool ppStackCamera(pmConfig *config)
 {
-    psString imageName = psMetadataLookupStr(NULL, config->arguments, "IMAGES.LIST"); // Image list filename
-    assert(imageName);
-    psString maskName = psMetadataLookupStr(NULL, config->arguments, "MASKS.LIST"); // Mask list filename
-    assert(maskName);
-
-    psString imageList = psSlurpFilename(imageName); // Contents of image list
-    if (!imageList) {
-        psError(PS_ERR_IO, false, "Unable to read list of image files %s", imageName);
-        return false;
-    }
-    psArray *images = psStringSplitArray(imageList, "\n", false); // The image filenames
-    psFree(imageList);
-
-    psString maskList = psSlurpFilename(maskName); // Contents of mask list
-    if (!maskList) {
-        psError(PS_ERR_IO, false, "Unable to read list of mask files %s", maskName);
-        return false;
-    }
-    psArray *masks = psStringSplitArray(maskList, "\n", false); // The mask filenames
-    psFree(maskList);
-    if (images->n != masks->n) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                "Number input images (%ld) does not match number of input masks (%ld).",
-                images->n, masks->n);
-        psFree(images);
-        psFree(masks);
-        return false;
-    }
-
-    for (int i = 0; i < images->n; i++) {
-        psString image = images->data[i]; // Name of image
-        if (!image || strlen(image) == 0) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Image name %d is blank.", i);
-            psFree(images);
-            psFree(masks);
-            return false;
-        }
-        psString mask = masks->data[i]; // Name of mask
-        if (!mask || strlen(mask) == 0) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Mask name %d is blank.", i);
-            psFree(images);
-            psFree(masks);
+    psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info
+    psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); // Iterator
+    psMetadataItem *item;               // Item from iteration
+    int i = 0;                          // Counter
+    while ((item = psMetadataGetAndIncrement(iter))) {
+        if (item->type != PS_DATA_METADATA) {
+            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
+                    "Component %s of the input metadata is not of type METADATA", item->name);
+            psFree(iter);
             return false;
         }
 
+        psMetadata *input = item->data.md; // The input metadata of interest
+
+        psString image = psMetadataLookupStr(NULL, input, "IMAGE"); // Name of image
+        if (!image || strlen(image) == 0) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks IMAGE of type STR", item->name);
+            psFree(iter);
+            return false;
+        }
+
+        psString mask = psMetadataLookupStr(NULL, input, "MASK"); // Name of mask
+        if (!mask || strlen(mask) == 0) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks MASK of type STR", item->name);
+            psFree(iter);
+            return false;
+        }
+
+        float seeing = psMetadataLookupF32(NULL, input, "SEEING"); // Seeing FWHM
+        if (isnan(seeing)) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks SEEING of type F32", item->name);
+            psFree(iter);
+            return false;
+        }
+
+        float weight = psMetadataLookupF32(NULL, input, "WEIGHT"); // Relative weight
+        if (isnan(weight)) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks WEIGHT of type F32", item->name);
+            psFree(iter);
+            return false;
+        }
+
+        float scale = psMetadataLookupF32(NULL, input, "SCALE"); // Relative scale
+        if (isnan(scale)) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks SCALE of type F32", item->name);
+            psFree(iter);
+            return false;
+        }
+
+        // Add the image file
         psArray *imageFiles = psArrayAlloc(1); // Array of filenames for this FPA
         imageFiles->data[0] = psMemIncrRefCounter(image);
@@ -68,15 +73,12 @@
         if (!imageFile || !found) {
             psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, image);
-            psFree(images);
-            psFree(masks);
             return false;
         }
         if (imageFile->type != PM_FPA_FILE_IMAGE) {
             psError(PS_ERR_IO, true, "PPSTACK.INPUT is not of type IMAGE");
-            psFree(images);
-            psFree(masks);
             return false;
         }
 
+        // Add the mask file
         psArray *maskFiles = psArrayAlloc(1); // Array of filenames for this FPA
         maskFiles->data[0] = psMemIncrRefCounter(mask);
@@ -90,22 +92,25 @@
         if (!maskFile || !found) {
             psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask);
-            psFree(images);
-            psFree(masks);
             return false;
         }
         if (maskFile->type != PM_FPA_FILE_MASK) {
             psError(PS_ERR_IO, true, "PPSTACK.INPUT.MASK is not of type MASK");
-            psFree(images);
-            psFree(masks);
             return false;
         }
+
+        psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.SEEING", 0,
+                         "Seeing for image", seeing);
+        psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHT", 0,
+                         "Relative weight for image", weight);
+        psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.SCALE", 0,
+                         "Relative scale for image", scale);
+
+        i++;
     }
+    psFree(iter);
     psMetadataRemoveKey(config->arguments, "IMAGE.FILENAMES");
     psMetadataRemoveKey(config->arguments, "MASK.FILENAMES");
 
-    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INPUTS.NUM", 0, "Number of input files", images->n);
-
-    psFree(images);
-    psFree(masks);
+    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INPUTS.NUM", 0, "Number of input files", i);
 
     // Output image
