Index: trunk/psModules/src/camera/pmFPAfileIO.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileIO.c	(revision 10827)
+++ trunk/psModules/src/camera/pmFPAfileIO.c	(revision 10966)
@@ -465,5 +465,6 @@
 
     // do we need to write this file?
-    if (level != file->dataLevel) {
+    if ((file->mosaicLevel == PM_FPA_LEVEL_NONE && level != file->dataLevel) || // No mosaicking happening
+            (file->mosaicLevel != PM_FPA_LEVEL_NONE && level != file->mosaicLevel)) { // Mosaicking happening
         psTrace("psModules.camera", 6, "skip writing of %s at this level %s: dataLevel is %s",
                 file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
@@ -472,5 +473,7 @@
 
     // do we need to open this file?
-    if (level >= file->fileLevel) {
+    if (level >= file->fileLevel &&
+            (file->mosaicLevel == PM_FPA_LEVEL_NONE ||
+             (file->mosaicLevel != PM_FPA_LEVEL_NONE && level >= file->mosaicLevel))) {
         if (!pmFPAfileOpen (file, view, config)) {
             psError(PS_ERR_IO, false, "failed to open %s", file->filename);
@@ -540,5 +543,5 @@
 
 // create the data elements (headers, images) appropriate for this view
-bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view)
+bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view, const pmConfig *config)
 {
     PS_ASSERT_PTR_NON_NULL(file, false);
@@ -571,5 +574,5 @@
 
     // do we need to write this file?
-    if (level != file->fileLevel) {
+    if (level != file->fileLevel || file->mosaicLevel != PM_FPA_LEVEL_NONE) {
         psTrace("psModules.camera", 6, "skip creation of %s at this level %s: fileLevel is %s",
                 file->name, pmFPALevelToName(level), pmFPALevelToName(file->fileLevel));
@@ -581,10 +584,29 @@
     case PM_FPA_FILE_MASK:
     case PM_FPA_FILE_WEIGHT:
-    case PM_FPA_FILE_FRINGE:
-        // create FPA structure component based on view
-        pmFPAAddSourceFromView (file->fpa, view, file->format);
-        psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
-        break;
-
+    case PM_FPA_FILE_FRINGE: {
+            // create FPA structure component based on view
+            #if 0
+            psMetadata *format = file->format; // Camera format configuration
+            if (!format) {
+                // It's likely a mosaic, for which we don't yet know the appropriate format
+                const psMetadata *camera = file->fpa->camera; // Camera configuration
+                psMetadata *formats = psMetadataLookupMetadata(NULL, camera, "FORMATS"); // The FORMATS
+                if (!formats) {
+                    psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FORMATS in camera configuration.\n");
+                    return false;
+                }
+                format = psMetadataLookupMetadata(NULL, formats, config->formatName);
+                if (!format) {
+                    psError(PS_ERR_UNEXPECTED_NULL, false,
+                            "Unable to find format %s in camera configuration.\n", config->formatName);
+                    return false;
+                }
+                file->format = psMemIncrRefCounter(format);
+            }
+            #endif
+            pmFPAAddSourceFromView (file->fpa, view, file->format);
+            psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
+            break;
+        }
     case PM_FPA_FILE_SX:
     case PM_FPA_FILE_RAW:
@@ -727,5 +749,5 @@
                 goto failure;
             }
-            if (!pmFPAfileCreate(file, view)) {
+            if (!pmFPAfileCreate(file, view, config)) {
                 psError(PS_ERR_IO, false, "failed CREATE in FPA_BEFORE block for %s", file->name);
                 goto failure;
