Index: trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- trunk/psLib/src/imageops/psImageStats.c	(revision 6874)
+++ trunk/psLib/src/imageops/psImageStats.c	(revision 6940)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-04-17 22:00:03 $
+ *  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-04-21 21:07:47 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -679,25 +679,25 @@
     if (col0 == 0 && col1 == 0 && row0 == 0 && row1 == 0) {
         col0 = mask->col0;
-        col1 = mask->col0 + mask->numCols - 1;
+        col1 = mask->col0 + mask->numCols;
         row0 = mask->row0;
-        row1 = mask->row0 + mask->numRows - 1;
+        row1 = mask->row0 + mask->numRows;
     }
 
     //Make sure x0 of region is inside image.  If so, set col0 to corresponding index number.
-    if (col0 >= mask->col0 && col0 < (mask->col0 + mask->numCols) ) {
+    if (col0 >= mask->col0 && col0 <= (mask->col0 + mask->numCols) ) {
         col0 -= mask->col0;
     } else {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 "Specified psRegion parameter, x0=%f, is out of range [%d,%d].\n",
-                region.x0, mask->col0, mask->col0+mask->numCols-1);
+                region.x0, mask->col0, mask->col0+mask->numCols);
         return -1;
     }
     //Make sure y0 of region is inside image.  If so, set row0 to corresponding index number.
-    if (row0 >= mask->row0 && row0 < (mask->row0 + mask->numRows) ) {
+    if (row0 >= mask->row0 && row0 <= (mask->row0 + mask->numRows) ) {
         row0 -= mask->row0;
     } else {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 "Specified psRegion parameter, y0=%f, is out of range [%d,%d].\n",
-                region.y0, mask->row0, mask->row0+mask->numRows-1);
+                region.y0, mask->row0, mask->row0+mask->numRows);
         return -1;
     }
@@ -709,13 +709,13 @@
             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                     "Specified psRegion parameter, x1=%f=%d, is out of range [%d,%d].\n",
-                    region.x1, col1+mask->col0, mask->col0, mask->col0+mask->numCols-1);
+                    region.x1, col1+mask->col0, mask->col0, mask->col0+mask->numCols);
             return -1;
         }
-    } else if (col1 >= mask->col0 && col1 < (mask->col0 + mask->numCols) ) {
+    } else if (col1 >= mask->col0 && col1 <= (mask->col0 + mask->numCols) ) {
         col1 -= mask->col0;
     } else {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 "Specified psRegion parameter, x1=%f=%d, is out of range [%d,%d].\n",
-                region.x1, col1, mask->col0, mask->col0+mask->numCols-1);
+                region.x1, col1, mask->col0, mask->col0+mask->numCols);
         return -1;
     }
@@ -726,13 +726,13 @@
             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                     "Specified psRegion parameter, y1=%f=%d, is out of range [%d,%d].\n",
-                    region.y1, row1+mask->row0, mask->row0, mask->row0+mask->numRows-1);
+                    region.y1, row1+mask->row0, mask->row0, mask->row0+mask->numRows);
             return -1;
         }
-    } else if (row1 >= mask->row0 && row1 < (mask->row0 + mask->numRows) ) {
+    } else if (row1 >= mask->row0 && row1 <= (mask->row0 + mask->numRows) ) {
         row1 -= mask->row0;
     } else {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 "Specified psRegion parameter, y1=%f=%d, is out of range [%d,%d].\n",
-                region.y1, row1, mask->row0, mask->row0+mask->numRows-1);
+                region.y1, row1, mask->row0, mask->row0+mask->numRows);
         return -1;
     }
@@ -750,9 +750,9 @@
         return -1;
     }/* else if (col0 == col1 && row0 == row1) {
-                    psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                            "Invalid psRegion specified.  Region contains only 1 pixel.\n");
-                    return -1;
-                }
-            */
+                        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                                "Invalid psRegion specified.  Region contains only 1 pixel.\n");
+                        return -1;
+                    }
+                */
     x0 = col0;
     x1 = col1;
