Index: trunk/psLib/test/imageops/Makefile.am
===================================================================
--- trunk/psLib/test/imageops/Makefile.am	(revision 13084)
+++ trunk/psLib/test/imageops/Makefile.am	(revision 13123)
@@ -21,5 +21,6 @@
 	tap_psImageConvolve2 \
 	tap_psImagePixelExtract \
-	tap_psImageInterpolate2
+	tap_psImageInterpolate2 \
+	tap_psImageMaskOps
 
 #	tap_psImageShiftKernel
Index: trunk/psLib/test/imageops/tap_psImageGeomManip.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 13123)
@@ -5,6 +5,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-05-01 00:08:52 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-02 04:14:33 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -154,7 +154,7 @@
     plan_tests(237);
 
-    // testImageRebin()
-    // This function shall generate a rescaled version of a psImage structure
-    // derived from a specified statistics method.
+    // test psImageRebin()
+    // This function shall generate a rescaled version of a psImage
+    // structure derived from a specified statistics method.
     if (1) {
         psMemId id = psMemGetId();
@@ -295,5 +295,5 @@
         testRebinType(U16);
         testRebinType(S8);
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the input image type is not supported.
         // Following should be an error for unsupported type
@@ -305,5 +305,5 @@
         ok(out == NULL, "psImageRebin returned NULL for unsupported type");
 
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the mask type is not U8
         // Following should be an error for invallid mask type
@@ -314,10 +314,10 @@
         psFree(in);
 
-        // Verify the returned psImage structure is null and program execution
-        // doesn't stop, if the input parameter input is null.
+        // Verify the returned psImage structure is NULL and program execution
+        // doesn't stop, if the input parameter input is NULL.
         out2 = psImageRebin(NULL,NULL,NULL,0,1,&stats);
         ok(out2 == NULL, "psImageRebin returned NULL with NULL input");
 
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the input parameter scale is less than or equal to zero.
         in = psImageAlloc(16, 16, PS_TYPE_F32);
@@ -327,12 +327,12 @@
         ok(out2 == NULL, "psImageRebin returned NULL when the scale was zero");
 
-        // Verify the returned psImage structure is null and program execution
-        // doesn't stop, if the input parameter stats is null.
-        // Following should be an error for stats null
+        // Verify the returned psImage structure is NULL and program execution
+        // doesn't stop, if the input parameter stats is NULL.
+        // Following should be an error for stats NULL
         // XXX: Verify error
         out2 = psImageRebin(NULL,in,NULL,0,1,NULL);
         ok(out2 == NULL, "psImageRebin returned an NULL when the stats was NULL");
 
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the input parameter psStats structure member options
         // is zero or any value which doesn't correspond to a valid statistical
@@ -350,5 +350,5 @@
         ok(out2 == NULL, "psImageRebin returned an image though the stats options was PS_STAT_USE_RANGE");
 
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the input parameter psStats structure member options
         // specifies more than one valid statistical method.
@@ -363,5 +363,5 @@
     }
 
