Index: /trunk/psLib/psLib.kdevses
===================================================================
--- /trunk/psLib/psLib.kdevses	(revision 1839)
+++ /trunk/psLib/psLib.kdevses	(revision 1840)
@@ -2,5 +2,36 @@
 <!DOCTYPE KDevPrjSession>
 <KDevPrjSession>
- <DocsAndViews NumberOfDocuments="0" />
+ <DocsAndViews NumberOfDocuments="6" >
+  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/psErrorCodes.dat" >
+   <View0 line="14" Type="???" >
+    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
+   </View0>
+  </Doc0>
+  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageErrors.dat" >
+   <View0 line="35" Type="???" >
+    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="747" Left="1" MinMaxMode="0" />
+   </View0>
+  </Doc1>
+  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageIO.c" >
+   <View0 line="374" Type="???" >
+    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
+   </View0>
+  </Doc2>
+  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageFFT.c" >
+   <View0 line="0" Type="???" >
+    <AdditionalSettings Top="2" Width="1214" Attach="1" Height="747" Left="2" MinMaxMode="0" />
+   </View0>
+  </Doc3>
+  <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageFFT.h" >
+   <View0 line="0" Type="???" >
+    <AdditionalSettings Top="2" Width="1214" Attach="1" Height="745" Left="2" MinMaxMode="0" />
+   </View0>
+  </Doc4>
+  <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageErrors.h" >
+   <View0 line="64" Type="???" >
+    <AdditionalSettings Top="1" Width="1216" Attach="1" Height="749" Left="1" MinMaxMode="0" />
+   </View0>
+  </Doc5>
+ </DocsAndViews>
  <pluginList>
   <kdevbookmarks>
@@ -10,4 +41,7 @@
      <mark line="652" />
      <mark line="593" />
+    </bookmark>
+    <bookmark url="/home/desonia/psLib/src/collections/psBitSet.c" >
+     <mark line="194" />
     </bookmark>
    </bookmarks>
Index: /trunk/psLib/src/fft/psImageFFT.c
===================================================================
--- /trunk/psLib/src/fft/psImageFFT.c	(revision 1839)
+++ /trunk/psLib/src/fft/psImageFFT.c	(revision 1840)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-25 21:10:09 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,6 @@
 #include "psImageExtraction.h"
 
+#include "psImageErrors.h"
+
 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
 
@@ -42,5 +44,10 @@
 
     if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
-        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -48,5 +55,10 @@
 
     if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
-        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -55,5 +67,10 @@
 
     if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
-        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -69,13 +86,15 @@
     numCols = in->numCols;
 
+    // n.b. FFTW can perform a in-place transform at the same or faster than out-of-place.
     out = psImageCopy(out, in, PS_TYPE_C32);
-
     plan = fftwf_plan_dft_2d(numCols, numRows,
                              (fftwf_complex *) out->data.C32[0],
                              (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
 
-    /* check if a plan exists now */
+    /* check if a plan exists now -- if not, it is a real problem */
     if (plan == NULL) {
-        psError(__func__, "Failed to create FFTW plan.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL);
         psFree(out);
         return NULL;
@@ -106,9 +125,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just a copy */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                 "Just an image copy was performed.");
+    /* if not a complex number, this is logically just a copy then */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         return psImageCopy(out, in, type);
     }
@@ -141,5 +157,11 @@
         }
     } else {
-        psError(__func__, "Can not extract real component from given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReal",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
+
         psFree(out);
         return NULL;
@@ -164,9 +186,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just zeroed image of same size */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                 "A zero image was returned.");
+    /* if not a complex image type, this is logically just zeroed image of same size */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         out = psImageRecycle(out, numCols, numRows, type);
         memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
@@ -201,5 +220,10 @@
         }
     } else {
-        psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageImaginary",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -225,5 +249,12 @@
 
     if (imag->type.type != type) {
-        psError(__func__, "The inputs to psImageComplex must be the same type.");
+        char* typeStrReal;
+        char* typeStrImag;
+        PS_TYPE_NAME(typeStrReal,type);
+        PS_TYPE_NAME(typeStrImag,imag->type.type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH,
+                   typeStrReal,typeStrImag);
         psFree(out);
         return NULL;
@@ -231,17 +262,8 @@
 
     if (imag->numCols != numCols || imag->numRows != numRows) {
-        psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
-        psFree(out);
-        return NULL;
-    }
-
-    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        psError(__func__, "The inputs to psImageComplex can not be complex.");
-        psFree(out);
-        return NULL;
-    }
-
-    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
-        psError(__func__, "The input type to psImageComplex must be a floating point.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH,
+                   numCols, numRows, imag->numCols, imag->numRows);
         psFree(out);
         return NULL;
@@ -280,8 +302,14 @@
         }
     } else {
-        psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
-        psFree(out);
-        return NULL;
-    }
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED,
+                   typeStr);
+        psFree(out);
+        return NULL;
+    }
+
 
     return out;
@@ -303,9 +331,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just a image copy */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                 "Image copy was performed instead.");
+    /* if not a complex image, this is logically just a image copy */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         return psImageCopy(out, in, type);
     }
@@ -338,5 +363,10 @@
         }
     } else {
-        psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConjugate",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -362,11 +392,4 @@
     numRows = in->numRows;
     numElementsSquared = numCols * numCols * numRows * numRows;
-
-    /* if not a complex number, this is not implemented */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
-        psFree(out);
-        return NULL;
-    }
 
     if (type == PS_TYPE_C32) {
@@ -405,10 +428,15 @@
         }
     } else {
-        psError(__func__, "Can not power spectrum for given image type (%d).", type);
-        psFree(out);
-        return NULL;
-    }
-
-    return out;
-
-}
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePowerSpectrum",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
+                   typeStr);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 1839)
+++ /trunk/psLib/src/image/psImage.c	(revision 1840)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-16 18:51:31 $
+ *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -224,5 +224,5 @@
     }
 
-    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                             \
+    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                     \
 case PS_TYPE_##TYPE:                                                 \
     switch (mode) {                                                  \
@@ -237,8 +237,8 @@
     default:                                                         \
         psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",    \
-                   PS_ERR_BAD_PARAMETER_VALUE,true,                     \
-                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,     \
-                   mode);                                               \
-    }                                                                    \
+                   PS_ERR_BAD_PARAMETER_VALUE,true,                  \
+                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,  \
+                   mode);                                            \
+    }                                                                \
     break
 
@@ -256,9 +256,12 @@
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C32);
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
-    default:
-        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
-                   PS_ERR_BAD_PARAMETER_TYPE,true,
-                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
-                   input->type.type);
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
+                       PS_ERR_BAD_PARAMETER_TYPE,true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
Index: /trunk/psLib/src/image/psImageConvolve.c
===================================================================
--- /trunk/psLib/src/image/psImageConvolve.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageConvolve.c	(revision 1840)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-28 01:18:28 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,4 +16,6 @@
 #include "psLogMsg.h"
 #include "psError.h"
+
+#include "psImageErrors.h"
 
 static void freeKernel(psKernel* ptr);
@@ -76,5 +78,5 @@
 }
 
-psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts)
+psKernel* psKernelGenerate(const psVector* xShifts, const psVector* yShifts)
 {
     int x = 0;
@@ -91,10 +93,20 @@
     // got non-NULL vectors?
     if (xShifts == NULL || yShifts == NULL) {
-        psError(__func__,"Shift vectors can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImageConvolve_SHIFT_NULL);
         return NULL;
     }
 
+    // types match?
     if (xShifts->type.type != yShifts->type.type) {
-        psError(__func__,"Shift vectors can not be different data types.");
+        char* typeXStr;
+        char* typeYStr;
+        PS_TYPE_NAME(typeXStr,xShifts->type.type);
+        PS_TYPE_NAME(typeYStr,yShifts->type.type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH,
+                   typeXStr, typeYStr);
         return NULL;
     }
@@ -158,6 +170,13 @@
         KERNEL_GENERATE_CASE(C32);
         KERNEL_GENERATE_CASE(C64);
-    default:
-        psError(__func__,"Shift vector datatype not supported.");
+
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,xShifts->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
Index: /trunk/psLib/src/image/psImageErrors.dat
===================================================================
--- /trunk/psLib/src/image/psImageErrors.dat	(revision 1839)
+++ /trunk/psLib/src/image/psImageErrors.dat	(revision 1840)
@@ -11,4 +11,55 @@
 psImage_NOT_AN_IMAGE                   The input psImage must have a PS_DIMEN_IMAGE dimension type.
 psImage_IMAGE_NULL                     Can not operate on a NULL psImage.
-psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type (%d) is not supported.
+psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type (%s) is not supported.
 psImage_INTERPOLATE_METHOD_INVALID     Specified interpolation method (%d) is not supported.
+psImage_SUBSET_RANGE_INVALID           Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d].
+psImage_SUBSECTION_NULL                Specified subsection string can not be NULL.
+psImage_SUBSECTION_INVALID             Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'.
+psImage_NOT_PARENT                     Specified psImage can not be a child of another psImage.
+psImage_INPLACE_NOTSUPPORTED           Specified input and output psImage can not reference the same psImage.
+psImage_SUBSET_ZERO_SIZE               Specified subset, [%d:%d,%d:%d], contains no pixel data.
+psImage_IMAGE_MASK_SIZE                Input psImage mask size, %dx%d, does not match psImage input size, %dx%d.
+psImage_IMAGE_MASK_TYPE                Input psImage mask type, %s, is not the supported mask datatype of %s.
+psImage_BAD_STAT                       Specified statistic option, %d, is not valid.  Must specify one and only one statistic type.
+psImage_NO_STAT_OPTIONS                Specified statistic option did not indicate any operation to perform.
+psImage_STAT_NULL                      Specified statistic can not be NULL.
+psImage_SLICE_DIRECTION_INVALID        Specified slice direction, %d, is invalid.
+psImage_PARAMETER_OUTOF_TYPERANGE      Specified %s value, %g, is outside of psImage type's range (%s: %g to %g).
+#
+psImageFFT_IMAGE_TYPE_UNSUPPORTED      Input psImage type (%s) is not supported. Valid image types are psF32 and psC32.
+psImageFFT_REVERSE_NOT_COMPLEX         Input psImage (%s) is not complex.  Reverse FFT operation requires a complex psImage input.
+psImageFFT_FORWARD_NOT_REAL            Input psImage (%s) is not real.  Forward FFT operation requires a real psImage input.
+psImageFFT_FFTW_PLAN_NULL              Could not create a valid FFT plan to perform the transform.
+psImageFFT_REAL_IMAG_TYPE_MISMATCH     Real psImage type (%s) and imaginary psImage type (%s) must be the same.
+psImageFFT_REAL_IMAG_SIZE_MISMATCH     Real psImage size (%dx%d) and imaginary psImage size (%dx%d) must be the same.
+psImageFFT_NONREAL_NOTSUPPORTED        Input psImage type, %s, is required to be either psF32 or psF64.
+psImageFFT_NONCOMPLEX_NOTSUPPORTED     Input psImage type, %s, is required to be either psC32 or psC64.
+#
+psImageIO_FILENAME_NULL                Specified filename can not be NULL.
+psImageIO_FILENAME_INVALID             Could not open file,'%s'.\nCFITSIO Error: %s
+psImageIO_EXTNAME_INVALID              Could not find HDU with extension name '%s' in file %s.\nCFITSIO Error: %s
+psImageIO_EXTNUM_INVALID               Could not find HDU #%d in file %s.\nCFITSIO Error: %s
+psImageIO_DATATYPE_UNKNOWN             Could not determine image data type for file %s.\nCFITSIO Error: %s
+psImageIO_IMAGE_DIM_UNKNOWN            Could not determine image dimensions for file %s.\nCFITSIO Error: %s
+psImageIO_IMAGE_SIZE_UNKNOWN           Could not determine image size for file %s.\nCFITSIO Error: %s
+psImageIO_IMAGE_DIMENSION_UNSUPPORTED  Image number of dimensions, %d, is not valid.  Only two or three dimensions supported for FITS I/O.
+psImageIO_FITS_TYPE_UNSUPPORTED        FITS image type, BITPIX=%d, in file %s is not supported.
+psImageIO_READ_FAILED                  Reading from FITS file %s failed.\nCFITSIO Error: %s
+psImageIO_TYPE_UNSUPPORTED             Input psImage type, %s, is not supported.
+psImageIO_WRITE_EXTNUM_INVALID         Specified extension number, %d, must not exceed number of HDUs, %d, by more than one.
+psImageIO_FILENAME_CREATE_FAILED       Could not create file,'%s'.\nCFITSIO Error: %s
+psImageIO_CREATE_EXTENSION_FAILED      Could not create EXTNAME keyword for file,'%s'.\nCFITSIO Error: %s
+psImageIO_CREATE_HDU_FAILED            Could not create HDU for writing psImage in file,'%s'.\nCFITSIO Error: %s
+psImageIO_WRITE_FAILED                 Could not write psImage data to file,'%s'.\nCFITSIO Error: %s
+#
+psImageManip_MAXMIN                    Specified min value, %g, can not be greater than the specified max value, %g.
+psImageManip_MAXMIN_REAL               Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g.
+psImageManip_MAXMIN_IMAG               Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g.
+psImageManip_OPERATION_NULL            Operation can not be NULL.
+psImageManip_OVERLAY_TYPE_MISMATCH     Input overlay psImage type, %s, must match input psImage type, %s.
+psImageManip_CLIP_VALUE_INVALID        Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].  
+psImageManip_OVERLAY_OPERATOR_INVALID  Specified operation, '%s', is not supported.
+psImageManip_SCALE_NOT_POSITIVE        Specified scale value, %d, must be a positive value.
+psImageManip_INTERPOLATION_MODE_UNSUPPORTED Specified interpolation mode, %d, is unsupported.
+psImageConvolve_SHIFT_NULL                Specified shift vectors can not be NULL.
+psImageConvolve_SHIFT_TYPE_MISMATCH    The X-shift vector type, %s, does not match the Y-shift vector type, %s.  Types must match.
Index: /trunk/psLib/src/image/psImageErrors.h
===================================================================
--- /trunk/psLib/src/image/psImageErrors.h	(revision 1839)
+++ /trunk/psLib/src/image/psImageErrors.h	(revision 1840)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-16 18:51:31 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,6 +33,54 @@
 #define PS_ERRORTEXT_psImage_NOT_AN_IMAGE "The input psImage must have a PS_DIMEN_IMAGE dimension type."
 #define PS_ERRORTEXT_psImage_IMAGE_NULL "Can not operate on a NULL psImage."
-#define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type (%d) is not supported."
+#define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type (%s) is not supported."
 #define PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID "Specified interpolation method (%d) is not supported."
+#define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d]."
+#define PS_ERRORTEXT_psImage_SUBSECTION_NULL "Specified subsection string can not be NULL."
+#define PS_ERRORTEXT_psImage_SUBSECTION_INVALID "Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'."
+#define PS_ERRORTEXT_psImage_NOT_PARENT "Specified psImage can not be a child of another psImage."
+#define PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED "Specified input and output psImage can not reference the same psImage."
+#define PS_ERRORTEXT_psImage_SUBSET_ZERO_SIZE "Specified subset, [%d:%d,%d:%d], contains no pixel data."
+#define PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE "Input psImage mask size, %dx%d, does not match psImage input size, %dx%d."
+#define PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE "Input psImage mask type, %s, is not the supported mask datatype of %s."
+#define PS_ERRORTEXT_psImage_BAD_STAT "Specified statistic option, %d, is not valid.  Must specify one and only one statistic type."
+#define PS_ERRORTEXT_psImage_NO_STAT_OPTIONS "Specified statistic option did not indicate any operation to perform."
+#define PS_ERRORTEXT_psImage_STAT_NULL "Specified statistic can not be NULL."
+#define PS_ERRORTEXT_psImage_SLICE_DIRECTION_INVALID "Specified slice direction, %d, is invalid."
+#define PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE "Specified %s value, %g, is outside of psImage type's range (%s: %g to %g)."
+#define PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED "Input psImage type (%s) is not supported. Valid image types are psF32 and psC32."
+#define PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX "Input psImage (%s) is not complex.  Reverse FFT operation requires a complex psImage input."
+#define PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL "Input psImage (%s) is not real.  Forward FFT operation requires a real psImage input."
+#define PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL "Could not create a valid FFT plan to perform the transform."
+#define PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH "Real psImage type (%s) and imaginary psImage type (%s) must be the same."
+#define PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH "Real psImage size (%dx%d) and imaginary psImage size (%dx%d) must be the same."
+#define PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED "Input psImage type, %s, is required to be either psF32 or psF64."
+#define PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED "Input psImage type, %s, is required to be either psC32 or psC64."
+#define PS_ERRORTEXT_psImageIO_FILENAME_NULL "Specified filename can not be NULL."
+#define PS_ERRORTEXT_psImageIO_FILENAME_INVALID "Could not open file,'%s'.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_EXTNAME_INVALID "Could not find HDU with extension name '%s' in file %s.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_EXTNUM_INVALID "Could not find HDU #%d in file %s.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_DATATYPE_UNKNOWN "Could not determine image data type for file %s.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_IMAGE_DIM_UNKNOWN "Could not determine image dimensions for file %s.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_IMAGE_SIZE_UNKNOWN "Could not determine image size for file %s.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_IMAGE_DIMENSION_UNSUPPORTED "Image number of dimensions, %d, is not valid.  Only two or three dimensions supported for FITS I/O."
+#define PS_ERRORTEXT_psImageIO_FITS_TYPE_UNSUPPORTED "FITS image type, BITPIX=%d, in file %s is not supported."
+#define PS_ERRORTEXT_psImageIO_READ_FAILED "Reading from FITS file %s failed.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_TYPE_UNSUPPORTED "Input psImage type, %s, is not supported."
+#define PS_ERRORTEXT_psImageIO_WRITE_EXTNUM_INVALID "Specified extension number, %d, must not exceed number of HDUs, %d, by more than one."
+#define PS_ERRORTEXT_psImageIO_FILENAME_CREATE_FAILED "Could not create file,'%s'.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_CREATE_EXTENSION_FAILED "Could not create EXTNAME keyword for file,'%s'.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_CREATE_HDU_FAILED "Could not create HDU for writing psImage in file,'%s'.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageIO_WRITE_FAILED "Could not write psImage data to file,'%s'.\nCFITSIO Error: %s"
+#define PS_ERRORTEXT_psImageManip_MAXMIN "Specified min value, %g, can not be greater than the specified max value, %g."
+#define PS_ERRORTEXT_psImageManip_MAXMIN_REAL "Specified real-portion of min value, %g, can not be greater than the real-portion of max value, %g."
+#define PS_ERRORTEXT_psImageManip_MAXMIN_IMAG "Specified imaginary-portion of min value, %g, can not be greater than the imaginary-portion of max value, %g."
+#define PS_ERRORTEXT_psImageManip_OPERATION_NULL "Operation can not be NULL."
+#define PS_ERRORTEXT_psImageManip_OVERLAY_TYPE_MISMATCH "Input overlay psImage type, %s, must match input psImage type, %s."
+#define PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID "Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].  "
+#define PS_ERRORTEXT_psImageManip_OVERLAY_OPERATOR_INVALID "Specified operation, '%s', is not supported."
+#define PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE "Specified scale value, %d, must be a positive value."
+#define PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED "Specified interpolation mode, %d, is unsupported."
+#define PS_ERRORTEXT_psImageConvolve_SHIFT_NULL "Specified shift vectors can not be NULL."
+#define PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH "The X-shift vector type, %s, does not match the Y-shift vector type, %s.  Types must match."
 //~End
 
Index: /trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageExtraction.c	(revision 1840)
@@ -10,6 +10,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-25 00:04:01 $
+*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,6 @@
 #include "psImageExtraction.h"
 #include "psError.h"
+
+#include "psImageErrors.h"
 
 psImage* psImageSubset(psImage* image,
@@ -34,31 +36,34 @@
 
     if (image == NULL || image->data.V == NULL) {
-        psError(__func__, "Can not subset image because input image or its pixel buffer is NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return NULL;
     }
 
     if (image->type.dimen != PS_DIMEN_IMAGE) {
-        psError(__func__, "Can not subset image because input image is not an image.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
         return NULL;
     }
 
     if (numCols < 1 || numRows < 1) {
-        psError(__func__,
-                "Can not subset image because number of rows or columns are zero (%dx%d).", numCols, numRows);
-        return NULL;
-    }
-
-    if (col0 >= image->numCols || row0 >= image->numRows) {
-        psError(__func__,
-                "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.", col0, row0);
-        return NULL;
-    }
-
-    /* validate subimage size */
-    if (col0 + numCols >= image->numCols || row0 + numRows >= image->numRows) {
-        psError(__func__,
-                "Can not subset image outside of image boundaries (size=%dx%d, "
-                "subset=[%d:%d,%d:%d]).",
-                image->numCols, image->numRows, col0, col0 + numCols, row0, row0 + numRows);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_AREA_NEGATIVE,
+                   numCols,numRows);
+        return NULL;
+    }
+
+    if ( col0 >= image->numCols ||
+            row0 >= image->numRows ||
+            col0 + numCols >= image->numCols ||
+            row0 + numRows >= image->numRows ) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
+                   col0, col0 + numCols, row0, row0 + numRows,
+                   image->numCols, image->numRows);
         return NULL;
     }
