Index: trunk/psModules/src/camera/pmFPAfileFitsIO.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileFitsIO.c	(revision 18330)
+++ trunk/psModules/src/camera/pmFPAfileFitsIO.c	(revision 18554)
@@ -7,4 +7,5 @@
 
 #include "pmConfig.h"
+#include "pmConfigMask.h"
 #include "pmDetrendDB.h"
 
@@ -496,4 +497,13 @@
     }
 
+    // whenever we write out a mask image, we should define the bits which represent mask concepts
+    if (file->type == PM_FPA_FILE_MASK) {
+	assert (phu->header);
+	if (!pmConfigMaskWriteHeader (config, phu->header)) {
+	    psError(PS_ERR_UNKNOWN, false, "failed to set the bitmask names in the PHU header for Image %s (%s)\n", file->filename, file->name);
+	    return false;
+	}
+    }
+
     switch (file->fileLevel) {
       case PM_FPA_LEVEL_FPA:
