Index: trunk/psLib/src/imageops/psImagePixelExtract.c
===================================================================
--- trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 5174)
+++ trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 5213)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-29 01:15:38 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-30 23:09:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -50,5 +50,5 @@
 psVector *psImageRow(psVector *out,
                      const psImage *input,
-                     psU32 row)
+                     int row)
 {
     if (input == NULL) {
@@ -60,4 +60,12 @@
                 "Specified row number is out of range for specified image.\n");
         return NULL;
+    }
+    if (row < 0) {
+        row += input->numRows;
+        if (row < 0) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                    "Specified row number is out of range for specified image.\n");
+            return NULL;
+        }
     }
     psVectorRecycle(out, input->numCols, input->type.type);
@@ -137,5 +145,5 @@
 psVector *psImageCol(psVector *out,
                      const psImage *input,
-                     psU32 column)
+                     int column)
 {
     if (input == NULL) {
@@ -143,10 +151,20 @@
         return NULL;
     }
-    if (column >= input->numRows) {
+    if (column >= input->numCols) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
                 "Specified column number is out of range for specified image.\n");
         return NULL;
     }
-    psVectorRecycle(out, input->numCols, input->type.type);
+    if (column < 0) {
+        column += input->numCols;
+        if (column < 0) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                    "Specified column number is out of range for specified image.\n");
+            return NULL;
+        }
+    }
+
+
+    psVectorRecycle(out, input->numRows, input->type.type);
 
     switch (input->type.type) {
Index: trunk/psLib/src/imageops/psImagePixelExtract.h
===================================================================
--- trunk/psLib/src/imageops/psImagePixelExtract.h	(revision 5174)
+++ trunk/psLib/src/imageops/psImagePixelExtract.h	(revision 5213)
@@ -8,6 +8,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-29 01:15:38 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-09-30 23:09:13 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -41,5 +41,5 @@
     psVector *out,                     ///< specified vector to return
     const psImage *input,              ///< input image
-    psU32 row                          ///< row number to extract
+    int row                            ///< row number to extract
 );
 
@@ -52,5 +52,5 @@
     psVector *out,                     ///< specified vector to return
     const psImage *input,              ///< input image
-    psU32 column                       ///< column number to extract
+    int column                         ///< column number to extract
 );
 
Index: trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- trunk/psLib/src/imageops/psImageStats.c	(revision 5174)
+++ trunk/psLib/src/imageops/psImageStats.c	(revision 5213)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.81 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-26 22:35:53 $
+ *  @version $Revision: 1.82 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-30 23:09:13 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -677,10 +677,16 @@
 
     type = mask->type.type;
+    if (type != PS_TYPE_MASK) {
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
+                "psImage type does not match the specified psMaskType!\n");
+        return -1;
+    }
 
     switch (type) {
     case PS_TYPE_U8:
+    case PS_TYPE_U16:
         for (long i = x0; i < x1; i++) {
             for (long j = y0; j < y1; j++) {
-                if (mask->data.U8[i][j] & value) {
+                if (mask->data.PS_TYPE_MASK_DATA[i][j] & value) {
                     Npixels ++;
                 }
@@ -692,5 +698,4 @@
     case PS_TYPE_S32:
     case PS_TYPE_S64:
-    case PS_TYPE_U16:
     case PS_TYPE_U32:
     case PS_TYPE_U64:
