Index: /trunk/psModules/src/detrend/pmFlatField.c
===================================================================
--- /trunk/psModules/src/detrend/pmFlatField.c	(revision 7857)
+++ /trunk/psModules/src/detrend/pmFlatField.c	(revision 7858)
@@ -18,6 +18,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-07-10 20:46:57 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-10 20:54:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,4 +33,5 @@
 
 #include <pslib.h>
+#include "pmFPA.h"
 #include "pmFlatField.h"
 #include "pmFPAMaskWeight.h"
@@ -56,15 +57,8 @@
     psImage *flatImage = flat->image;   // Flat-field image
 
-    // Check input image and its mask are not larger than flat image
+    // Check input image is not larger than flat image; mask is the same size as the input
     if (inImage->numRows > flatImage->numRows || inImage->numCols > flatImage->numCols) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
-                PS_ERRORTEXT_pmFlatField_SIZE_INPUT_IMAGE,
-                inImage->numRows, inImage->numCols, flatImage->numRows, flatImage->numCols);
-        return false;
-    }
-    if (inMask && (inMask->numRows > flatImage->numRows || inMask->numCols > flatImage->numCols)) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
-                PS_ERRORTEXT_pmFlatField_SIZE_MASK_IMAGE,
-                inMask->numRows, inMask->numCols, flatImage->numRows, flatImage->numCols);
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Input image (%dx%d) is larger than flat-field image "
+                "(%dx%d).\n", inImage->numCols, inImage->numRows, flatImage->numCols, flatImage->numRows);
         return false;
     }
@@ -81,9 +75,9 @@
 
     // Check that offsets are within image limits
-    if (inImage->numRows + yOffset >= flatImage->numRows ||
-            inImage->numCols + xOffset >= flatImage->numCols) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
-                PS_ERRORTEXT_pmFlatField_OFFSET_FLAT_IMAGE,
-                yOffset, xOffset, flatImage->numRows, flatImage->numCols);
+    if (inImage->numRows + yOffset > flatImage->numRows ||
+            inImage->numCols + xOffset > flatImage->numCols) {
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Input image (%dx%d) with offsets (%d,%d) is larger than "
+                "flat-field image (%dx%d).\n", inImage->numCols, inImage->numRows, xOffset, yOffset,
+                flatImage->numCols, flatImage->numRows);
         return false;
     }
@@ -118,7 +112,5 @@
         FLAT_DIVISION_CASE(F64, NAN);
     default:
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                PS_ERRORTEXT_pmFlatField_TYPE_UNSUPPORTED,
-                inImage->type.type);
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unsupported type for input image: %x\n", inImage->type.type);
         return false;
     }
