Index: trunk/psLib/test/image/tst_psImage.c
===================================================================
--- trunk/psLib/test/image/tst_psImage.c	(revision 1915)
+++ trunk/psLib/test/image/tst_psImage.c	(revision 1920)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-02 21:17:03 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-28 23:26:49 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,22 +26,10 @@
 
 testDescription tests[] = {
-                              {
-                                  testImageAlloc,546,"psImageAlloc",0,false
-                              },
-                              {
-                                  testImageAlloc,548,"psImageFree",0,true
-                              },
-                              {
-                                  testImageSubset,547,"psImageSubset",0,false
-                              },
-                              {
-                                  testImageSubset,550,"psImageSubset",0,true
-                              },
-                              {
-                                  testImageCopy,551,"psImageCopy",0,false
-                              },
-                              {
-                                  NULL
-                              }
+                              {testImageAlloc,546,"psImageAlloc",0,false},
+                              {testImageAlloc,548,"psImageFree",0,true},
+                              {testImageSubset,547,"psImageSubset",0,false},
+                              {testImageSubset,550,"psImageSubset",0,true},
+                              {testImageCopy,551,"psImageCopy",0,false},
+                              {NULL}
                           };
 
@@ -119,12 +107,6 @@
             }
 
-            if (image->nChildren != 0) {
-                psError(__func__,"psImageAlloc returned non-zero number of children");
-                psFree(image);
-                return 6;
-            }
-
             if (image->children != NULL) {
-                psError(__func__,"psImageAlloc returned non-NULL children vector");
+                psError(__func__,"psImageAlloc returned non-NULL children array");
                 psFree(image);
                 return 7;
@@ -259,19 +241,13 @@
                 }
             }
-
-            // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
-            // children is freed.
             psFree(image);
         }
     }
 
-    // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
-    psFree(NULL);
-
     // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
-    // children isfreed.
+    // children is freed.
     image = psImageAlloc(100,100,PS_TYPE_F32);
-    psImageSubset(image,50,50,0,0);
-    psImageSubset(image,50,50,20,20);
+    psImageSubset(image,50,0,70,20);
+    psImageSubset(image,70,20,90,40);
 
     psFree(image);
@@ -300,7 +276,22 @@
     memcpy(&preSubsetStruct,original,sizeof(psImage));
 
-    subset2 = psImageSubset(original,c/2,r/2,c/4,r/4);
-
-    subset3 = psImageSubset(original,c/2,r/2,0,0);
+    subset2 = psImageSubset(original,c/4,r/4,c/4+c/2,r/4+r/2);
+
+    subset3 = psImageSubset(original,0,0,c/2,r/2);
+
+    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "
+             "the input parameter nrow and ncol respectively.");
+
+    if (subset2->numCols != c/2 || subset2->numRows != r/2) {
+        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
+                subset2->numCols, subset2->numRows, c/2,r/2);
+        return 1;
+    }
+
+    if (subset3->numCols != c/2 || subset3->numRows != r/2) {
+        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
+                subset3->numCols, subset3->numRows, c/2,r/2);
+        return 2;
+    }
 
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
@@ -322,13 +313,4 @@
     }
 
-    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "
-             "the input parameter nrow and ncol respectively.");
-
-    if (subset3->numCols != c/2 || subset3->numRows != r/2) {
-        psError(__func__,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
-                subset3->numCols, subset3->numRows, c/2,r/2);
-        return 5;
-    }
-
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input "
              "psImage structure member type.");
@@ -367,12 +349,4 @@
     }
 
-    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member Nchildren is equal to "
-             "zero.");
-
-    if (subset2->nChildren != 0 || subset3->nChildren != 0) {
-        psError(__func__,"psImageSubset didn't set nChildren to zero.");
-        return 11;
-    }
-
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member children is null.");
 
@@ -386,9 +360,9 @@
              "out at parent[Nchildren-1].");
 
