Index: trunk/psLib/src/image/psImageStats.c
===================================================================
--- trunk/psLib/src/image/psImageStats.c	(revision 1719)
+++ 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;