@@ -104,12 +109,15 @@
     // section should be of the form '[x1:x2,y1:y2]'
     if (section == NULL) {
-        psError(__func__,"The subsection string input can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubsection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_SUBSECTION_NULL);
         return NULL;
     }
 
     if (sscanf(section,"[%d:%d,%d:%d]",&x1,&x2,&y1,&y2) < 4) {
-        psError(__func__,"The subsection string (%s) can not be parsed.  "
-                "Needs to be of the form '[x1:x2,y1:y2]'",
-                section);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubsection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
+                   section);
         return NULL;
     }
@@ -120,11 +128,14 @@
 {
     if (image == NULL || image->data.V == NULL) {
-        psError(__func__, "Can not subset image because input image or its "
-                "pixel buffer is NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return NULL;
     }
 
     if (image->parent != NULL) {
-        psError(__func__, "Can not perform a trim on a child image.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_NOT_PARENT);
         return NULL;
     }
@@ -134,7 +145,9 @@
             y0 >= image->numRows || y1 >= image->numRows ||
             x0 > x1 || y0 > y1 ) {
-        psError(__func__, "Can not subset image because specified region "
-                "[%d:%d,%d:%d] is not valid for image of size %dx%d.",
-                x0,x1,y0,y1,image->numCols,image->numRows);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
+                   x0, x1, y0, y1,
+                   image->numCols, image->numRows);
         return NULL;
     }
@@ -179,5 +192,7 @@
 
     if (input == NULL || input->data.V == NULL) {
-        psError(__func__, "Can not copy image because input image or its pixel buffer is NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(output);
         return NULL;
@@ -185,7 +200,7 @@
 
     if (input == output) {
-        psError(__func__,
-                "Can not copy image because given input and output "
-                "parameter reference the same psImage struct.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
         psFree(output);
         return NULL;
@@ -193,5 +208,7 @@
 
     if (input->type.dimen != PS_DIMEN_IMAGE) {
-        psError(__func__, "Can not copy image because input image is not actually an image.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
         psFree(output);
         return NULL;
@@ -205,5 +222,8 @@
 
     if (inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR) {
-        psError(__func__, "Can not copy image to/from a void* matrix");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                   PS_TYPE_PTR_NAME);
         psFree(output);
         return NULL;
@@ -220,4 +240,5 @@
         return output;
     }
+
     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
         ps##INTYPE *in; \
@@ -232,44 +253,45 @@
     }
 
-    #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) \
-    switch (inDatatype) { \
-    case PS_TYPE_S8: \
-        PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_S16: \
-        PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_S32: \
-        PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_S64: \
-        PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_U8: \
-        PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_U16: \
-        PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_U32: \
-        PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_U64: \
-        PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_F32: \
-        PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_F64: \
-        PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_C32: \
-        PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
-        break; \
-    case PS_TYPE_C64: \
-        PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
-        break; \
-    default: \
-        break; \
+    #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
+        switch (inDatatype) { \
+        case PS_TYPE_S8: \
+            PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_S16: \
+            PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_S32: \
+            PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_S64: \
+            PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_U8: \
+            PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_U16: \
+            PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_U32: \
+            PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_U64: \
+            PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_F32: \
+            PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_F64: \
+            PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_C32: \
+            PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
+            break; \
+        case PS_TYPE_C64: \
+            PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
+            break; \
+        default: \
+            break; \
+        } \
     }
 
@@ -311,6 +333,15 @@
         PSIMAGE_COPY_CASE(output, C64);
         break;
-    default:
-        break;
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageCopy",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+            psFree(output);
+
+            break;
+        }
     }
     return output;
@@ -338,11 +369,16 @@
 
     if (in == NULL || in->data.V == NULL) {
-        psError(__func__, "Input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
     }
 
-    if (numRows == 0 || numCols == 0) {
-        psError(__func__, "The specified region contains no data (%dx%d)", numCols, numRows);
+    if (numRows < 1 || numCols < 1) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_SUBSET_ZERO_SIZE,
+                   col,col+numCols,row,row+numRows);
         psFree(out);
         return NULL;
@@ -374,26 +410,46 @@
     if (mask != NULL) {
         if (inRows != mask->numRows || inCols != mask->numCols) {
-            psError(__func__,
-                    "The mask and image dimensions did not match (%dx%d vs %dx%d)",
-                    mask->numCols, mask->numRows, in->numCols, in->numRows);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                       PS_ERR_BAD_PARAMETER_VALUE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE,
+                       mask->numCols,mask->numRows,
+                       inCols, inRows);
             psFree(out);
         }
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "The mask datatype (%d) must be %s.", mask->type.type, PS_TYPE_MASK_NAME);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
             psFree(out);
         }
     }
 
-    if (row >= inRows || col >= inCols || col + numCols > in->numCols || row + numRows > in->numRows) {
-        psError(__func__,
-                "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
-                col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1);
+    if (row >= inRows || col >= inCols || col + numCols > inCols || row + numRows > inRows) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
+                   col, row, col+numCols, row+numRows,
+                   inCols, inRows);
         psFree(out);
         return NULL;
     }
+
+    if (stats == NULL) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_STAT_NULL);
+        psFree(out);
+        return NULL;
+    }
+
     // verify that the stats struct specifies a
     // single stats operation
-    if (stats == NULL || p_psGetStatValue(stats, &statVal) == false) {
-        psError(__func__, "The stat options didn't specify a single supported statistic type.");
+    if (p_psGetStatValue(stats, &statVal) == false) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_VALUE, false,
+                   PS_ERRORTEXT_psImage_BAD_STAT);
         psFree(out);
         return NULL;
@@ -410,8 +466,6 @@
         psU32* outPosition = NULL;
 
-        // recycle output to make a proper
-        // sized/type output structure
-        // n.b. type is double as that is the
-        // type given for all stats in
+        // recycle output to make a proper sized/type output structure
+        // n.b. type is double as that is the type given for all stats is
         // psStats.
         out = psVectorRecycle(out, numCols, PS_TYPE_F64);
@@ -474,24 +528,19 @@
             PSIMAGE_CUT_VERTICAL(C32);
             PSIMAGE_CUT_VERTICAL(C64);
-        default:
-            psError(__func__, "Unsupported datatype (%d)", type);
-            psFree(out);
-            out = NULL;
+        default: {
+                char* typeStr;
+                PS_TYPE_NAME(typeStr,type);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                           PS_ERR_BAD_PARAMETER_TYPE, true,
+                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                           typeStr);
+                psFree(out);
+                out = NULL;
+            }
         }
         psFree(imgVec);
         psFree(maskVec);
-    } else if (direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG) {        // Cut
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        //
-        // in
-        // Y
-        // direction
+    } else if (direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG) {
+        // Cut in Y direction
         psVector* imgVec = NULL;
         psVector* maskVec = NULL;
@@ -509,8 +558,6 @@
             maskVec->n = maskVec->nalloc = numCols;
         }
-        // recycle output to make a proper
-        // sized/type output structure
-        // n.b. type is double as that is the
-        // type given for all stats in
+        // recycle output to make a proper sized/type output structure
+        // n.b. type is double as that is the type given for all stats in
         // psStats.
         out = psVectorRecycle(out, numRows, PS_TYPE_F64);
@@ -535,10 +582,5 @@
             }
             myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
-            (void)p_psGetStatValue(myStats, &statVal);  // we
-            // know
-            // it
-            // works
-            // cause we tested it
-            // above
+            (void)p_psGetStatValue(myStats, &statVal);  // we know it works cause we tested it above
             *outData = statVal;
             if (outPosition != NULL) {
@@ -551,12 +593,9 @@
         psFree(imgVec);
         psFree(maskVec);
-    } else {                               // don't
-        // know
-        // what
-        // the
-        // direction
-        // flag
-        // is
-        psError(__func__, "Invalid direction flag (%d)", direction);
+    } else { // don't know what the direction flag is
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSlice",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_SLICE_DIRECTION_INVALID,
+                   direction);
         psFree(out);
         out = NULL;
Index: /trunk/psLib/src/image/psImageFFT.c
===================================================================
--- /trunk/psLib/src/image/psImageFFT.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageFFT.c	(revision 1840)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-25 21:10:09 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,6 @@
 #include "psImageExtraction.h"
 
+#include "psImageErrors.h"
+
 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE
 
@@ -42,5 +44,10 @@
 
     if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
-        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -48,5 +55,10 @@
 
     if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
-        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_REVERSE_NOT_COMPLEX,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -55,5 +67,10 @@
 
     if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
-        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_FORWARD_NOT_REAL,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -69,13 +86,15 @@
     numCols = in->numCols;
 
+    // n.b. FFTW can perform a in-place transform at the same or faster than out-of-place.
     out = psImageCopy(out, in, PS_TYPE_C32);
