Index: trunk/ppImage/src/ppImageParseCamera.c
===================================================================
--- trunk/ppImage/src/ppImageParseCamera.c	(revision 29833)
+++ trunk/ppImage/src/ppImageParseCamera.c	(revision 33848)
@@ -22,4 +22,28 @@
     ppImageOptions *options = ppImageOptionsParse(config);
 
+    // parse the header to extract out whether this OTA has video cells.
+    // CZW: 2012-05-01 I'm somewhat ashamed of what needs to be done to get to the header. There has to be a simpler way, right?
+/*     pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest */
+/*     pmChip *chip;                       // Chip from FPA */
+/*     while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { */
+/*       if (!chip->process || !chip->file_exists) { */
+/* 	continue; */
+/*       } */
+/* /\*       if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { *\/ */
+/* /\* 	continue; *\/ */
+/* /\*       } *\/ */
+/*       psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
+/*       if (psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE")) { */
+/* 	psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
+/* 	char *Vptr = strchr(psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE"),'V'); */
+/* 	if (Vptr) { */
+/* 	  options->hasVideo = true; */
+/* 	  psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
+/* 	} */
+/*       } */
+/*     } */
+/*     pmFPAviewReset(view); */
+/*     psFree(view); */
+    
     // the following are defined from the argument list, if given,
     // otherwise they revert to the config information
@@ -42,18 +66,38 @@
     }
     if (options->doDark) {
-        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
-                               PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
+      // Always load the regular Dark
+      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
+			     PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
+	psError(PS_ERR_IO, false, "Can't find a dark image source");
+	psFree(options);
+	return NULL;
+      }
+      // Sometimes load the video dark if we need it.
+      if (options->useVideoDark) {
+        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEODARK", "DARK",
+                               PM_FPA_FILE_DARK, PM_DETREND_TYPE_VIDEODARK)) {
             psError(PS_ERR_IO, false, "Can't find a dark image source");
             psFree(options);
             return NULL;
         }
+      }
     }
     if (options->doMask) {
-        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
-                               PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
+      // Always load the regular mask
+      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
+			     PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
+	psError(PS_ERR_IO, false, "Can't find a mask image source");
+	psFree(options);
+	return NULL;
+      }
+
+      if (options->useVideoMask) {
+	if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEOMASK", "MASK",
+                               PM_FPA_FILE_MASK, PM_DETREND_TYPE_VIDEOMASK)) {
             psError(PS_ERR_IO, false, "Can't find a mask image source");
             psFree(options);
             return NULL;
         }
+      }
     }
     if (options->doShutter) {
