Index: /trunk/psphot/src/psphotOutput.c
===================================================================
--- /trunk/psphot/src/psphotOutput.c	(revision 19951)
+++ /trunk/psphot/src/psphotOutput.c	(revision 19952)
@@ -115,6 +115,22 @@
 
     int nSrc = 0;
-
-    // count the number of sources which will be written
+    int nCR  = 0;
+    int nEXT = 0;
+
+    // count the number of sources which will be written and other sub-types
+    for (int i = 0; (sources != NULL) && (i < sources->n); i++) {
+        pmSource *source = (pmSource *) sources->data[i];
+        pmModel *model = pmSourceGetModel (NULL, source);
+        if (model == NULL)
+            continue;
+	if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
+	    nEXT ++;
+	}
+	if (source->mode & PM_SOURCE_MODE_CR_LIMIT) {
+	    nCR ++;
+	}
+        nSrc ++;
+    }
+
     for (int i = 0; (sources != NULL) && (i < sources->n); i++) {
         pmSource *source = (pmSource *) sources->data[i];
@@ -124,5 +140,8 @@
         nSrc ++;
     }
-    psMetadataAdd (recipe, PS_LIST_TAIL, "NSTARS", PS_DATA_S32 | PS_META_REPLACE, "NUMBER OF STARS", nSrc);
+
+    psMetadataAddS32 (recipe, PS_LIST_TAIL, "NSTARS",   PS_META_REPLACE, "Number of sources", nSrc);
+    psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_EXT", PS_META_REPLACE, "Number of extended sources", nEXT);
+    psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_CR",  PS_META_REPLACE, "Number of cosmic rays", nCR);
     return true;
 }
@@ -152,10 +171,35 @@
 
     // Image Quality measurements
+    psMetadataItemSupplement (header, recipe, "IQ_NSTAR");
+
+    psMetadataItemSupplement (header, recipe, "IQ_FW1");
+    psMetadataItemSupplement (header, recipe, "IQ_FW1_E");
+    psMetadataItemSupplement (header, recipe, "IQ_FW2");
+    psMetadataItemSupplement (header, recipe, "IQ_FW2_E");
+
     psMetadataItemSupplement (header, recipe, "IQ_M2");
-    psMetadataItemSupplement (header, recipe, "IQ_D_M2");
+    psMetadataItemSupplement (header, recipe, "IQ_M2_ER");
+    psMetadataItemSupplement (header, recipe, "IQ_M2_LQ");
+    psMetadataItemSupplement (header, recipe, "IQ_M2_UQ");
+
+    psMetadataItemSupplement (header, recipe, "IQ_M2C");
+    psMetadataItemSupplement (header, recipe, "IQ_M2C_E");
+    psMetadataItemSupplement (header, recipe, "IQ_M2C_L");
+    psMetadataItemSupplement (header, recipe, "IQ_M2C_U");
+
+    psMetadataItemSupplement (header, recipe, "IQ_M2S");
+    psMetadataItemSupplement (header, recipe, "IQ_M2S_E");
+    psMetadataItemSupplement (header, recipe, "IQ_M2S_L");
+    psMetadataItemSupplement (header, recipe, "IQ_M2S_U");
+
     psMetadataItemSupplement (header, recipe, "IQ_M3");
-    psMetadataItemSupplement (header, recipe, "IQ_D_M3");
+    psMetadataItemSupplement (header, recipe, "IQ_M3_ER");
+    psMetadataItemSupplement (header, recipe, "IQ_M3_LQ");
+    psMetadataItemSupplement (header, recipe, "IQ_M3_UQ");
+
     psMetadataItemSupplement (header, recipe, "IQ_M4");
-    psMetadataItemSupplement (header, recipe, "IQ_D_M4");
+    psMetadataItemSupplement (header, recipe, "IQ_M4_ER");
+    psMetadataItemSupplement (header, recipe, "IQ_M4_LQ");
+    psMetadataItemSupplement (header, recipe, "IQ_M4_UQ");
 
     // XXX these need to be defined from elsewhere