-    if (original->nChildren != preSubsetStruct.nChildren+2) {
-        psError(__func__,"psImageSubset didn't increment nChildren by one per subset.");
+    if (original->children == NULL || original->children->n != 2) {
+        psError(__func__,"psImageSubset didn't increment number of children by one per subset.");
         return 12;
     }
-    if (original->children[0] != subset2 || original->children[1] != subset3) {
+    if (original->children->data[0] != subset2 || original->children->data[1] != subset3) {
         psError(__func__,"psImageSubset didn't properly store the children pointers.");
         return 13;
@@ -400,5 +374,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,c/2,r/2,0,0);
+    subset1 = psImageSubset(NULL,0,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
@@ -412,5 +386,5 @@
     memcpy(&preSubsetStruct,original,sizeof(psImage));
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,0,0,0);
+    subset1 = psImageSubset(original,0,r/2,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
@@ -418,5 +392,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,0,r/2,0,0);
+    subset1 = psImageSubset(original,c/2,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
@@ -434,5 +408,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c,0);
+    subset1 = psImageSubset(original,0,0,c/2,r*2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -441,5 +415,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,r);
+    subset1 = psImageSubset(original,0,0,c*2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -448,5 +422,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,-1,0);
+    subset1 = psImageSubset(original,-1,0,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -455,5 +429,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,-1);
+    subset1 = psImageSubset(original,0,-1,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -468,5 +442,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c/2,0);
+    subset1 = psImageSubset(original,0,0,c/2,r+1);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
@@ -474,5 +448,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,0,r/2);
+    subset1 = psImageSubset(original,0,0,c+1,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
@@ -480,5 +454,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(original,c/2,r/2,c/2,r/2);
+    subset1 = psImageSubset(original,0,0,c+1,r+1);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
@@ -494,13 +468,7 @@
 
     // Verify the returned psImage structure member Nchildren is set to zero.
-    if (original->nChildren != 0) {
-        psError(__func__,"psImageFreeChildren didn't set nChildren to zero.");
+    if (original->children != NULL && original->children->n > 0) {
+        psError(__func__,"psImageFreeChildren didn't set number of children to zero.");
         return 25;
-    }
-
-    // Verify the returned psImage structure member children pointer is set to null.
-    if (original->children != NULL) {
-        psError(__func__,"psImageFreeChildren didn't set children ptr to NULL.");
-        return 26;
     }
 
Index: trunk/psLib/test/image/verified/tst_psImage.stderr
===================================================================
--- trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1915)
+++ trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1920)
@@ -95,7 +95,7 @@
 
 <DATE><TIME>|<HOST>|I|testImageSubset
+    Verify the returned psImage structure members nrow and ncol are equal to the input parameter nrow and ncol respectively.
+<DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure contains expected values in the row member, if the input psImage structure image contains known values.
-<DATE><TIME>|<HOST>|I|testImageSubset
-    Verify the returned psImage structure members nrow and ncol are equal to the input parameter nrow and ncol respectively.
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure member type is equal to the input psImage structure member type.
@@ -104,6 +104,4 @@
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure member parent is equal to the input psImage structure pointer image.
-<DATE><TIME>|<HOST>|I|testImageSubset
-    Verify the returned psImage structure member Nchildren is equal to zero.
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure member children is null.
@@ -121,9 +119,9 @@
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified number of rows (64) or columns (0) is invalid.
+    Specified subset range, [0:<LINENO>,128:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified number of rows (0) or columns (128) is invalid.
+    Specified subset range, [64:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure pointer is null and program execution doesn't stop, if the input parameters row0 and col0 are not within the range of values of psImage structure image.
@@ -131,17 +129,17 @@
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [128:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [0:<LINENO>,256:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [-1:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [-1:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [0:<LINENO>,-1:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,-1:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     Verify the returned psImage structure pointer is null and program execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of data not within the input psImage structure image.  Also verify the input psImage structure is not modified.
@@ -149,13 +147,13 @@
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [64:<LINENO>,0:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [0:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     An error should follow...
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSubset
-    Specified subset range, [64:<LINENO>,128:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [0:<LINENO>,0:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSubset
     psImageFreeChildren shall deallocate any children images of a psImage structure
Index: trunk/psLib/test/image/verified/tst_psImageExtraction.stderr
===================================================================
--- trunk/psLib/test/image/verified/tst_psImageExtraction.stderr	(revision 1915)
+++ trunk/psLib/test/image/verified/tst_psImageExtraction.stderr	(revision 1920)
@@ -24,17 +24,17 @@
     Following should be an error.
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
-    Specified subset range, [2001:<LINENO>,2002:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [2001:<LINENO>,2002:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
-    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [200:<LINENO>,201:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
-    Specified subset range, [200:<LINENO>,2200:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [200:<LINENO>,2200:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice
-    Specified subset range, [200:<LINENO>,201:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [200:<LINENO>,201:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageSlice
     Following should be an error.
Index: trunk/psLib/test/image/verified/tst_psImageManip.stderr
===================================================================
--- trunk/psLib/test/image/verified/tst_psImageManip.stderr	(revision 1915)
+++ trunk/psLib/test/image/verified/tst_psImageManip.stderr	(revision 1920)
@@ -125,5 +125,5 @@
     Following should error as overlay isn't within image boundaries
 <DATE><TIME>|<HOST>|E|psLib.image.psImageOverlaySection
-    Specified subset range, [32:<LINENO>,64:<LINENO>], lies outside psImage's boundaries, [0:<LINENO>,0:<LINENO>].
+    Specified subset range, [32:<LINENO>,64:<LINENO>], is invalid or outside input psImage's boundaries, [0:<LINENO>,0:<LINENO>].
 <DATE><TIME>|<HOST>|I|testImageOverlay
     Following should error as overlay is NULL