-    // testImageRoll()
+    // test psImageRoll()
     if (1) {
         psMemId id = psMemGetId();
@@ -387,9 +387,7 @@
 
         in = psImageAlloc(cols,rows,PS_TYPE_F32);
-        for (psS32 row=0;row<rows;row++)
-        {
-            psF32 *inRow = in->data.F32[row];
-            for (psS32 col=0;col<cols;col++) {
-                inRow[col] = (psF32)row+(psF32)col/1000.0f;
+        for (psS32 row=0;row<rows;row++) {
+            for (psS32 col=0;col<cols;col++) {
+                in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f;
             }
         }
@@ -397,6 +395,5 @@
         out = psImageRoll(NULL,in,0,0);
         bool errorFlag = false;
-        for (psS32 row=0;row<rows;row++)
-        {
+        for (psS32 row=0;row<rows;row++) {
             psF32 *inRow = in->data.F32[row];
             psF32 *outRow = out->data.F32[row];
@@ -519,9 +516,8 @@
 
 
-        // Verify the returned psImage structure pointer is null and program
-        // execution doesn't stop, if input parameter input is null.
+        // Verify the returned psImage structure pointer is NULL and program
+        // execution doesn't stop, if input parameter input is NULL.
         out2 = psImageRoll(NULL,NULL,0,0);
-        if (out2 != NULL)
-        {
+        if (out2 != NULL) {
             psError(PS_ERR_UNKNOWN, true,"psImageRoll did not return NULL though input image was NULL!?");
             return 2;
@@ -567,6 +563,5 @@
     }
 
-
-    // testImageRotate()
+    // test psImageRotate()
     if (1) {
         psMemId id = psMemGetId();
@@ -599,6 +594,5 @@
         psImage *sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
 
-        for(psS32 row=0;row<rows;row++)
-        {
+        for(psS32 row=0;row<rows;row++) {
             psF32 *fRow = fImg->data.F32[row];
             psS16 *sRow = sImg->data.S16[row];
@@ -612,5 +606,4 @@
         // is to verify the results manually and bless it for automated comparison
         // thereafter
-
 
         // write results of various rotates to a file and verify with truth images
@@ -796,6 +789,6 @@
         }
 //HERE
-        // Verify the returned psImage structure pointer is null and program
-        // execution doesn't stop, if the input parameter input is null.
+        // Verify the returned psImage structure pointer is NULL and program
+        // execution doesn't stop, if the input parameter input is NULL.
         // Following should be an error
         // XXX: Verify error
@@ -803,5 +796,5 @@
         ok(fOut == NULL, "NULL was returned when the input image was NULL");
 
-        // Verify the returned psImage structure pointer is null and program
+        // Verify the returned psImage structure pointer is NULL and program
         // execution doesn't stop, if the specified interpolation mode is unallowed
         // Following should be an error for unallowed interpolation type
@@ -882,6 +875,6 @@
         ok(fRecycle == fOut, "psImageShift did recycle my image");
 
-        // Verify the returned psImage structure pointer is null and program
-        // execution doesn't stop, if the input psImage structure pointer is null.
+        // Verify the returned psImage structure pointer is NULL and program
+        // execution doesn't stop, if the input psImage structure pointer is NULL.
         // Following should be an error
         // XXX: Verify error
@@ -889,5 +882,5 @@
         ok(fOut == NULL, "psImageShift did return NULL given a NULL input image");
 
-        // Verify the returned psImage structure is null and program execution
+        // Verify the returned psImage structure is NULL and program execution
         // doesn't stop, if the specified interpolation mode is unallowed.
         // Following should be an error for unallowed interpolation mode
@@ -901,8 +894,7 @@
 
 
-    // testImageResample()
+    // test psImageResample()
     if (1) {
         psMemId id = psMemGetId();
-
         psS32 rows = 60;
         psS32 cols = 80;
@@ -911,10 +903,8 @@
         psErr *err;
 
-        psImage *image = psImageAlloc(cols,rows,PS_TYPE_F32);
-        for(psS32 row=0;row<rows;row++)
-        {
-            psF32 *imageRow = image->data.F32[row];
-            for (psS32 col=0;col<cols;col++) {
-                imageRow[col] = row+2*col;
+        psImage *image = psImageAlloc(cols, rows, PS_TYPE_F32);
+        for(psS32 row=0;row<rows;row++) {
+            for (psS32 col=0;col<cols;col++) {
+                image->data.F32[row][col] = row+2*col;
             }
         }
@@ -925,9 +915,6 @@
         ok(result == orig, "psImageResample() recycled image");
         ok(result->type.type == PS_TYPE_F32, "psImageResample() produced the correct type");
-
-
         ok(result->numCols == image->numCols*scale && result->numRows == image->numRows*scale,
            "psImageResample() produced the correct size");
-
 
         bool errorFlag = false;
@@ -939,6 +926,5 @@
             psMaskType maskVal;
             psF32 truthValue;
-            for(psS32 row=0;row<result->numRows;row++)
-            {
+            for(psS32 row=0;row<result->numRows;row++) {
                 for (psS32 col=0;col<result->numCols;col++) {
 //                    truthValue = psImagePixelInterpolate(image,
@@ -961,5 +947,5 @@
         ok(!errorFlag, "psImageResample() produced the correct data values");
 
-        // verify that image=null is handled properly.
+        // verify that image=NULL is handled properly.
         psErrorClear();
         result = psImageResample(result,NULL,scale,PS_INTERPOLATE_FLAT);
@@ -1002,5 +988,5 @@
 
 
-    // testImageTransform()
+    // test psImageTransform()
     if (1) {
         psMemId id = psMemGetId();
@@ -1013,22 +999,13 @@
 
         psImage *in = psImageAlloc(cols,rows,PS_TYPE_F32);
-        for (psS32 row=0;row<rows;row++)
-        {
-            psF32 *inRow = in->data.F32[row];
-            for (psS32 col=0;col<cols;col++) {
-                inRow[col] = (psF32)row+(psF32)col/1000.0f;
+        for (psS32 row=0;row<rows;row++) {
+            for (psS32 col=0;col<cols;col++) {
+                in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f;
             }
         }
         P_PSIMAGE_SET_COL0(in, 1);
-        psImage *out = psImageTransform(NULL,
-                                        NULL,
-                                        in,
-                                        NULL,
-                                        0,
-                                        trans,
-                                        psRegionSet(1,1+cols*2,0,rows*2),
-                                        NULL,
-                                        PS_INTERPOLATE_FLAT,
-                                        -1);
+        psImage *out = psImageTransform(NULL, NULL, in, NULL, 0, trans,
+                                        psRegionSet(1,1+cols*2,0,rows*2), NULL,
+                                        PS_INTERPOLATE_FLAT, -1);
 
         ok(out != NULL, "psImageTransform() returned non-NULL");
@@ -1036,5 +1013,5 @@
         ok(out->numRows == rows*2 && out->numCols == cols*2, "psImageTransform() produced the correct size");
 
-        if (0) {
+        if (1) {
             psMemId id = psMemGetId();
             psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
@@ -1045,7 +1022,5 @@
             psMaskType maskVal;
             bool errorFlag = false;
-            for (psS32 row=0;row<out->numRows;row++)
-            {
-                psF32 *outRow = out->data.F32[row];
+            for (psS32 row=0;row<out->numRows;row++) {
                 for (psS32 col=0;col<cols;col++) {
                     psImageInterpolate(&imgVal, &varVal, &maskVal, 
@@ -1054,6 +1029,7 @@
                                        tmpIntOpts);
                     float inValue = imgVal;
-                    if (fabsf(outRow[col] - inValue) > 0.01) {
-                        diag("out at %d,%d was %g, expected %g", col,row,outRow[col], inValue);
+                    if (fabsf(out->data.F32[row][col] - inValue) > 0.01) {
+                        diag("out at %d,%d was %g, expected %g", col,row,
+                              out->data.F32[row][col], inValue);
                         errorFlag = true;
                     }
Index: trunk/psLib/test/imageops/tap_psImageMaskOps.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageMaskOps.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImageMaskOps.c	(revision 13123)
@@ -3,6 +3,6 @@
  *  @brief Contains the tests for psMaskOps.[ch]
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-09 20:40:22 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-02 04:14:33 $
  *
  *  XXX: In general, the image tests with (1, N) and (N, 1) failed and have
@@ -721,4 +721,5 @@
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
+    // XXX: These seg fault
     if (0) genericImageMaskCircleTest(N, 1, N/2, 1, N/4);
     if (0) genericImageMaskCircleTest(1, N, 1, N/2, N/4);
@@ -734,4 +735,5 @@
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
+    // XXX: These seg fault
     if (0) genericImageKeepCircleTest(N, 1, N/2, 1, N/4);
     if (0) genericImageKeepCircleTest(1, N, 1, N/2, N/4);
Index: trunk/psLib/test/imageops/tap_psImagePixelExtract.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13123)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-04-26 22:18:03 $
+*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-05-02 04:14:33 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +17,5 @@
 #include "pstap.h"
 
-psS32 main( psS32 argc, char* argv[] )
+psS32 main(psS32 argc, char* argv[])
 {
     psLogSetFormat("HLNM");
@@ -23,5 +23,5 @@
     plan_tests(248);
 
-    // testImageSlice()
+    // test psImageSlice()
     {
         psMemId id = psMemGetId();
@@ -31,7 +31,7 @@
         const psS32 n = r / 4 -1;
         psImage* image;
-        psPixels* positions = psPixelsAlloc( r );
-        psImage* mask = psImageAlloc( c, r, PS_TYPE_MASK );
-        psStats* stat = psStatsAlloc( PS_STAT_SAMPLE_MEDIAN );
+        psPixels* positions = psPixelsAlloc(r);
+        psImage* mask = psImageAlloc(c, r, PS_TYPE_MASK);
+        psStats* stat = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
     
 
@@ -46,8 +46,8 @@
         // cases should be used for each possible direction. Data region cases
         // should include 0x0, 1x1, Nx1, 1xN, NxN, MxN
-        for ( psS32 row = 0;row < r;row++ ) {
+        for (psS32 row = 0;row < r;row++) {
             psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row];
-            for ( psS32 col = 0;col < c;col++ ) {
-                maskRow[ col ] = 0;
+            for (psS32 col = 0;col < c;col++) {
+                maskRow[col] = 0;
             }
         }
@@ -58,10 +58,10 @@
             psVector* out = NULL; \
             bool errorFlag = false; \
-            image = psImageAlloc( c, r, PS_TYPE_##TYPE ); \
-            for ( psS32 row = 0;row < r;row++ ) { \
-                ps##TYPE *imageRow = image->data.TYPE[ row ]; \
+            image = psImageAlloc(c, r, PS_TYPE_##TYPE); \
+            for (psS32 row = 0;row < r;row++) { \
+                ps##TYPE *imageRow = image->data.TYPE[row]; \
                 ps##TYPE rowOffset = row * 2; \
-                for ( psS32 col = 0;col < c;col++ ) { \
-                    imageRow[ col ] = col + rowOffset; \
+                for (psS32 col = 0;col < c;col++) { \
+                    imageRow[col] = col + rowOffset; \
                 } \
             } \
@@ -111,23 +111,23 @@
         //
         #define PSIMAGESLICE_TEST(TYPE) \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_POS, m, i, n / 2, 0 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_NEG, m, m - 1 - i, n / 2, 1 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_POS, n, m / 2, i, 2 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_NEG, n, m / 2, n - 1 - i, 3 ); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_POS, m, i, n / 2, 0); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_X_NEG, m, m - 1 - i, n / 2, 1); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_POS, n, m / 2, i, 2); \
+        PSIMAGESLICE_TEST1(TYPE, m, n, PS_CUT_Y_NEG, n, m / 2, n - 1 - i, 3); \
         \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_POS, m, i, 0, 4 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_NEG, m, m - 1 - i, 0, 5 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_POS, 1, m / 2, 0, 6 ); \
-        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_NEG, 1, m / 2, 0, 7 ); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_POS, m, i, 0, 4); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_X_NEG, m, m - 1 - i, 0, 5); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_POS, 1, m / 2, 0, 6); \
+        PSIMAGESLICE_TEST1(TYPE, m, 1, PS_CUT_Y_NEG, 1, m / 2, 0, 7); \
         \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_POS, 1, 0, n / 2, 8 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_NEG, 1, 0, n / 2, 9 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_POS, n, 0, i, 10 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_NEG, n, 0, n - 1 - i, 11 ); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_POS, 1, 0, n / 2, 8); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_X_NEG, 1, 0, n / 2, 9); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_POS, n, 0, i, 10); \
+        PSIMAGESLICE_TEST1(TYPE, 1, n, PS_CUT_Y_NEG, n, 0, n - 1 - i, 11); \
         \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_POS, 1, 0, 0, 12 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_NEG, 1, 0, 0, 13 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_POS, 1, 0, 0, 14 ); \
-        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_NEG, 1, 0, 0, 15 ); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_POS, 1, 0, 0, 12); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_X_NEG, 1, 0, 0, 13); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_POS, 1, 0, 0, 14); \
+        PSIMAGESLICE_TEST1(TYPE, 1, 1, PS_CUT_Y_NEG, 1, 0, 0, 15); \
     
         PSIMAGESLICE_TEST(F32);
@@ -149,5 +149,5 @@
                            psRegionSet(c/10, c/10 + 1, r/10, r/10 + 1),
                            PS_CUT_X_POS,
-                           stat );
+                           stat);
         ok(out == NULL, "psImageSlice() returned NULL with NULL input");
     
@@ -156,12 +156,12 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out,
+        out = psImageSlice(out,
                             NULL, image,
                             mask, 1,
                             psRegionSet(c/10, c/10 + 1, r/10, r/10 + 1),
                             PS_CUT_X_POS,
-                            NULL );
+                            NULL);
         ok(out == NULL, "psImageSlice() returned NULL with NULL psStats");
-            psError( PS_ERR_UNKNOWN,true, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected" );
+            psError(PS_ERR_UNKNOWN,true, "Giving a NULL stat struct, psImageSlice didn't return NULL as expected");
 
         // Verify the returned psVector structure pointer is null and program
@@ -182,5 +182,5 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out,
+        out = psImageSlice(out,
                             NULL,
                             image,
@@ -188,5 +188,5 @@
                             psRegionSet(c/10, c/10, r/10, r/10),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with 0x0 region");
     
@@ -196,25 +196,25 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
                             psRegionSet(c+1, c+2, r/10, r/10 + 10),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with unallowed x position");
     
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
                             psRegionSet(c/10, c/10 + 1, r+1,r+5),
                             PS_CUT_X_POS,
-                            stat );
+                            stat);
         ok(out == NULL, "psImageSlice() returned NULL with unallowed y position");
     
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -226,5 +226,5 @@
         // Following should be an error
         // XXX: Verify error
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -240,5 +240,5 @@
         // XXX: Verify error
         stat->options = 0;
-        out = psImageSlice( out, NULL,
+        out = psImageSlice(out, NULL,
                             image,
                             mask, 1,
@@ -253,6 +253,6 @@
         // XXX: Verify error
         stat->options = PS_STAT_SAMPLE_MEDIAN;
-        psImage* maskSz = psImageAlloc( r, c, PS_TYPE_MASK );
-        out = psImageSlice( out, NULL,
+        psImage* maskSz = psImageAlloc(r, c, PS_TYPE_MASK);
+        out = psImageSlice(out, NULL,
                             image,
                             maskSz, 1,
@@ -265,6 +265,6 @@
         // Following should be an error unallowed mask type
         // XXX: Verify error
-        psImage* maskS8 = psImageAlloc( c, r, PS_TYPE_S8 );
-        out =  psImageSlice( out, NULL,
+        psImage* maskS8 = psImageAlloc(c, r, PS_TYPE_S8);
+        out =  psImageSlice(out, NULL,
                              image,
                              maskS8, 1,
@@ -276,10 +276,10 @@
         //Added tests after subimage changes.
         psFree(image);
-        image = psImageAlloc( c, r, PS_TYPE_F64 );
-        for ( psS32 row = 0;row < r;row++ ) {
-            psF64 *imageRow = image->data.F64[ row ];
+        image = psImageAlloc(c, r, PS_TYPE_F64);
+        for (psS32 row = 0;row < r;row++) {
+            psF64 *imageRow = image->data.F64[row];
             psF64 rowOffset = row * 2;
-            for ( psS32 col = 0;col < c;col++ ) {
-                imageRow[ col ] = col + rowOffset;
+            for (psS32 col = 0;col < c;col++) {
+                imageRow[col] = col + rowOffset;
             }
         }
@@ -441,10 +441,10 @@
                     float y = (float)startRow[n]+(float)i*deltaRow;
                     if (n == 1) {
-//                        truth = psImagePixelInterpolate( image, x, y,
+//                        truth = psImagePixelInterpolate(image, x, y,
 //                                                         NULL,0,0,PS_INTERPOLATE_FLAT);
                           psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsNoMask);
                           truth = imgVal;
                     } else {
-//                        truth = psImagePixelInterpolate( image, x, y,
+//                        truth = psImagePixelInterpolate(image, x, y,
 //                                                         mask,1,0,PS_INTERPOLATE_FLAT);
                           psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsMask);
@@ -520,5 +520,5 @@
 
 
-    // testImageRadialCut()
+    // test psImageRadialCut()
     {
         psMemId id = psMemGetId();
@@ -557,5 +557,5 @@
                 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
                     diag("Result was not as expected for radii #%d (%g, expected %d +/- 1)",
-                          result->data.F64[i], (15.0+i*10) );
+                          result->data.F64[i], (15.0+i*10));
                     errorFlag = true;
                 }
@@ -574,5 +574,5 @@
                 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) {
                     diag("Result was not as expected for radii #%d (%g, expected %d +/- 1)",
-                          result->data.F64[i], (15.0+i*10) );
+                          result->data.F64[i], (15.0+i*10));
                     errorFlag = true;
                 }
@@ -709,17 +709,16 @@
         // Following should generate error message(for row)
         // XXX: Verify error
-        out = psImageRow(NULL, image, num);
+        out = psImageRow(NULL, NULL, num);
         ok(out == NULL, "psImageRow() returned NULL with NULL input image");
 
         // Following should generate error message(for col)
         // XXX: Verify error
-        out = psImageCol(NULL, image, num);
+        out = psImageCol(NULL, NULL, num);
         ok(out == NULL, "psImagecol() returned NULL with NULL input image");
-    
         image = psImageAlloc(3, 3, PS_TYPE_F64);
 
 
         //Test for unallowed row0.
-        *(psS32*)&(image->row0) = -1;
+        P_PSIMAGE_SET_ROW0(image, -2);
         // Following should generate error message(for row)
         // XXX: Verify error
@@ -810,4 +809,5 @@
     
         //Test valid cases.
+        //XXX: We do not verify the data values.
         P_PSIMAGE_SET_COL0(image, 10);
         P_PSIMAGE_SET_ROW0(image, 5);
@@ -875,5 +875,5 @@
     
         //Test for error with NULL image
-        empty = psImageCol(empty, emptyImage, 0);
+        empty = psImageCol(empty, NULL, 0);
         ok(empty == NULL, "psImageCol returned NULL for NULL image input");
         //Test for error with Out of Range Row
@@ -894,5 +894,5 @@
         test1 = fabs(rowcol->data.F64[0]-66.6);
         test2 = fabs(rowcol->data.F64[2]-666.66);
-        ok(!( (test1>TOLTST) || (test2>TOLTST)),
+        ok(!((test1>TOLTST) || (test2>TOLTST)),
            "psImageRow returned correct values");
         psFree(rowcol);
Index: trunk/psLib/test/imageops/tap_psImagePixelManip.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImagePixelManip.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImagePixelManip.c	(revision 13123)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-14 21:20:28 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-05-02 04:14:33 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -22,7 +22,7 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(47);
-
-    // testImageClip()
+    plan_tests(107);
+
+    // test psImageClip()
     {
         psMemId id = psMemGetId();
@@ -44,5 +44,5 @@
         // Verify the retuned integer is zero, psImage structure input is unmodified
         // and program executions doesn't stop, if input parameter psImage structure
-        // pointer is null.
+        // pointer is NULL.
         //
         // Verify the retuned integer is zero, psImage structure input is unmodified
@@ -111,5 +111,5 @@
         // Verify the retuned integer is zero, psImage structure input is unmodified
         // and program executions doesn't stop, if input parameter psImage structure
-        // pointer is null.
+        // pointer is NULL.
         retVal = psImageClip(NULL,min,-1.0f,max,-2.0f);
         ok(retVal == 0, "Expected zero return for clips of a NULL image");
@@ -144,5 +144,5 @@
         //
         // Verify the returned integer is zero and program execution doesn't stop,
-        // if the input parameter psImage structure pointer is null.
+        // if the input parameter psImage structure pointer is NULL.
         // create image
         #define testImageClipNaNByType(datatype) \
@@ -193,5 +193,5 @@
         // Verify the retuned integer is zero, psImage structure input is unmodified
         // and program executions doesn't stop, if input parameter psImage structure
-        // pointer is null.
+        // pointer is NULL.
         retVal = psImageClipNaN(NULL,-1.0f);
         ok(retVal == 0, "Expected zero return for clips of a NULL image");
@@ -286,11 +286,10 @@
         testOverlayTypeOP(DATATYPE,=,"=");
 
-
-        //        testOverlayType(F64);
-        //        testOverlayType(F32);
-        //        testOverlayType(S16);
-        //        testOverlayType(S8);
-        //        testOverlayType(U16);
-        //        testOverlayType(U8);
+        testOverlayType(F64);
+        testOverlayType(F32);
+        testOverlayType(S16);
+        testOverlayType(S8);
+        testOverlayType(U16);
+        testOverlayType(U8);
 
         // Verify the returned integer is equal to non-zero and the input psImage structure
@@ -351,5 +350,5 @@
         // Verify the returned integer is equal to non-zero, the input psImage
         // structure is unmodified and program execution doesn't stop, if the
-        // overlay specified is null.
+        // overlay specified is NULL.
         // Following should error as overlay is NULL
         // XXX: Verify error
@@ -371,5 +370,5 @@
 
         // Verify the returned integer is equal to non-zero and program execution
-        // doesn't stop, if the input parameter image is null.
+        // doesn't stop, if the input parameter image is NULL.
         // Following should error as image input is NULL
         // XXX: Verify error
@@ -416,34 +415,4 @@
         ok(retVal != 0, "psImageOverlaySection returned non-zero when checking divide-by-zero");
         errorFlag = false;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
         for (unsigned row=0;row<r;row++)
Index: trunk/psLib/test/imageops/tap_psImageStats.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageStats.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImageStats.c	(revision 13123)
@@ -273,23 +273,23 @@
     const int CHEBY_Y_DIM = 8;
     const int THRESHOLD = 1;
-    psImage *imgIn = psImageAlloc( IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32 );
-    psImage *imgOut = psImageAlloc( IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32 );
-    for (int i = 0;i < IMAGE_SIZE;i++ ) {
-        for (int j = 0;j < IMAGE_SIZE;j++ ) {
+    psImage *imgIn = psImageAlloc(IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32);
+    psImage *imgOut = psImageAlloc(IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32);
+    for (int i = 0;i < IMAGE_SIZE;i++) {
+        for (int j = 0;j < IMAGE_SIZE;j++) {
             imgIn->data.F32[ i ][ j ] = 4.0;
-            imgIn->data.F32[ i ][ j ] = ( float ) ( i + j );
-            imgIn->data.F32[ i ][ j ] = ( float ) ( i + j ) + ( 4.0 * ( float ) i );
+            imgIn->data.F32[ i ][ j ] = (float) (i + j);
+            imgIn->data.F32[ i ][ j ] = (float) (i + j) + (4.0 * (float) i);
             imgOut->data.F32[ i ][ j ] = 0.0;
         }
     }
     psPolynomial2D *my2DPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_CHEB, CHEBY_X_DIM-1, CHEBY_Y_DIM-1);
-    my2DPoly = psImageFitPolynomial(my2DPoly, imgIn );
+    my2DPoly = psImageFitPolynomial(my2DPoly, imgIn);
     ok(my2DPoly != NULL, "psImageFitPolynomial() returned non-NULL");
 
-    imgOut = psImageEvalPolynomial( imgOut, my2DPoly );
+    imgOut = psImageEvalPolynomial(imgOut, my2DPoly);
     bool errorFlag = false;
-    for (int i = 0;i < IMAGE_SIZE;i++ ) {
-        for (int j = 0;j < IMAGE_SIZE;j++ ) {
-            if ( fabs( imgOut->data.F32[ i ][ j ] - imgIn->data.F32[ i ][ j ] ) > THRESHOLD ) {
+    for (int i = 0;i < IMAGE_SIZE;i++) {
+        for (int j = 0;j < IMAGE_SIZE;j++) {
+            if (fabs(imgOut->data.F32[ i ][ j ] - imgIn->data.F32[ i ][ j ]) > THRESHOLD) {
                 diag("Pixel (%d, %d) is %.2f, should be %.2f\n", i, j,
                      imgOut->data.F32[ i ][ j ],
@@ -357,5 +357,5 @@
         ok(hist2 == hist, "psImageHistogram() correctly recycled the input psHistogram");
         bool errorFlag = false;
-        for (int i = 0;i < numBins;i++ ) {
+        for (int i = 0;i < numBins;i++) {
             if (hist2->nums->data.F32[i] != (numCols * (numRows/numBins))) {
                 diag("ERROR: Bin number %d bounds: (%.1f - %.1f) data (%.2f)\n", i,
@@ -434,5 +434,5 @@
     }
 
-    // Ensure psImageCountPixelMask returns -1 for NULL input image
+    // Ensure psImageCountPixelMask returns -1 for wrong input image type
     // Following should generate error
     // XXX: Verify error
@@ -486,5 +486,5 @@
     // --------------------------------------------------------------
     // psImageStats()
-    // Ensure psImageStats() returnes NULL for NULL input image
+    // Ensure psImageStats() returns NULL for NULL input image
     // Following should generate error
     // XXX: Verify error
@@ -499,5 +499,5 @@
     }
 
-    // Ensure psImageStats() returnes NULL for NULL psStats
+    // Ensure psImageStats() returns NULL for NULL psStats
     // Following should generate error
     // XXX: Verify error
Index: trunk/psLib/test/imageops/tap_psImageStructManip.c
===================================================================
--- trunk/psLib/test/imageops/tap_psImageStructManip.c	(revision 13084)
+++ trunk/psLib/test/imageops/tap_psImageStructManip.c	(revision 13123)
@@ -1,11 +1,10 @@
-/** @file  tst_psImageExtraction.c
+/** @file  tap_psImageStructManip.c
 *
 *  @brief Contains the tests for psImageExtraction.[ch]
 *
-*
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-08 01:21:50 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-05-02 04:14:33 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -26,5 +25,4 @@
     // psImageSubset shall create child image of a specified size from a
     // parent psImage structure
-
     // psImageSubset()
     {
@@ -33,10 +31,9 @@
         psS32 c = 128;
         psS32 r = 256;
-        psRegion region1 = psRegionSet(0,c/2,0,r/2);
-        psRegion region2 = psRegionSet(c/4,c/4+c/2,r/4,r/4+r/2);
+        psRegion region1 = psRegionSet(0, c/2, 0, r/2);
+        psRegion region2 = psRegionSet(c/4, c/4+c/2, r/4, r/4+r/2);
 
         psImage* original = psImageAlloc(c,r,PS_TYPE_U32);
-        for (psS32 row=0;row<r;row++)
-        {
+        for (psS32 row=0;row<r;row++) {
             for (psS32 col=0;col<c;col++) {
                 original->data.F32[row][col] = row*1000+col;
@@ -63,6 +60,5 @@
 
         bool errorFlag = false;
-        for (psS32 row=0;row<r/2;row++)
-        {
+        for (psS32 row=0;row<r/2;row++) {
             for (psS32 col=0;col<c/2;col++) {
                 if (subset2->data.U32[row][col] != original->data.U32[row+r/4][col+c/4]) {
@@ -99,5 +95,4 @@
         ok(subset2->children == NULL && subset3->children == NULL, "psImageSubset() set ->children correctly");
 
-
         // Verify the input psImage structure image only has the following members
         // changed: 1) Nchildren is increased by one. 2) parent contains pointer psImage structure
@@ -107,4 +102,5 @@
            "psImageSubset did properly store the children pointers.");
 
+
         // Verify the returned psImage structure pointer is null and program
         // execution doesn't stop, if the input parameter image is null.
@@ -114,4 +110,5 @@
         psImage* subset1 = psImageSubset(NULL,region1);
         ok(subset1 == NULL, "psImageSubset returned NULL when input image was NULL.");
+
 
         // Verify the returned psImage structure pointer is null and program
@@ -153,4 +150,5 @@
         ok(subset1 == NULL,
            "psImageSubset returned NULL when subset origin was outside of image (row0=-1)");
+
 
         // Verify the returned psImage structure pointer is null and program
@@ -205,33 +203,29 @@
         psU32 r = 256;
 
-        psImage* img = psImageAlloc(c,r,PS_TYPE_F32);
-        for (unsigned row=0;row<r;row++)
-        {
-            psF32* imgRow = img->data.F32[row];
+        psImage *img = psImageAlloc(c,r,PS_TYPE_F32);
+        for (unsigned row=0;row<r;row++) {
             for (unsigned col=0;col<c;col++) {
-                imgRow[col] = (psF32)(row+col);
-            }
-        }
-        psImage* img2 = psImageAlloc(c,r,PS_TYPE_F32);
-        for (unsigned row=0;row<r;row++)
-        {
-            psF32* img2Row = img2->data.F32[row];
+                img->data.F32[row][col] = (psF32)(row+col);
+            }
+        }
+        psImage *img2 = psImageAlloc(c,r,PS_TYPE_F32);
+        for (unsigned row=0;row<r;row++) {
             for (unsigned col=0;col<c;col++) {
-                img2Row[col] = 0.0f;
-            }
-        }
-
-        psImage* img3 = psImageCopy(img2,img,PS_TYPE_F32);
-        // Verify the returned psImage structure pointer is equal to the input parameter output.
+                img2->data.F32[row][col] = 0.0f;
+            }
+        }
+
+        psImage *img3 = psImageCopy(img2,img,PS_TYPE_F32);
+        // Verify the returned psImage structure pointer is equal to the input
+        // parameter output.
         ok(img2 == img3, "psImageCopy(): recycled input image");
 
-        // Verify the returned psImage structure is the same type as the input image structure
-        // if the specified output argument is NULL.
-        psImage* img4 = psImageCopy(NULL,img,PS_TYPE_F32);
+        // Verify the returned psImage structure is the same type as the input image
+        // structure if the specified output argument is NULL.
+        psImage *img4 = psImageCopy(NULL,img,PS_TYPE_F32);
         ok(img4 != NULL, "psImageCopy() returned non-NULL with NULL output argument");
         ok(img4->type.type == img->type.type, "psImageCopy() set the correct image type");
         bool errorFlag = false;
-        for (psU32 row=0;row<r;row++)
-        {
+        for (psU32 row=0;row<r;row++) {
             psF32* imgInRow = img->data.F32[row];
             psF32* imgOutRow = img4->data.F32[row];
@@ -326,14 +320,12 @@
         psS32 halfR = r/2;
         psS32 halfC = c/2;
-        psRegion centerHalf = {qtrC,qtrC+halfC,qtrR,qtrR+halfR};
+        psRegion centerHalf = {qtrC, qtrC+halfC, qtrR, qtrR+halfR};
 
         psImage* image = psImageAlloc(c,r,PS_TYPE_F32);
-        for (psS32 row = 0; row < image->numRows; row++)
-        {
+        for (psS32 row = 0; row < image->numRows; row++) {
             for (psS32 col = 0; col < image->numCols; col++) {
                 image->data.F32[row][col] = (psF32)col + (psF32)row/1000.0f;
             }
         }
-
         // invoke psImageTrim with non-NULL image, and a valid region
         // x0,y0->x1,y1 (using only positive values). Verify that:
@@ -350,6 +342,5 @@
 
         bool errorFlag = false;
-        for (psS32 row = 0; row < image2->numRows; row++)
-        {
+        for (psS32 row = 0; row < image2->numRows; row++) {
             for (psS32 col = 0; col < image2->numCols; col++) {
                 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC])
@@ -379,6 +370,5 @@
            image->numCols-qtrC, image->numRows-qtrR);
 
-        for (psS32 row = 0; row < image2->numRows; row++)
-        {
+        for (psS32 row = 0; row < image2->numRows; row++) {
             for (psS32 col = 0; col < image2->numCols; col++) {
                 if (fabsf(image2->data.F32[row][col] -
@@ -394,5 +384,6 @@
         ok(!errorFlag, "psImageTrim() set image data correctly");
 
-        //  4. invoke psImageTrim with x1<0, y1<0. Verify:
+
+        //  Invoke psImageTrim with x1<0, y1<0. Verify:
         //      a. the psImage size is (numCols+x1)-x0 by (numRows+y1)-y0.
         //      b. the pixel values coorespond to the region
@@ -405,7 +396,5 @@
            image2->numCols, image2->numRows,
            image->numCols-qtrC, image->numRows-qtrR);
-
-        for (psS32 row = 0; row < image2->numRows; row++)
-        {
+        for (psS32 row = 0; row < image2->numRows; row++) {
             for (psS32 col = 0; col < image2->numCols; col++) {
                 if (fabsf(image2->data.F32[row][col] -
@@ -422,5 +411,6 @@
         psFree(image1);
 
-        //  6. invoke psImageTrim with image=NULL Verify:
+
+        //  Invoke psImageTrim with image=NULL Verify:
         //      a. execution does not cease.
         //      b. return value is NULL
@@ -428,6 +418,4 @@
         // An error should follow...
         // XXX: Verify errors
-
-
         image2 = psImageTrim(NULL, psRegionSet(qtrC,0,qtrR,0));
         ok(image2 == NULL, "psImageTrim returned NULL given a NULL input image");
@@ -438,4 +426,5 @@
 
 
+        // Verify when psRegion has a coord at -1
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(-1,0,0,0));
@@ -447,4 +436,5 @@
 
 
+        // Verify when psRegion has a coord at -1
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(0,0,-1,0));
@@ -456,4 +446,5 @@
 
 
+        // Verify when psRegion has a coord at outside the image range
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(0,image->numCols+1,0,0));
@@ -465,4 +456,5 @@
 
 
+        // Verify when psRegion has a coord at outside the image range
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(0,0,0,image->numRows+1));
@@ -474,4 +466,5 @@
 
 
+        // Verify when psRegion has a coord at outside the image range
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(0,0,0,(((psF32)image->numRows)*-1.0)));
@@ -483,4 +476,5 @@
 
 
+        // Verify when psRegion has a coord at outside the image range
         image1 = psImageCopy(NULL,image,PS_TYPE_F32);
         image2 = psImageTrim(image1, psRegionSet(0,(((psF32)image->numCols)*-1.0),0,0));
