Index: trunk/psLib/src/image/psImageStats.c
===================================================================
--- trunk/psLib/src/image/psImageStats.c	(revision 2273)
+++ trunk/psLib/src/image/psImageStats.c	(revision 2291)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 01:05:00 $
+ *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-11-06 00:44:56 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -42,24 +42,10 @@
                       psS32 maskVal)
 {
+    PS_PTR_CHECK_NULL(stats, NULL);
+    PS_INT_CHECK_ZERO(stats->options, NULL);
+    PS_IMAGE_CHECK_NULL(in, NULL)
     psVector* junkData = NULL;
     psVector* junkMask = NULL;
 
-    if (stats == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_STAT_NULL);
-        return NULL;
-    }
-
-    if (in == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_IMAGE_NULL);
-        return NULL;
-    }
-
-    if (stats->options == 0) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);
-        return stats;
-    }
     // stuff the image data into a psVector struct.
     junkData = psAlloc(sizeof(psVector));
@@ -97,5 +83,4 @@
     NOTE: We assume that the psHistogram structure out has already been
     allocated and initialized.
-    NOTE: verify that image/mask have the correct types and sizes.
  *****************************************************************************/
 psHistogram* psImageHistogram(psHistogram* out,
@@ -104,10 +89,11 @@
                               psU32 maskVal)
 {
+    PS_PTR_CHECK_NULL(out, NULL);
+    PS_PTR_CHECK_NULL(in, NULL);
+    if (mask != NULL) {
+        PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL);
+    }
     psVector* junkData = NULL;
     psVector* junkMask = NULL;
-
-    // NOTE: Verify this action.
-    PS_PTR_CHECK_NULL(out, NULL);
-    PS_PTR_CHECK_NULL(in, NULL);
 
     junkData = psAlloc(sizeof(psVector));
@@ -118,14 +104,4 @@
 
     if (mask != NULL) {
-        if (mask->type.type != PS_TYPE_MASK) {
-            char* typeStr;
-            PS_TYPE_NAME(typeStr,mask->type.type);
-            psError(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.
         junkMask = psAlloc(sizeof(psVector));
@@ -187,7 +163,5 @@
 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly)
 {
-    if (maxChebyPoly < 1) {
-        return(NULL);
-    }
+    PS_INT_CHECK_POSITIVE(maxChebyPoly, NULL);
     psPolynomial1D **chebPolys = NULL;
     psS32 i = 0;
@@ -238,6 +212,5 @@
             (input->type.type != PS_TYPE_F32) &&
             (input->type.type != PS_TYPE_F64)) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Unallowable image type.\n");
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unallowable image type.\n");
     }
     PS_POLY_CHECK_NULL(coeffs, NULL);
@@ -252,17 +225,4 @@
     double *cScalingFactors = NULL;
     double *rScalingFactors = NULL;
-
-    // Check for null inputs
-    if (input == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_IMAGE_NULL);
-        return NULL;
-    }
-
-    if (coeffs == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_COEFF_NULL);
-        return NULL;
-    }
 
     // Create the sums[][] data structure.  This
@@ -287,5 +247,4 @@
     }
     chebPolys = p_psCreateChebyshevPolys(maxChebyPoly);
-
 
     // Compute the sums[][] data structure.
@@ -373,17 +332,4 @@
     float polySum = 0.0;
 
-    // Check for null inputs
-    if (input == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_IMAGE_NULL);
-        return NULL;
-    }
-
-    if (coeffs == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                PS_ERRORTEXT_psImage_COEFF_NULL);
-        return NULL;
-    }
-
     // We scale the pixel positions to values between -1.0 and 1.0
     // Use static data structures here.