-
     plan = fftwf_plan_dft_2d(numCols, numRows,
                              (fftwf_complex *) out->data.C32[0],
                              (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
 
-    /* check if a plan exists now */
+    /* check if a plan exists now -- if not, it is a real problem */
     if (plan == NULL) {
-        psError(__func__, "Failed to create FFTW plan.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFFT",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_FFTW_PLAN_NULL);
         psFree(out);
         return NULL;
@@ -106,9 +125,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just a copy */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                 "Just an image copy was performed.");
+    /* if not a complex number, this is logically just a copy then */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         return psImageCopy(out, in, type);
     }
@@ -141,5 +157,11 @@
         }
     } else {
-        psError(__func__, "Can not extract real component from given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReal",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
+
         psFree(out);
         return NULL;
@@ -164,9 +186,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just zeroed image of same size */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                 "A zero image was returned.");
+    /* if not a complex image type, this is logically just zeroed image of same size */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         out = psImageRecycle(out, numCols, numRows, type);
         memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
@@ -201,5 +220,10 @@
         }
     } else {
-        psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageImaginary",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -225,5 +249,12 @@
 
     if (imag->type.type != type) {
-        psError(__func__, "The inputs to psImageComplex must be the same type.");
+        char* typeStrReal;
+        char* typeStrImag;
+        PS_TYPE_NAME(typeStrReal,type);
+        PS_TYPE_NAME(typeStrImag,imag->type.type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_TYPE_MISMATCH,
+                   typeStrReal,typeStrImag);
         psFree(out);
         return NULL;
@@ -231,17 +262,8 @@
 
     if (imag->numCols != numCols || imag->numRows != numRows) {
-        psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
-        psFree(out);
-        return NULL;
-    }
-
-    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        psError(__func__, "The inputs to psImageComplex can not be complex.");
-        psFree(out);
-        return NULL;
-    }
-
-    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
-        psError(__func__, "The input type to psImageComplex must be a floating point.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageFFT_REAL_IMAG_SIZE_MISMATCH,
+                   numCols, numRows, imag->numCols, imag->numRows);
         psFree(out);
         return NULL;
@@ -280,8 +302,14 @@
         }
     } else {
-        psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
-        psFree(out);
-        return NULL;
-    }
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageComplex",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONREAL_NOTSUPPORTED,
+                   typeStr);
+        psFree(out);
+        return NULL;
+    }
+
 
     return out;
@@ -303,9 +331,6 @@
     numRows = in->numRows;
 
-    /* if not a complex number, this is logically just a image copy */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        // Warn user, as this is probably not expected
-        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                 "Image copy was performed instead.");
+    /* if not a complex image, this is logically just a image copy */
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type) && type != PS_TYPE_PTR) {
         return psImageCopy(out, in, type);
     }
@@ -338,5 +363,10 @@
         }
     } else {
-        psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConjugate",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
+                   typeStr);
         psFree(out);
         return NULL;
@@ -362,11 +392,4 @@
     numRows = in->numRows;
     numElementsSquared = numCols * numCols * numRows * numRows;
-
-    /* if not a complex number, this is not implemented */
-    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
-        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
-        psFree(out);
-        return NULL;
-    }
 
     if (type == PS_TYPE_C32) {
@@ -405,10 +428,15 @@
         }
     } else {
-        psError(__func__, "Can not power spectrum for given image type (%d).", type);
-        psFree(out);
-        return NULL;
-    }
-
-    return out;
-
-}
+        char* typeStr;
+        PS_TYPE_NAME(typeStr,type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePowerSpectrum",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageFFT_NONCOMPLEX_NOTSUPPORTED,
+                   typeStr);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/image/psImageIO.c
===================================================================
--- /trunk/psLib/src/image/psImageIO.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageIO.c	(revision 1840)
@@ -1,3 +1,2 @@
-
 /** @file  psImageIO.c
  *
@@ -8,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:34:58 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,8 +21,15 @@
 #include "psMemory.h"
 
+#include "psImageErrors.h"
+
 psImage* psImageReadSection(psImage* output,
                             int col,
                             int row,
-                            int numCols, int numRows, int z, char *extname, int extnum, char *filename)
+                            int numCols,
+                            int numRows,
+                            int z,
+                            char *extname,
+                            int extnum,
+                            char *filename)
 {
     fitsfile *fptr = NULL;      /* Pointer to the FITS file */
@@ -42,5 +48,7 @@
 
     if (filename == NULL) {
-        psError(__func__, "Must specify filename; it can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImageIO_FILENAME_NULL);
         psFree(output);
         return NULL;
@@ -51,5 +59,8 @@
     if (fptr == NULL || status != 0) {
         fits_get_errstatus(status, fitsErr);
-        psError(__func__, "Could not open file '%s'. (%s)", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageIO_FILENAME_INVALID,
+                   filename, fitsErr);
         psFree(output);
         return NULL;
@@ -62,5 +73,8 @@
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__, "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                       PS_ERR_LOCATION_INVALID, true,
+                       PS_ERRORTEXT_psImageIO_EXTNAME_INVALID,
+                       extname, filename, fitsErr);
             psFree(output);
             return NULL;
@@ -71,5 +85,8 @@
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                       PS_ERR_LOCATION_INVALID, true,
+                       PS_ERRORTEXT_psImageIO_EXTNUM_INVALID,
+                       extnum, filename, fitsErr);
             psFree(output);
             return NULL;
@@ -82,5 +99,8 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine image data type of '%s'. (%s)", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_DATATYPE_UNKNOWN,
+                   filename, fitsErr);
         psFree(output);
         return NULL;
@@ -92,5 +112,8 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine dimensions of '%s'. (%s)", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_IMAGE_DIM_UNKNOWN,
+                   filename, fitsErr);
         psFree(output);
         return NULL;
@@ -101,5 +124,8 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Dimensions of '%s' are not supported (NAXIS=%i).", filename, nAxis);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_IMAGE_DIMENSION_UNSUPPORTED,
+                   nAxis);
         psFree(output);
         return NULL;
@@ -111,5 +137,8 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine image size of '%s'. (%s)", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_IMAGE_SIZE_UNKNOWN,
+                   filename, fitsErr);
         psFree(output);
         return NULL;
@@ -134,9 +163,4 @@
     increment[1] = 1;
     increment[2] = 1;
-
-    // turn off the BSCALE/BZERO processing in
-    // CFITSIO
-    // (void)fits_set_bscale(fptr,
-    // 1.0,0.0,&status);
 
     switch (bitPix) {
@@ -178,17 +202,22 @@
         break;
     default:
-        psError(__func__, "Unsupported bitpix value (%d) in FITS file %s.", bitPix, filename);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_FITS_TYPE_UNSUPPORTED,
+                   bitPix, filename);
         psFree(output);
         return NULL;
     }
     output = psImageRecycle(output, numCols, numRows, datatype);
-    if (fits_read_subset
-            (fptr, fitsDatatype, firstPixel,
-             lastPixel, increment, NULL, output->data.V[0], &anynull, &status) != 0) {
+    if (fits_read_subset(fptr, fitsDatatype, firstPixel, lastPixel, increment,
+                         NULL, output->data.V[0], &anynull, &status) != 0) {
         psFree(output);
         (void)fits_get_errstatus(status, fitsErr);
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError(__func__, "Failed to read image [%s]", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageReadSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_READ_FAILED,
+                   filename, fitsErr);
         return NULL;
     }
@@ -199,5 +228,10 @@
 }
 
-bool psImageWriteSection(psImage* input, int col0, int row0, int z, char *extname, int extnum,
+bool psImageWriteSection(psImage* input,
+                         int col0,
+                         int row0,
+                         int z,
+                         char *extname,
+                         int extnum,
                          char *filename)
 {
@@ -220,5 +254,7 @@
     /* need a valid image to write */
     if (input == NULL) {
-        psError(__func__, "Can not write %s.  Input psImage is NULL.", filename);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return false;
     }
@@ -263,8 +299,13 @@
         datatype = TDOUBLE;
         break;
-    default:
-        psError(__func__,
-                "psImage datatype (%d) not supported.  File %s not written.", input->type.type, filename);
-        return false;
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImageIO_TYPE_UNSUPPORTED,
+                       typeStr);
+            return false;
+        }
     }
 
@@ -275,5 +316,8 @@
         if (fptr == NULL || status != 0) {
             fits_get_errstatus(status, fitsErr);
-            psError(__func__, "Could not open file '%s'. FITS error:%s", filename, fitsErr);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                       PS_ERR_BAD_PARAMETER_VALUE, true,
+                       PS_ERRORTEXT_psImageIO_FILENAME_INVALID,
+                       filename, fitsErr);
             return false;
         }
@@ -285,6 +329,8 @@
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,
-                        "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                           PS_ERR_LOCATION_INVALID, true,
+                           PS_ERRORTEXT_psImageIO_EXTNAME_INVALID,
+                           extname, filename, fitsErr);
                 return false;
             }
@@ -296,6 +342,8 @@
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,
-                        "extnum (%d) must not exceed number of HDUs (%d) by more than one.", extnum, numHDUs);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                           PS_ERR_LOCATION_INVALID, true,
+                           PS_ERRORTEXT_psImageIO_WRITE_EXTNUM_INVALID,
+                           extnum, numHDUs);
                 return false;
             } else if (numHDUs == extnum) {
@@ -305,5 +353,8 @@
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                           PS_ERR_LOCATION_INVALID, true,
+                           PS_ERRORTEXT_psImageIO_EXTNUM_INVALID,
+                           extnum, filename, fitsErr);
                 return false;
             }
@@ -318,5 +369,8 @@
         if (fptr == NULL || status != 0) {
             fits_get_errstatus(status, fitsErr);
-            psError(__func__, "Could not create file '%s'. (%s)", filename, fitsErr);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                       PS_ERR_IO, true,
+                       PS_ERRORTEXT_psImageIO_FILENAME_CREATE_FAILED,
+                       filename, fitsErr);
             return false;
         }
@@ -333,5 +387,8 @@
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__, "Could not create image HDU in FITS file '%s'. %s", filename, fitsErr);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                       PS_ERR_IO, true,
+                       PS_ERRORTEXT_psImageIO_CREATE_HDU_FAILED,
+                       filename, fitsErr);
             return false;
         }
@@ -347,6 +404,8 @@
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,
-                        "Could not create EXTNAME keyword in FITS file '%s'. (%s)", filename, fitsErr);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                           PS_ERR_IO, true,
+                           PS_ERRORTEXT_psImageIO_CREATE_EXTENSION_FAILED,
+                           filename, fitsErr);
                 return false;
             }
@@ -366,5 +425,8 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError(__func__, "Could not write image data to '%s'. (%s)", filename, fitsErr);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageWriteSection",
+                   PS_ERR_IO, true,
+                   PS_ERRORTEXT_psImageIO_WRITE_FAILED,
+                   filename, fitsErr);
         return false;
     }
Index: /trunk/psLib/src/image/psImageManip.c
===================================================================
--- /trunk/psLib/src/image/psImageManip.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageManip.c	(revision 1840)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-17 23:57:41 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,4 +26,6 @@
 #include "psMemory.h"
 #include "psImageExtraction.h"
