Index: trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- trunk/psLib/src/imageops/psImageStats.c	(revision 4970)
+++ trunk/psLib/src/imageops/psImageStats.c	(revision 5089)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.77 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-08 00:07:59 $
+ *  @version $Revision: 1.78 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-22 02:32:00 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -250,6 +250,6 @@
   Output:
   Internal Data Structures:
-    chebPolys[i][j] 
-    sums[i][j]: This will contain the sum of 
+    chebPolys[i][j]
+    sums[i][j]: This will contain the sum of
                 input->data.F32[x][y] *
                 psPolynomial1DEval(
@@ -258,5 +258,5 @@
                 psPolynomial1DEval(
 chebPolys[j],
-(float) y, 
+(float) y,
 );
         over all pixels (x,y) in the image.
@@ -373,6 +373,6 @@
   Output:
   Internal Data Structures:
-    chebPolys[i][j] 
-    sums[i][j]: This will contain the sum of 
+    chebPolys[i][j]
+    sums[i][j]: This will contain the sum of
                 input->data.F32[x][y] *
                 psPolynomial1DEval(
@@ -381,5 +381,5 @@
                 psPolynomial1DEval(
 chebPolys[j],
-(float) y, 
+(float) y,
 );
         over all pixels (x,y) in the image.
@@ -514,5 +514,5 @@
 
 /*****************************************************************************
-XXX: Use static variables for Chebyshev polynomials and scaling factors. 
+XXX: Use static variables for Chebyshev polynomials and scaling factors.
  *****************************************************************************/
 psImage* p_psImageEvalPolynomialCheb(psImage* input,
@@ -634,2 +634,18 @@
 }
 
+// count number of pixels with given mask value
+long psImageCountPixelMask (psImage *mask,
+                            psMaskType value)
+{
+    long Npixels = 0;
+
+    for (long i = 0; i < mask->numRows; i++) {
+        for (long j = 0; j < mask->numCols; j++) {
+            if (mask->data.U8[i][j] & value) {
+                Npixels ++;
+            }
+        }
+    }
+    return (Npixels);
+}
+
