Index: /trunk/psLib/psLib.kdevses
===================================================================
--- /trunk/psLib/psLib.kdevses	(revision 1605)
+++ /trunk/psLib/psLib.kdevses	(revision 1606)
@@ -2,45 +2,15 @@
 <!DOCTYPE KDevPrjSession>
 <KDevPrjSession>
- <DocsAndViews NumberOfDocuments="8" >
-  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psMemory.c" >
+ <DocsAndViews NumberOfDocuments="2" >
+  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImage.c" >
    <View0 line="0" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="751" Left="2" MinMaxMode="0" />
+    <AdditionalSettings Top="2" Width="1183" Attach="1" Height="775" Left="2" MinMaxMode="0" />
    </View0>
   </Doc0>
-  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psMemory.c" >
-   <View0 line="227" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
+  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImage.h" >
+   <View0 line="31" Type="???" >
+    <AdditionalSettings Top="2" Width="1183" Attach="1" Height="749" Left="2" MinMaxMode="0" />
    </View0>
   </Doc1>
-  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psType.h" >
-   <View0 line="93" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc2>
-  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadata_02.c" >
-   <View0 line="0" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc3>
-  <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadata_01.c" >
-   <View0 line="242" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="531" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc4>
-  <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/psMetadata.c" >
-   <View0 line="45" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc5>
-  <Doc6 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psError.c" >
-   <View0 line="86" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="531" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc6>
-  <Doc7 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/makedir/psAstrometry.d" >
-   <View0 line="0" Type="???" >
-    <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
-   </View0>
-  </Doc7>
  </DocsAndViews>
  <pluginList>
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 1605)
+++ /trunk/psLib/src/image/psImage.c	(revision 1606)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:34:58 $
+ *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -43,13 +43,6 @@
 {
     int area = 0;
-    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
-
-    // size in
-    // bytes
-    int rowSize = numCols * elementSize;        // row
-
-    // size
-
-    // in bytes.
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
+    int rowSize = numCols * elementSize;        // row size in bytes.
 
     area = numCols * numRows;
@@ -71,12 +64,17 @@
     image->data.V = psAlloc(sizeof(void *) * numRows);
     if (image->data.V == NULL) {
+        psFree(image);
         psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
-    image->data.V[0] = psAlloc(area * elementSize);
-    if (image->data.V[0] == NULL) {
+    image->rawDataBuffer = psAlloc(area * elementSize);
+    if (image->rawDataBuffer == NULL) {
+        psFree(image);
+        psFree(image->data.V);
         psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
+    // set the row pointers.
+    image->data.V[0] = image->rawDataBuffer;
     for (int i = 1; i < numRows; i++) {
         image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
@@ -119,5 +117,5 @@
     psImageFreeChildren(image);
 
-    psFree(image->data.V[0]);
+    psFree(image->rawDataBuffer);
     psFree(image->data.V);
     image->data.V = NULL;
@@ -167,8 +165,9 @@
     }
     // Resize the image buffer
-    old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
+    old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize);
     old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
 
     // recreate the row pointers
+    old->data.V[0] = old->rawDataBuffer;
     for (int i = 1; i < numRows; i++) {
         old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
Index: /trunk/psLib/src/image/psImage.h
===================================================================
--- /trunk/psLib/src/image/psImage.h	(revision 1605)
+++ /trunk/psLib/src/image/psImage.h	(revision 1606)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-10 01:05:53 $
+ *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -68,4 +68,6 @@
     int nChildren;                     ///< Number of subimages.
     struct psImage* *children;         ///< Children of this region.
+
+    void* rawDataBuffer;
 }
 psImage;
Index: /trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.c	(revision 1605)
+++ /trunk/psLib/src/image/psImageExtraction.c	(revision 1606)
@@ -10,6 +10,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-20 01:10:54 $
+*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-23 22:36:03 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,6 +23,5 @@
 #include "psError.h"
 
-psImage* psImageSubset(psImage* out,
-                       psImage* image,
+psImage* psImageSubset(psImage* image,
                        unsigned int numCols,
                        unsigned int numRows,
@@ -30,20 +29,7 @@
                        unsigned int row0)
 {
-    unsigned int elementSize;   // size of image
-
-    // element in
-    // bytes
-    unsigned int outputRowSize; // output row
-
-    // size in bytes
-    unsigned int inputColOffset;        // offset
-
-    // in
-    // bytes
-    // to
-    // first
-    // subset
-
-    // pixel in input row
+    psImage* out;
+    unsigned int elementSize;          // size of image element in bytes
+    unsigned int inputColOffset;       // offset in bytes to first subset pixel in input row
 
     if (image == NULL || image->data.V == NULL) {
@@ -80,24 +66,29 @@
     elementSize = PSELEMTYPE_SIZEOF(image->type.type);
 
-    out = psImageRecycle(out, numCols, numRows, image->type.type);
-
-    // set the parent information into the child
-    // output image
-    *(int *)&out->row0 = row0;
-    *(int *)&out->col0 = col0;
-    *(psImage* *) & out->parent = (psImage* ) image;
+    out = psAlloc(sizeof(psImage));
+    *(psType*)&out->type = image->type;
+    *(unsigned int*)&out->numCols = numCols;
+    *(unsigned int*)&out->numRows = numRows;
+    *(int*)&out->row0 = row0;
+    *(int*)&out->col0 = col0;
+    out->parent = image;
+    out->nChildren = 0;
+    out->children = NULL;
+    out->rawDataBuffer = psMemIncrRefCounter(image->rawDataBuffer);
+    out->data.V = psAlloc(sizeof(void*)*numRows);
+
+    // set the new psImage's deallocator to the same as the input image
+    p_psMemSetDeallocator(out,p_psMemGetDeallocator(image));
+
+    inputColOffset = elementSize * col0;
+    for (int row = 0; row < numRows; row++) {
+        out->data.V[row] = image->data.U8[row0 + row] + inputColOffset;
+    }
 
     // add output image as a child of the input
     // image.
     image->nChildren++;
-    image->children = (psImage* *) psRealloc(image->children, image->nChildren * sizeof(psImage* ));
+    image->children = (psImage**) psRealloc(image->children, image->nChildren * sizeof(psImage* ));
     image->children[image->nChildren - 1] = out;
-
-    inputColOffset = elementSize * col0;
-    outputRowSize = elementSize * numCols;
-
-    for (int row = 0; row < numRows; row++) {
-        memcpy(out->data.V[row], image->data.U8[row0 + row] + inputColOffset, outputRowSize);
-    }
 
     return (out);
@@ -151,12 +142,18 @@
     // datatype.
     if (type == inDatatype) {
-        memcpy(output->data.V[0], input->data.V[0], elementSize * elements);
+        for (int row=0;row<numRows;row++) {
+            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
+        }
         return output;
     }
     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
-        ps##INTYPE *in = IN->data.INTYPE[0]; \
-        ps##OUTTYPE *out = OUT->data.OUTTYPE[0]; \
-        for (int e=0;e<ELEMENTS;e++) { \
-            *(out++) = *(in++); \
+        ps##INTYPE *in; \
+        ps##OUTTYPE *out; \
+        for(int row=0;row<numRows;row++) { \
+            in = IN->data.INTYPE[row]; \
+            out = OUT->data.OUTTYPE[row]; \
+            for (int col=0;col<numCols;col++) { \
+                *(out++) = *(in++); \
+            } \
         } \
     }
Index: /trunk/psLib/src/image/psImageExtraction.h
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.h	(revision 1605)
+++ /trunk/psLib/src/image/psImageExtraction.h	(revision 1606)
@@ -10,6 +10,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-09 23:40:55 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-23 22:36:03 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,5 +44,4 @@
  */
 psImage* psImageSubset(
-    psImage* out,                      ///< image to recycle, or NULL.
     psImage* image,                    ///< Parent image.
     unsigned int numCols,              ///< Subimage width (<= image.nCols - col0).
@@ -50,4 +49,17 @@
     unsigned int col0,                 ///< Subimage col-offset (0 <= col0 < nCol).
     unsigned int row0                  ///< Subimage row-offset (0 <= row0 < nCol).
+);
+
+/** Create a subimage of the specified area.
+ *
+ * Uses psLib memory allocation functions to create an image based on a larger
+ * one.
+ *
+ * @return psImage* : Pointer to psImage.
+ *
+ */
+psImage* psImageSubsection(
+    psImage* image,                    ///< Parent image.
+    const char* section                ///< Subsection in the form '[x1:x2,y1:y2]'
 );
 
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 1605)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 1606)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:34:58 $
+ *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -43,13 +43,6 @@
 {
     int area = 0;
-    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
-
-    // size in
-    // bytes
-    int rowSize = numCols * elementSize;        // row
-
-    // size
-
-    // in bytes.
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
+    int rowSize = numCols * elementSize;        // row size in bytes.
 
     area = numCols * numRows;
@@ -71,12 +64,17 @@
     image->data.V = psAlloc(sizeof(void *) * numRows);
     if (image->data.V == NULL) {
+        psFree(image);
         psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
-    image->data.V[0] = psAlloc(area * elementSize);
-    if (image->data.V[0] == NULL) {
+    image->rawDataBuffer = psAlloc(area * elementSize);
+    if (image->rawDataBuffer == NULL) {
+        psFree(image);
+        psFree(image->data.V);
         psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
+    // set the row pointers.
+    image->data.V[0] = image->rawDataBuffer;
     for (int i = 1; i < numRows; i++) {
         image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
@@ -119,5 +117,5 @@
     psImageFreeChildren(image);
 
-    psFree(image->data.V[0]);
+    psFree(image->rawDataBuffer);
     psFree(image->data.V);
     image->data.V = NULL;
@@ -167,8 +165,9 @@
     }
     // Resize the image buffer
-    old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
+    old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize);
     old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
 
     // recreate the row pointers
+    old->data.V[0] = old->rawDataBuffer;
     for (int i = 1; i < numRows; i++) {
         old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 1605)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 1606)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-10 01:05:53 $
+ *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -68,4 +68,6 @@
     int nChildren;                     ///< Number of subimages.
     struct psImage* *children;         ///< Children of this region.
+
+    void* rawDataBuffer;
 }
 psImage;
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 1605)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 1606)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-10 01:55:34 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -135,10 +135,32 @@
                );
 
-void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
-psFreeFcn p_psMemGetDeallocator(void *ptr);
-
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
 #endif
+
+/** Set the deallocator routine
+ *
+ *  A deallocator routine can optionally be assigned to a memory block to 
+ *  ensure that associated memory blocks also get freed, e.g., memory buffers
+ *  referenced within a struct.
+ *
+ */
+void p_psMemSetDeallocator(
+    void *ptr,                         ///< the memory block to operate on
+    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
+);
+
+/** Get the deallocator routine
+ *
+ *  This function returns the deallocator for a memory block.  A deallocator 
+ *  routine can optionally be assigned to a memory block to ensure that 
+ *  associated memory blocks also get freed, e.g., memory buffers referenced 
+ *  within a struct.  
+ *
+ *  @return psFreeFcn    the routine to be called at deallocation.
+ */
+psFreeFcn p_psMemGetDeallocator(
+    void *ptr                          ///< the memory block
+);
 
 /** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
Index: /trunk/psLib/src/sysUtils/psMemory.h
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.h	(revision 1605)
+++ /trunk/psLib/src/sysUtils/psMemory.h	(revision 1606)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-10 01:55:34 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -135,10 +135,32 @@
                );
 
-void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
-psFreeFcn p_psMemGetDeallocator(void *ptr);
-
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
 #define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
 #endif
+
+/** Set the deallocator routine
+ *
+ *  A deallocator routine can optionally be assigned to a memory block to 
+ *  ensure that associated memory blocks also get freed, e.g., memory buffers
+ *  referenced within a struct.
+ *
+ */
+void p_psMemSetDeallocator(
+    void *ptr,                         ///< the memory block to operate on
+    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
+);
+
+/** Get the deallocator routine
+ *
+ *  This function returns the deallocator for a memory block.  A deallocator 
+ *  routine can optionally be assigned to a memory block to ensure that 
+ *  associated memory blocks also get freed, e.g., memory buffers referenced 
+ *  within a struct.  
+ *
+ *  @return psFreeFcn    the routine to be called at deallocation.
+ */
+psFreeFcn p_psMemGetDeallocator(
+    void *ptr                          ///< the memory block
+);
 
 /** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
Index: /trunk/psLib/test/image/tst_psImage.c
===================================================================
--- /trunk/psLib/test/image/tst_psImage.c	(revision 1605)
+++ /trunk/psLib/test/image/tst_psImage.c	(revision 1606)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:06 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -50,9 +50,5 @@
     psLogSetLevel(PS_LOG_INFO);
 
-    if (! runTestSuite(stderr,"psImage",tests,argc,argv)) {
-        psError(__FILE__,"One or more tests failed");
-        return 1;
-    }
-    return 0;
+    return ! runTestSuite(stderr,"psImage",tests,argc,argv);
 }
 
@@ -247,6 +243,6 @@
     // children isfreed.
     image = psImageAlloc(100,100,PS_TYPE_F32);
-    psImageSubset(NULL,image,50,50,0,0);
-    psImageSubset(NULL,image,50,50,20,20);
+    psImageSubset(image,50,50,0,0);
+    psImageSubset(image,50,50,20,20);
 
     psFree(image);
@@ -273,31 +269,9 @@
     }
 
-    psLogMsg(__func__,PS_LOG_INFO,"memcpy(&preSubsetStruct,original,sizeof(psImage));");
     memcpy(&preSubsetStruct,original,sizeof(psImage));
 
-    psLogMsg(__func__,PS_LOG_INFO,"subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);");
-    subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);
-
-    psLogMsg(__func__,PS_LOG_INFO,"subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);");
-    subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);
-
-    psLogMsg(__func__,PS_LOG_INFO,"subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);");
-    subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);
-
-    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure is equal to the input psImage "
-             "structure parameter out, if input parameter out is specified.");
-
-    if (subset1 != subset2 || subset2 == NULL) {
-        psError(__func__,"psImageSubset didn't recycle the psImage given");
-        return 1;
-    }
-
-    psLogMsg(__func__,PS_LOG_INFO,"Verify a new psImage structure is created, if input parameter out is set "
-             "to null.");
-
-    if (subset3 == NULL) {
-        psError(__func__,"psImageSubset output was NULL for subset3.");
-        return 2;
-    }
+    subset2 = psImageSubset(original,c/2,r/2,c/4,r/4);
+
+    subset3 = psImageSubset(original,c/2,r/2,0,0);
 
     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
@@ -397,5 +371,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,NULL,c/2,r/2,0,0);
+    subset1 = psImageSubset(NULL,c/2,r/2,0,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
@@ -409,5 +383,5 @@
     memcpy(&preSubsetStruct,original,sizeof(psImage));
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,0,0,0);
+    subset1 = psImageSubset(original,c/2,0,0,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
@@ -415,5 +389,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,0,r/2,0,0);
+    subset1 = psImageSubset(original,0,r/2,0,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
@@ -431,5 +405,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,c,0);
+    subset1 = psImageSubset(original,c/2,r/2,c,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -438,5 +412,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,0,r);
+    subset1 = psImageSubset(original,c/2,r/2,0,r);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -445,5 +419,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,-1,0);
+    subset1 = psImageSubset(original,c/2,r/2,-1,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -452,5 +426,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,0,-1);
+    subset1 = psImageSubset(original,c/2,r/2,0,-1);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
@@ -465,5 +439,5 @@
 
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,0);
+    subset1 = psImageSubset(original,c/2,r/2,c/2,0);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
@@ -471,5 +445,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,0,r/2);
+    subset1 = psImageSubset(original,c/2,r/2,0,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
@@ -477,5 +451,5 @@
     }
     psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
-    subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,r/2);
+    subset1 = psImageSubset(original,c/2,r/2,c/2,r/2);
     if (subset1 != NULL) {
         psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
Index: /trunk/psLib/test/image/tst_psImageFFT.c
===================================================================
--- /trunk/psLib/test/image/tst_psImageFFT.c	(revision 1605)
+++ /trunk/psLib/test/image/tst_psImageFFT.c	(revision 1606)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:06 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-23 22:36:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -58,8 +58,5 @@
     psLogSetLevel(PS_LOG_INFO);
 
-    if (! runTestSuite(stderr,"psFFT",tests,argc,argv) ) {
-        psAbort(__FILE__,"One or more tests failed");
-    }
-    return 0;
+    return (! runTestSuite(stderr,"psFFT",tests,argc,argv) );
 }
 
@@ -84,5 +81,5 @@
 
     // 2. perform a forward transform
-    img2 = psImageFFT(NULL,img,PS_FFT_FORWARD);
+    img2 = psImageFFT(img2,img,PS_FFT_FORWARD);
     if (img2->type.type != PS_TYPE_C32) {
         psError(__func__,"FFT didn't produce complex values?");
@@ -109,6 +106,8 @@
     }
 
+
     // 4. perform a reverse transform
-    img3 = psImageFFT(NULL,img2,PS_FFT_REVERSE);
+    img3 = psImageFFT(img3,img2,PS_FFT_REVERSE);
+
     if (img3->type.type != PS_TYPE_C32) {
         psError(__func__,"FFT didn't produce complex values?");
@@ -122,5 +121,5 @@
             psF32 pixel = creal(img3Row[col])/m/n;
             if (fabsf(pixel-imgRow[col]) > 0.1) {
-                psError(__func__,"Reverse FFT didn't gime original image back (%d,%d %.2f vs %.2f)",
+                psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
                         col,row,pixel,imgRow[col]);
                 return 5;
Index: /trunk/psLib/test/image/verified/tst_psImage.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1605)
+++ /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 1606)
@@ -39,10 +39,4 @@
 \**********************************************************************************/
 
-<DATE><TIME>|<HOST>|I|testImageSubset|memcpy(&preSubsetStruct,original,sizeof(psImage));
-<DATE><TIME>|<HOST>|I|testImageSubset|subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);
-<DATE><TIME>|<HOST>|I|testImageSubset|subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);
-<DATE><TIME>|<HOST>|I|testImageSubset|subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);
-<DATE><TIME>|<HOST>|I|testImageSubset|Verify the returned psImage structure is equal to the input psImage structure parameter out, if input parameter out is specified.
-<DATE><TIME>|<HOST>|I|testImageSubset|Verify a new psImage structure is created, if input parameter out is set to null.
 <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.