+
+#include "psImageErrors.h"
 
 int psImageClip(psImage* input,
@@ -42,5 +44,8 @@
 
     if (max < min) {
-        psError(__func__, "psImageClip can not be invoked with max < min.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_MAXMIN,
+                   (double)min,(double)max);
         return 0;
     }
@@ -51,15 +56,19 @@
     switch (input->type.type) {
 
-        #define psImageClipCase(type,typename) \
+        #define psImageClipCase(type) \
     case PS_TYPE_##type: { \
             if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \
-                psError(__func__, "Specified vmin (%g) is outside of image's " \
-                        typename " pixel range (%g to %g)", \
-                        vmin,(psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
+                           PS_ERR_BAD_PARAMETER_VALUE, true, \
+                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
+                           "vmin",vmin, PS_TYPE_##type##_NAME, \
+                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
             if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \
-                psError(__func__, "Specified vmax (%g) is outside of image's " \
-                        typename " pixel range (%g to %g)", \
-                        vmax,(psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
+                           PS_ERR_BAD_PARAMETER_VALUE, true, \
+                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
+                           "vmax",vmax, PS_TYPE_##type##_NAME, \
+                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
             for (unsigned int row = 0;row<numRows;row++) { \
@@ -78,15 +87,19 @@
         break;
 
-        #define psImageClipCaseComplex(type,typename,absfcn)\
+        #define psImageClipCaseComplex(type,absfcn)\
     case PS_TYPE_##type: { \
             if (vmin < PS_MIN_##type || vmin > PS_MAX_##type) { \
-                psError(__func__, "Specified vmin (%g) is outside of image's " \
-                        typename " pixel range", \
-                        vmin); \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
+                           PS_ERR_BAD_PARAMETER_VALUE, true, \
+                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
+                           "vmin",vmin, PS_TYPE_##type##_NAME, \
+                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
             if (vmax > PS_MAX_##type || vmax < PS_MIN_##type) { \
-                psError(__func__, "Specified vmax (%g) is outside of image's " \
-                        typename " pixel range", \
-                        vmax); \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip", \
+                           PS_ERR_BAD_PARAMETER_VALUE, true, \
+                           PS_ERRORTEXT_psImage_PARAMETER_OUTOF_TYPERANGE, \
+                           "vmax",vmax, PS_TYPE_##type##_NAME, \
+                           (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \
             } \
             for (unsigned int row = 0;row<numRows;row++) { \
@@ -105,19 +118,25 @@
         break;
 
-        psImageClipCase(S8, "psS8")
-        psImageClipCase(S16, "psS16")
-        psImageClipCase(S32, "psS32")
-        psImageClipCase(S64, "psS64")
-        psImageClipCase(U8, "psU8")
-        psImageClipCase(U16, "psU16")
-        psImageClipCase(U32, "psU32")
-        psImageClipCase(U64, "psU64")
-        psImageClipCase(F32, "psF32")
-        psImageClipCase(F64, "psF64")
-        psImageClipCaseComplex(C32, "psC32", cabsf)
-        psImageClipCaseComplex(C64, "psC64", cabs)
-
-    default:
-        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
+        psImageClipCase(S8)
+        psImageClipCase(S16)
+        psImageClipCase(S32)
+        psImageClipCase(S64)
+        psImageClipCase(U8)
+        psImageClipCase(U16)
+        psImageClipCase(U32)
+        psImageClipCase(U64)
+        psImageClipCase(F32)
+        psImageClipCase(F64)
+        psImageClipCaseComplex(C32, cabsf)
+        psImageClipCaseComplex(C64, cabs)
+
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClip",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
@@ -158,6 +177,12 @@
         psImageClipNaNCase(C64)
 
-    default:
-        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipNaN",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
@@ -180,10 +205,14 @@
 
     if (image == NULL || overlay == NULL) {
-        psError(__func__, "one of the input images was NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return 1;
     }
 
     if (op == NULL) {
-        psError(__func__, "Operation can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImageManip_OPERATION_NULL);
         return 1;
     }
@@ -192,5 +221,12 @@
 
     if (type != overlay->type.type) {
-        psError(__func__, "Image and overlay datatypes must match. (%d vs %d)", type, overlay->type.type);
+        char* typeStr;
+        char* typeStrOverlay;
+        PS_TYPE_NAME(typeStr,type);
+        PS_TYPE_NAME(typeStrOverlay,overlay->type.type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageManip_OVERLAY_TYPE_MISMATCH,
+                   typeStrOverlay, typeStr);
         return 2;
     }
@@ -200,22 +236,19 @@
     overlayNumRows = overlay->numRows;
     overlayNumCols = overlay->numCols;
-
-    /* check row0/col0 to see if it is within the image size */
-    if (row0 < 0 || col0 < 0 || row0 >= imageNumRows || col0 >= imageNumCols) {
-        psError(__func__,
-                "Overlay origin of (%d,%d) is outside of the image dimensions (%d x %d).",
-                col0, row0, imageNumCols, imageNumRows);
-        return 3;
-    }
-
-    /* check if overlay is totally withing input image */
     imageRowLimit = row0 + overlayNumRows;
     imageColLimit = col0 + overlayNumCols;
-    if (imageRowLimit > imageNumRows || imageColLimit > imageNumCols) {
-        psError(__func__,
-                "Overlay image (%d,%d -> %d,%d) is partially outside"
-                " of the input image (%d x %d).",
-                col0, row0, col0 + overlayNumCols - 1, row0 + overlayNumRows - 1, imageNumCols, imageNumRows);
-        return 4;
+
+    /* check to see if overlay is within the input image */
+    if ( row0 < 0 ||
+            col0 < 0 ||
+            imageRowLimit > imageNumRows ||
+            imageColLimit > imageNumCols) {
+
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
+                   col0, imageColLimit, row0, imageRowLimit,
+                   imageNumCols, imageNumRows);
+        return 3;
     }
 
@@ -245,5 +278,8 @@
                     break; \
                 default: \
-                    psError(__func__,"Unknown operation %s",op); \
+                    psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection", \
+                               PS_ERR_BAD_PARAMETER_VALUE, true, \
+                               PS_ERRORTEXT_psImageManip_OVERLAY_OPERATOR_INVALID, \
+                               op); \
                     return 5; \
                 } \
@@ -265,6 +301,12 @@
         psImageOverlayCase(C64);
 
-    default:
-        psError(__func__, "Can not operate on type %d.", type);
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageOverlaySection",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
@@ -287,17 +329,22 @@
 
     if (input == NULL) {
-        psError(__func__, "Can not perform clip on NULL image");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return 0;
     }
 
     if (realMax < realMin) {
-        psError(__func__,
-                "psImageClipComplexRegion can not be invoked with " "max < min in the real image space.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_MAXMIN_REAL,
+                   (double)realMin, (double)realMax);
         return 0;
     }
     if (imagMax < imagMin) {
-        psError(__func__,
-                "psImageClipComplexRegion can not be invoked with "
-                "max < min in the imaginary image space.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_MAXMIN_IMAG,
+                   (double)imagMin, (double)imagMax);
         return 0;
     }
@@ -306,18 +353,22 @@
     numCols = input->numCols;
 
-    #define psImageClipComplexRegionCase(type,typename,realfcn,imagfcn) \
+    #define psImageClipComplexRegionCase(type,realfcn,imagfcn) \
 case PS_TYPE_##type: { \
         if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \
                 realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \
-            psError(__func__, "Specified vmin (%g%+gi) is outside of image's " \
-                    typename " pixel range", \
-                    creal(vmin),cimag(vmin)); \
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion", \
+                       PS_ERR_BAD_PARAMETER_VALUE, true, \
+                       PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
+                       "vmin", creal(vmin), cimag(vmin), \
+                       PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
             break; \
         } \
         if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \
                 realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \
-            psError(__func__, "Specified vmax (%g%+gi) is outside of image's " \
-                    typename " pixel range", \
-                    creal(vmax),cimag(vmax)); \
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion", \
+                       PS_ERR_BAD_PARAMETER_VALUE, true, \
+                       PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
+                       "vmax", creal(vmax), cimag(vmax), \
+                       PS_TYPE_##type##_NAME, PS_MIN_##type, PS_MAX_##type); \
             break; \
         } \
@@ -339,9 +390,15 @@
     switch (input->type.type) {
 
-        psImageClipComplexRegionCase(C32, "psC32", crealf, cimagf)
-        psImageClipComplexRegionCase(C64, "psC64", creal, cimag)
-
-    default:
-        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
+        psImageClipComplexRegionCase(C32, crealf, cimagf)
+        psImageClipComplexRegionCase(C64, creal, cimag)
+
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageClipComplexRegion",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
@@ -367,5 +424,7 @@
 
     if (in == NULL) {
-        psError(__func__, "Input image is NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
@@ -373,5 +432,8 @@
 
     if (scale < 1) {
-        psError(__func__, "The scale must be positive.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE,
+                   scale);
         psFree(out);
         return NULL;
@@ -379,5 +441,7 @@
 
     if (stats == NULL) {
-        psError(__func__, "The stats input can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_STAT_NULL);
         psFree(out);
         return NULL;
@@ -385,5 +449,8 @@
 
     if (p_psGetStatValue(stats, &statVal) == false) {
-        psError(__func__, "The stat options didn't specify a single supported statistic type.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_BAD_STAT,
+                   stats->options);
         psFree(out);
         return NULL;
@@ -394,7 +461,10 @@
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "The mask datatype must be %s (%d).",
-                    PS_TYPE_MASK_NAME,
-                    mask->type.type);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
             psFree(out);
             psFree(vec);
@@ -462,8 +532,15 @@
         PS_IMAGE_REBIN_CASE(C32);
         PS_IMAGE_REBIN_CASE(C64);
-    default:
-        psError(__func__, "Input image type not supported.");
-        psFree(out);
-        out = NULL;
+
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,in->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRebin",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+            psFree(out);
+            out = NULL;
+        }
     }
 
@@ -484,5 +561,7 @@
 
     if (in == NULL) {
-        psError(__func__, "Input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
@@ -520,8 +599,14 @@
         PSIMAGE_RESAMPLE_CASE(C32)
         PSIMAGE_RESAMPLE_CASE(C64)
-    default:
-        psError(__func__, "Unsupported type (%d)", in->type.type);
-        psFree(out);
-        return NULL;
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,in->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+            psFree(out);
+            out = NULL;
+        }
     }
 
@@ -539,5 +624,7 @@
 
     if (in == NULL) {
-        psError(__func__, "Input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRoll",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
@@ -570,12 +657,5 @@
             inRowNumber -= outRows;
         }
-        psU8* inRow = in->data.U8[inRowNumber]; // to
-
-        // allow
-
-        // byte
-        // arithmetic,
-
-        // but for all types
+        psU8* inRow = in->data.U8[inRowNumber]; // use byte arithmetic for all types
         psU8* outRow = out->data.U8[row];
 
@@ -594,5 +674,7 @@
 {
     if (in == NULL) {
-        psError(__func__, "The input image was NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
@@ -635,8 +717,14 @@
             PSIMAGE_ROTATE_LEFT_90(C32);
             PSIMAGE_ROTATE_LEFT_90(C64);
-        default:
-            psError(__func__, "Unsupported type (%d)", type);
-            psFree(out);
-            return NULL;
+        default: {
+                char* typeStr;
+                PS_TYPE_NAME(typeStr,type);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
+                           PS_ERR_BAD_PARAMETER_TYPE, true,
+                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                           typeStr);
+                psFree(out);
+                return NULL;
+            }
         }
     } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
@@ -675,8 +763,15 @@
             PSIMAGE_ROTATE_180_CASE(C32);
             PSIMAGE_ROTATE_180_CASE(C64);
-        default:
-            psError(__func__, "Unsupported type (%d)", type);
-            psFree(out);
-            return NULL;
+
+        default: {
+                char* typeStr;
+                PS_TYPE_NAME(typeStr,type);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
+                           PS_ERR_BAD_PARAMETER_TYPE, true,
+                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                           typeStr);
+                psFree(out);
+                return NULL;
+            }
         }
     } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
@@ -714,8 +809,15 @@
             PSIMAGE_ROTATE_RIGHT_90(C32);
             PSIMAGE_ROTATE_RIGHT_90(C64);
-        default:
-            psError(__func__, "Unsupported type (%d)", type);
-            psFree(out);
-            return NULL;
+
+        default: {
+                char* typeStr;
+                PS_TYPE_NAME(typeStr,type);
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
+                           PS_ERR_BAD_PARAMETER_TYPE, true,
+                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                           typeStr);
+                psFree(out);
+                return NULL;
+            }
         }
     } else if (fabsf(angle) < FLT_EPSILON) {
@@ -731,13 +833,7 @@
         double sinT = sinf(t);
 
-        // calculate the corners of the rotated
-        // image so we know the proper
-        // output image size.
-        // x' = x cos(t) + y sin(t); i.e, x' =
-        // (x-centerX)*cosT +
-        // (y-centerY)*sinT;
-        // y' = y cos(t) - x sin(t); i.e. y' =
-        // (y-centerY)*cosT -
-        // (x-centerX)*sinT;
+        // calculate the corners of the rotated image so we know the proper output image size.
+        // x' = x cos(t) + y sin(t); i.e, x' = (x-centerX)*cosT + (y-centerY)*sinT;
+        // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
 
         int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
@@ -748,22 +844,37 @@
         out = psImageRecycle(out, outCols, outRows, type);
 
-        /* optimized public domain rotation routine by Karl Lager float cosT,sinT; cosT = cos(t); sinT =
-         * sin(t); for (y = min_y; y <= max_y; y++) { x' = min_x * cosT + y * sinT + x1'; y' = y * cosT -
-         * min_x * sinT + y1'; for (x = min_x; x <= max_x; x++) { if (x', y') * * * * * * * * is in the
-         * bounds of the bitmap, get pixel(x', y') and plot the pixel to (x, y) on screen. x' += cosT; y' -=
-         * sinT; } } */
-
-        // precalculate some figures that are
-        // used within loop
+        /* optimized public domain rotation routine by Karl Lager
+         * 
+         * float cosT,sinT; 
+         * cosT = cos(t); 
+         * sinT = sin(t); 
+         * for (y = min_y; y <= max_y; y++) { 
+         *     x' = min_x * cosT + y * sinT + x1'; 
+         *     y' = y * cosT - min_x * sinT + y1'; 
+         *     for (x = min_x; x <= max_x; x++) { 
+         *         if (x', y') is in the bounds of the bitmap, get pixel
+         *            (x', y') and plot the pixel to (x, y) on screen. 
+         *         x' += cosT; 
+         *         y' -= sinT; 
+         *     }
+         * } 
+         */
+
+        // precalculate some figures that are used within loop
         float minXTimesCosTPlusCenterX = minX * cosT + centerX;
         float CenterYMinusminXTimesSinT = centerY - minX * sinT;
 
         #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
-            if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \
-                    cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \
-                psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \
-                        "image type's range (%g->%g).", \
-                        creal(unexposedValue),cimag(unexposedValue), \
-                        (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
+            if (creal(unexposedValue) < PS_MIN_##TYPE || \
+                    creal(unexposedValue) > PS_MAX_##TYPE || \
+                    cimag(unexposedValue) < PS_MIN_##TYPE || \
+                    cimag(unexposedValue) > PS_MAX_##TYPE) { \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
+                           PS_ERR_BAD_PARAMETER_VALUE, true, \
+                           PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
+                           "unexposedValue", \
+                           creal(unexposedValue),cimag(unexposedValue), \
+                           PS_TYPE_##TYPE##_NAME,  \
+                           (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
                 psFree(out); \
                 out = NULL; \
@@ -824,8 +935,14 @@
             PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
             break; \
-        default: \
-            psError(__func__,"Image type (%d) not supported",type); \
-            psFree(out); \
-            out = NULL; \
+        default: { \
+                char* typeStr; \
+                PS_TYPE_NAME(typeStr,type); \
+                psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
+                           PS_ERR_BAD_PARAMETER_TYPE, true, \
+                           PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED, \
+                           typeStr); \
+                psFree(out); \
+                out = NULL; \
+            } \
         } \
         break;
@@ -835,5 +952,8 @@
             PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
         default:
-            psError(__func__, "Unsupported interpolation mode (%d)", mode);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate",
+                       PS_ERR_BAD_PARAMETER_VALUE, true,
+                       PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
+                       mode);
             psFree(out);
             out = NULL;
@@ -857,5 +977,7 @@
 
     if (in == NULL) {
-        psError(__func__, "Input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         psFree(out);
         return NULL;
@@ -871,10 +993,15 @@
     #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \
 case PS_TYPE_##TYPE: \
-    if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \
-            cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \
-        psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \
-                "image type's range (%g->%g).", \
-                creal(unexposedValue), cimag(unexposedValue), \
-                (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
+    if (creal(unexposedValue) < PS_MIN_##TYPE || \
+            creal(unexposedValue) > PS_MAX_##TYPE || \
+            cimag(unexposedValue) < PS_MIN_##TYPE || \
+            cimag(unexposedValue) > PS_MAX_##TYPE) { \
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift", \
+                   PS_ERR_BAD_PARAMETER_VALUE, true, \
+                   PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID, \
+                   "unexposedValue", \
+                   creal(unexposedValue),cimag(unexposedValue), \
+                   PS_TYPE_##TYPE##_NAME,  \
+                   (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
         psFree(out); \
         out = NULL; \
@@ -885,5 +1012,6 @@
         float y = dy+(float)row; \
         for (int col=0;col<outCols;col++) { \
-            outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE(in,dx+(float)col,y,unexposedValue); \
+            outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \
+                          in,dx+(float)col,y,unexposedValue); \
         } \
     } \
@@ -905,8 +1033,15 @@
         PSIMAGE_SHIFT_CASE(MODE,C32); \
         PSIMAGE_SHIFT_CASE(MODE,C64); \
-    default: \
-        psError(__func__, "Image type (%d) not supported.", type); \
-        psFree(out); \
-        out = NULL; \
+        \
+    default: { \
+            char* typeStr; \
+            PS_TYPE_NAME(typeStr,type); \
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageRotate", \
+                       PS_ERR_BAD_PARAMETER_TYPE, true, \
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED, \
+                       typeStr); \
+            psFree(out); \
+            out = NULL; \
+        } \
     } \
     break;
@@ -917,5 +1052,8 @@
         PSIMAGE_SHIFT_ARBITRARY_CASE(BILINEAR);
     default:
-        psError(__func__, "Unsupported interpolation mode (%d)", mode);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageShift",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
+                   mode);
         psFree(out);
         out = NULL;
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 1839)
+++ /trunk/psLib/src/image/psImageStats.c	(revision 1840)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-08 06:02:47 $
+*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,4 +32,6 @@
 #include "psImageStats.h"
 
+#include "psImageErrors.h"
+
 /// This routine must determine the various statistics for the image.
 
@@ -43,15 +45,21 @@
 
     if (stats == NULL) {
-        psError(__func__, "The input psStats struct can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_STAT_NULL);
         return NULL;
     }
 
     if (in == NULL) {
-        psError(__func__, "The input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return NULL;
     }
 
     if (stats->options == 0) {
-        psError(__func__, "No statistic option/operation was specified.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);
         return stats;
     }
@@ -62,13 +70,14 @@
     junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];      // since
-    // psImage
-    // data
-    // is
-    // contiguous...
+    junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
             psFree(junkData);
             return NULL;
@@ -109,18 +118,19 @@
     junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];      // since
-    // psImage
-    // data
-    // is
-    // contiguous...
+    junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageHistogram",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
+            psFree(out);
             psFree(junkData);
             return NULL;
         }
-        // stuff the mask data into a psVector
-        // struct.
+        // stuff the mask data into a psVector struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
Index: /trunk/psLib/src/imageops/psImageConvolve.c
===================================================================
--- /trunk/psLib/src/imageops/psImageConvolve.c	(revision 1839)
+++ /trunk/psLib/src/imageops/psImageConvolve.c	(revision 1840)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-28 01:18:28 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,4 +16,6 @@
 #include "psLogMsg.h"
 #include "psError.h"
+
+#include "psImageErrors.h"
 
 static void freeKernel(psKernel* ptr);
@@ -76,5 +78,5 @@
 }
 
-psKernel *psKernelGenerate(const psVector *xShifts, const psVector *yShifts)
+psKernel* psKernelGenerate(const psVector* xShifts, const psVector* yShifts)
 {
     int x = 0;
@@ -91,10 +93,20 @@
     // got non-NULL vectors?
     if (xShifts == NULL || yShifts == NULL) {
-        psError(__func__,"Shift vectors can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImageConvolve_SHIFT_NULL);
         return NULL;
     }
 
+    // types match?
     if (xShifts->type.type != yShifts->type.type) {
-        psError(__func__,"Shift vectors can not be different data types.");
+        char* typeXStr;
+        char* typeYStr;
+        PS_TYPE_NAME(typeXStr,xShifts->type.type);
+        PS_TYPE_NAME(typeYStr,yShifts->type.type);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                   PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH,
+                   typeXStr, typeYStr);
         return NULL;
     }
@@ -158,6 +170,13 @@
         KERNEL_GENERATE_CASE(C32);
         KERNEL_GENERATE_CASE(C64);
-    default:
-        psError(__func__,"Shift vector datatype not supported.");
+
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,xShifts->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psKernelGenerate",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 1839)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 1840)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-08 06:02:47 $
+*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,4 +32,6 @@
 #include "psImageStats.h"
 
+#include "psImageErrors.h"
+
 /// This routine must determine the various statistics for the image.
 
@@ -43,15 +45,21 @@
 
     if (stats == NULL) {
-        psError(__func__, "The input psStats struct can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_STAT_NULL);
         return NULL;
     }
 
     if (in == NULL) {
-        psError(__func__, "The input image can not be NULL.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
         return NULL;
     }
 
     if (stats->options == 0) {
-        psError(__func__, "No statistic option/operation was specified.");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);
         return stats;
     }
@@ -62,13 +70,14 @@
     junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];      // since
-    // psImage
-    // data
-    // is
-    // contiguous...
+    junkData->data.V = in->data.V[0];      // since psImage data is contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
             psFree(junkData);
             return NULL;
@@ -109,18 +118,19 @@
     junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];      // since
-    // psImage
-    // data
-    // is
-    // contiguous...
+    junkData->data.V = in->data.V[0];  // since psImage data is contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,mask->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageHistogram",
+                       PS_ERR_BAD_PARAMETER_TYPE, true,
+                       PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,
+                       typeStr, PS_TYPE_MASK_NAME);
+            psFree(out);
             psFree(junkData);
             return NULL;
         }
-        // stuff the mask data into a psVector
-        // struct.
+        // stuff the mask data into a psVector struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 1839)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 1840)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-16 18:51:31 $
+ *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-21 22:30:19 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -224,5 +224,5 @@
     }
 
-    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                             \
+    #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE)                     \
 case PS_TYPE_##TYPE:                                                 \
     switch (mode) {                                                  \
@@ -237,8 +237,8 @@
     default:                                                         \
         psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",    \
-                   PS_ERR_BAD_PARAMETER_VALUE,true,                     \
-                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,     \
-                   mode);                                               \
-    }                                                                    \
+                   PS_ERR_BAD_PARAMETER_VALUE,true,                  \
+                   PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID,  \
+                   mode);                                            \
+    }                                                                \
     break
 
@@ -256,9 +256,12 @@
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C32);
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
-    default:
-        psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
-                   PS_ERR_BAD_PARAMETER_TYPE,true,
-                   PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
-                   input->type.type);
+    default: {
+            char* typeStr;
+            PS_TYPE_NAME(typeStr,input->type.type);
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psImagePixelInterpolate",
+                       PS_ERR_BAD_PARAMETER_TYPE,true,
+                       PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
+                       typeStr);
+        }
     }
 
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 1839)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 1840)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-17 19:23:24 $
+*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psType.h
===================================================================
--- /trunk/psLib/src/sys/psType.h	(revision 1839)
+++ /trunk/psLib/src/sys/psType.h	(revision 1840)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-10 01:55:34 $
+*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -103,4 +103,63 @@
 #define PS_MAX_C64       DBL_MAX       /**< maximum valid real or imaginary psC32 value */
 
+#define PS_TYPE_S8_NAME  "psS8"
+#define PS_TYPE_S16_NAME "psS16"
+#define PS_TYPE_S32_NAME "psS32"
+#define PS_TYPE_S64_NAME "psS64"
+#define PS_TYPE_U8_NAME  "psU8"
+#define PS_TYPE_U16_NAME "psU16"
+#define PS_TYPE_U32_NAME "psU32"
+#define PS_TYPE_U64_NAME "psU64"
+#define PS_TYPE_F32_NAME "psF32"
+#define PS_TYPE_F64_NAME "psF64"
+#define PS_TYPE_C32_NAME "psC32"
+#define PS_TYPE_C64_NAME "psC64"
+#define PS_TYPE_PTR_NAME "psPTR"
+
+#define PS_TYPE_NAME(value,type) \
+switch(type) { \
+case PS_TYPE_S8: \
+    value = PS_TYPE_S8_NAME; \
+    break; \
+case PS_TYPE_S16: \
+    value = PS_TYPE_S16_NAME; \
+    break; \
+case PS_TYPE_S32: \
+    value = PS_TYPE_S32_NAME; \
+    break; \
+case PS_TYPE_S64: \
+    value = PS_TYPE_S64_NAME; \
+    break; \
+case PS_TYPE_U8: \
+    value = PS_TYPE_U8_NAME; \
+    break; \
+case PS_TYPE_U16: \
+    value = PS_TYPE_U16_NAME; \
+    break; \
+case PS_TYPE_U32: \
+    value = PS_TYPE_U32_NAME; \
+    break; \
+case PS_TYPE_U64: \
+    value = PS_TYPE_U64_NAME; \
+    break; \
+case PS_TYPE_F32: \
+    value = PS_TYPE_F32_NAME; \
+    break; \
+case PS_TYPE_F64: \
+    value = PS_TYPE_F64_NAME; \
+    break; \
+case PS_TYPE_C32: \
+    value = PS_TYPE_C32_NAME; \
+    break; \
+case PS_TYPE_C64: \
+    value = PS_TYPE_C64_NAME; \
+    break; \
+case PS_TYPE_PTR: \
+    value = PS_TYPE_PTR_NAME; \
+    break; \
+default: \
+    value = "unknown"; \
+};
+
 /// Macro to get the bad pixel reason code (stored as part of mask value)
 #define PS_BADPIXEL_BITMASK 0x0f
Index: /trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.c	(revision 1839)
+++ /trunk/psLib/src/sysUtils/psMemory.c	(revision 1840)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-17 19:23:24 $
+*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psType.h
===================================================================
--- /trunk/psLib/src/sysUtils/psType.h	(revision 1839)
+++ /trunk/psLib/src/sysUtils/psType.h	(revision 1840)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-10 01:55:34 $
+*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-09-21 22:30:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -103,4 +103,63 @@
 #define PS_MAX_C64       DBL_MAX       /**< maximum valid real or imaginary psC32 value */
 
+#define PS_TYPE_S8_NAME  "psS8"
+#define PS_TYPE_S16_NAME "psS16"
+#define PS_TYPE_S32_NAME "psS32"
+#define PS_TYPE_S64_NAME "psS64"
+#define PS_TYPE_U8_NAME  "psU8"
+#define PS_TYPE_U16_NAME "psU16"
+#define PS_TYPE_U32_NAME "psU32"
+#define PS_TYPE_U64_NAME "psU64"
+#define PS_TYPE_F32_NAME "psF32"
+#define PS_TYPE_F64_NAME "psF64"
+#define PS_TYPE_C32_NAME "psC32"
+#define PS_TYPE_C64_NAME "psC64"
+#define PS_TYPE_PTR_NAME "psPTR"
+
+#define PS_TYPE_NAME(value,type) \
+switch(type) { \
+case PS_TYPE_S8: \
+    value = PS_TYPE_S8_NAME; \
+    break; \
+case PS_TYPE_S16: \
+    value = PS_TYPE_S16_NAME; \
+    break; \
+case PS_TYPE_S32: \
+    value = PS_TYPE_S32_NAME; \
+    break; \
+case PS_TYPE_S64: \
+    value = PS_TYPE_S64_NAME; \
+    break; \
+case PS_TYPE_U8: \
+    value = PS_TYPE_U8_NAME; \
+    break; \
+case PS_TYPE_U16: \
+    value = PS_TYPE_U16_NAME; \
+    break; \
+case PS_TYPE_U32: \
+    value = PS_TYPE_U32_NAME; \
+    break; \
+case PS_TYPE_U64: \
+    value = PS_TYPE_U64_NAME; \
+    break; \
+case PS_TYPE_F32: \
+    value = PS_TYPE_F32_NAME; \
+    break; \
+case PS_TYPE_F64: \
+    value = PS_TYPE_F64_NAME; \
+    break; \
+case PS_TYPE_C32: \
+    value = PS_TYPE_C32_NAME; \
+    break; \
+case PS_TYPE_C64: \
+    value = PS_TYPE_C64_NAME; \
+    break; \
+case PS_TYPE_PTR: \
+    value = PS_TYPE_PTR_NAME; \
+    break; \
+default: \
+    value = "unknown"; \
+};
+
 /// Macro to get the bad pixel reason code (stored as part of mask value)
 #define PS_BADPIXEL_BITMASK 0x0f
Index: /trunk/psLib/test/dataManip/Makefile
===================================================================
--- /trunk/psLib/test/dataManip/Makefile	(revision 1839)
+++ /trunk/psLib/test/dataManip/Makefile	(revision 1840)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/sysUtils
 ##
-##  $Revision: 1.41 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-09-18 01:50:24 $
+##  $Revision: 1.42 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-09-21 22:30:19 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,5 +26,4 @@
 tst_psFunc04 \
 tst_psFunc05 \
-tst_psFunc06 \
 tst_psHist00 \
 tst_psHist01 \
Index: /trunk/psLib/test/image/verified/tst_psImage.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1839)
+++ /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1840)
@@ -11,78 +11,78 @@
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 102h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 104h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 108h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 301h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 302h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 304h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 308h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 404h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 408h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 808h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 810h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Testing psImage with type 0h
 <DATE><TIME>|<HOST>|I|testImageAlloc
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageAlloc
-    Invalid value for number of rows or columns (numRows=0, numCols=0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageAlloc
+    Specified number of rows (0) or columns (0) is invalid.
 
 ---> TESTPOINT PASSED (psImage{psImageAlloc} | tst_psImage.c)
@@ -114,48 +114,48 @@
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because input image or its pixel buffer is NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Can not operate on a NULL psImage.
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure pointer is null and program  execution doesn't stop, if the input parameters nrow and/or ncol are zero. Also verify input psImage structure is not modified.
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because number of rows or columns are zero (64x0).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified number of rows (64) or columns (0) is invalid.
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because number of rows or columns are zero (0x128).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified number of rows (0) or columns (128) is invalid.
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure pointer is null and program execution doesn't stop, if the input parameters row0 and col0 are not within the range of values of psImage structure image.
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because col0,row0 (128,0) is not a valid pixel location.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [128:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because col0,row0 (0,256) is not a valid pixel location.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [0:<LINENO>,256:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because col0,row0 (-1,0) is not a valid pixel location.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [-1:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image because col0,row0 (0,-1) is not a valid pixel location.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [0:<LINENO>,-1:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure pointer is null and program execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of data not within the input psImage structure image.  Also verify the input psImage structure is not modified.
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image outside of image boundaries (size=128x256, subset=[64:<LINENO>,0:<LINENO>]).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [64:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image outside of image boundaries (size=128x256, subset=[0:<LINENO>,128:<LINENO>]).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [0:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageSubset
-    Can not subset image outside of image boundaries (size=128x256, subset=[64:<LINENO>,128:<LINENO>]).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
+    Specified subset range, [64:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     psImageFreeChildren shall deallocate any children images of a psImage structure
@@ -187,6 +187,6 @@
 <DATE><TIME>|<HOST>|I|testImageCopy
     An error should follow...
-<DATE><TIME>|<HOST>|E|psImageCopy
-    Can not copy image because input image or its pixel buffer is NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageCopy
+    Can not operate on a NULL psImage.
 
 ---> TESTPOINT PASSED (psImage{psImageCopy} | tst_psImage.c)
Index: /trunk/psLib/test/image/verified/tst_psImageExtraction.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageExtraction.stderr	(revision 1839)
+++ /trunk/psLib/test/image/verified/tst_psImageExtraction.stderr	(revision 1840)
@@ -7,38 +7,38 @@
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    Input image can not be NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Can not operate on a NULL psImage.
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The stat options didn't specify a single supported statistic type.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified statistic can not be NULL.
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    Invalid direction flag (5)
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified slice direction, 5, is invalid.
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The specified region contains no data (0x0)
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified subset, [200:<LINENO>,100:<LINENO>], contains no pixel data.
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The specified image region (2001,100 to 2001,100) is outside of image area (0,0 to 1999,999).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified subset range, [2001:<LINENO>,2002:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The specified image region (200,1001 to 200,1001) is outside of image area (0,0 to 1999,999).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The specified image region (200,100 to 2199,100) is outside of image area (0,0 to 1999,999).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified subset range, [200:<LINENO>,2200:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The specified image region (200,100 to 200,1099) is outside of image area (0,0 to 1999,999).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageSlice
-    The stat options didn't specify a single supported statistic type.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
+    Specified statistic option, 1, is not valid.  Must specify one and only one statistic type.
 
 ---> TESTPOINT PASSED (psImage{psImageSlice} | tst_psImageExtraction.c)
Index: /trunk/psLib/test/image/verified/tst_psImageFFT.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageFFT.stderr	(revision 1839)
+++ /trunk/psLib/test/image/verified/tst_psImageFFT.stderr	(revision 1840)
@@ -25,10 +25,10 @@
 <DATE><TIME>|<HOST>|I|testImageComplex
     Following should be an error (type mismatch).
-<DATE><TIME>|<HOST>|E|psImageComplex
-    The inputs to psImageComplex must be the same type.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageComplex
+    Real psImage type (psF32) and imaginary psImage type (psF64) must be the same.
 <DATE><TIME>|<HOST>|I|testImageComplex
     Following should be an error (size mismatch).
-<DATE><TIME>|<HOST>|E|psImageComplex
-    The inputs to psImageComplex must be the same dimensions.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageComplex
+    Real psImage size (128x64) and imaginary psImage size (64x64) must be the same.
 
 ---> TESTPOINT PASSED (psFFT{psImageComplex} | tst_psImageFFT.c)
Index: /trunk/psLib/test/image/verified/tst_psImageManip.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageManip.stderr	(revision 1839)
+++ /trunk/psLib/test/image/verified/tst_psImageManip.stderr	(revision 1840)
@@ -29,6 +29,6 @@
 <DATE><TIME>|<HOST>|I|testImageClip
     Following should be an error (max<min)
-<DATE><TIME>|<HOST>|E|psImageClip
-    psImageClip can not be invoked with max < min.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClip
+    Specified min value, 256, can not be greater than the specified max value, 128.
 
 ---> TESTPOINT PASSED (psImage{psImageClip} | tst_psImageManip.c)
@@ -59,50 +59,50 @@
 <DATE><TIME>|<HOST>|I|testImageClipComplexRegion
     Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Can not perform clip on NULL image
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    psImageClipComplexRegion can not be invoked with max < min in the real image space.
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    psImageClipComplexRegion can not be invoked with max < min in the imaginary image space.
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    psImageClipComplexRegion can not be invoked with max < min in the real image space.
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmin (-6.80565e+38+0i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmin (6.80565e+38+0i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmin (-0-6.80565e+38i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmin (0+6.80565e+38i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmax (-6.80565e+38+0i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmax (6.80565e+38+0i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmax (-0-6.80565e+38i) is outside of image's psC32 pixel range
-<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
-    Following should be an error:
-<DATE><TIME>|<HOST>|E|psImageClipComplexRegion
-    Specified vmax (0+6.80565e+38i) is outside of image's psC32 pixel range
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Can not operate on a NULL psImage.
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified real-portion of min value, 10, can not be greater than the real-portion of max value, 5.
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified imaginary-portion of min value, 10, can not be greater than the imaginary-portion of max value, 5.
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified real-portion of min value, 10, can not be greater than the real-portion of max value, 5.
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmin value, -6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmin value, 6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmin value, -0-6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmin value, 0+6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmax value, -6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmax value, 6.80565e+38+0i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmax value, -0-6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
+<DATE><TIME>|<HOST>|I|testImageClipComplexRegion
+    Following should be an error:
+<DATE><TIME>|<HOST>|E|psLib.image.psImageClipComplexRegion
+    Specified vmax value, 0+6.80565e+38i, is not the the range of input psImage's valid pixel values (psC32), i.e. [-3.40282e+38:<LINENO>.40282e+38].  
 
 ---> TESTPOINT PASSED (psImage{psImageClipComplexRegion} | tst_psImageManip.c)
@@ -116,14 +116,14 @@
 <DATE><TIME>|<HOST>|I|testImageOverlay
     Following should error as overlay isn't within image boundaries
-<DATE><TIME>|<HOST>|E|psImageOverlaySection
-    Overlay image (32,64 -> 159,319) is partially outside of the input image (128 x 256).
+<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
+    Specified subset range, [32:<LINENO>,64:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageOverlay
     Following should error as overlay is NULL
-<DATE><TIME>|<HOST>|E|psImageOverlaySection
-    one of the input images was NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
+    Can not operate on a NULL psImage.
 <DATE><TIME>|<HOST>|I|testImageOverlay
     Following should error as image input is NULL
-<DATE><TIME>|<HOST>|E|psImageOverlaySection
-    one of the input images was NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
+    Can not operate on a NULL psImage.
 
 ---> TESTPOINT PASSED (psImage{psImageOverlay} | tst_psImageManip.c)
@@ -135,26 +135,26 @@
 \**********************************************************************************/
 
-<DATE><TIME>|<HOST>|E|psImageRebin
-    Input image is NULL.
-<DATE><TIME>|<HOST>|I|testImageRebin
-    Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageRebin
-    The scale must be positive.
-<DATE><TIME>|<HOST>|I|testImageRebin
-    Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageRebin
-    The stats input can not be NULL.
-<DATE><TIME>|<HOST>|I|testImageRebin
-    Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageRebin
-    The stat options didn't specify a single supported statistic type.
-<DATE><TIME>|<HOST>|I|testImageRebin
-    Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageRebin
-    The stat options didn't specify a single supported statistic type.
-<DATE><TIME>|<HOST>|I|testImageRebin
-    Following should be an error.
-<DATE><TIME>|<HOST>|E|psImageRebin
-    The stat options didn't specify a single supported statistic type.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Can not operate on a NULL psImage.
+<DATE><TIME>|<HOST>|I|testImageRebin
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Specified scale value, 0, must be a positive value.
+<DATE><TIME>|<HOST>|I|testImageRebin
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Specified statistic can not be NULL.
+<DATE><TIME>|<HOST>|I|testImageRebin
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Specified statistic option, 0, is not valid.  Must specify one and only one statistic type.
+<DATE><TIME>|<HOST>|I|testImageRebin
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Specified statistic option, 8192, is not valid.  Must specify one and only one statistic type.
+<DATE><TIME>|<HOST>|I|testImageRebin
+    Following should be an error.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRebin
+    Specified statistic option, 2049, is not valid.  Must specify one and only one statistic type.
 
 ---> TESTPOINT PASSED (psImage{psImageRebin} | tst_psImageManip.c)
@@ -168,6 +168,6 @@
 <DATE><TIME>|<HOST>|I|testImageRoll
     Following should generate an error.
-<DATE><TIME>|<HOST>|E|psImageRoll
-    Input image can not be NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRoll
+    Can not operate on a NULL psImage.
 
 ---> TESTPOINT PASSED (psImage{psImageRoll} | tst_psImageManip.c)
@@ -181,6 +181,6 @@
 <DATE><TIME>|<HOST>|I|testImageRotate
     Following should be an error
-<DATE><TIME>|<HOST>|E|psImageRotate
-    The input image was NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageRotate
+    Can not operate on a NULL psImage.
 
 ---> TESTPOINT PASSED (psImage{psImageRotate} | tst_psImageManip.c)
@@ -228,6 +228,6 @@
 <DATE><TIME>|<HOST>|I|testImageShift
     Following should be an error...
-<DATE><TIME>|<HOST>|E|psImageShift
-    Input image can not be NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageShift
+    Can not operate on a NULL psImage.
 
 ---> TESTPOINT PASSED (psImage{psImageShift} | tst_psImageManip.c)
Index: /trunk/psLib/test/image/verified/tst_psImageStats01.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImageStats01.stderr	(revision 1839)
+++ /trunk/psLib/test/image/verified/tst_psImageStats01.stderr	(revision 1840)
@@ -1,6 +1,6 @@
-<DATE><TIME>|<HOST>|E|psImageStats
-    The input image can not be NULL.
-<DATE><TIME>|<HOST>|E|psImageStats
-    The input psStats struct can not be NULL.
-<DATE><TIME>|<HOST>|E|psImageStats
-    No statistic option/operation was specified.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
+    Can not operate on a NULL psImage.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
+    Specified statistic can not be NULL.
+<DATE><TIME>|<HOST>|E|psLib.image.psImageStats
+    Specified statistic option did not indicate any operation to perform.
