Index: /trunk/psLib/src/Makefile.Globals
===================================================================
--- /trunk/psLib/src/Makefile.Globals	(revision 2878)
+++ /trunk/psLib/src/Makefile.Globals	(revision 2879)
@@ -6,6 +6,6 @@
 ##  Assumptions:    Variable "prefix" already defined
 ##
-##  $Revision: 1.37 $  $Name: not supported by cvs2svn $
-##  $Date: 2005-01-03 23:37:52 $
+##  $Revision: 1.38 $  $Name: not supported by cvs2svn $
+##  $Date: 2005-01-04 02:34:56 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -61,5 +61,4 @@
 
 XML2_CFLAGS := $(shell $(xml2config) --cflags)
-XML2_CFLAGS = -I/usr/local/include/libxml2
 
 # Set initial value for CFLAGS which will include all OS common flags for GCC
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 2878)
+++ /trunk/psLib/src/image/psImage.c	(revision 2879)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-20 21:39:42 $
+ *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 #include "psError.h"
 #include "psImage.h"
+#include "psString.h"
 
 #include "psImageErrors.h"
@@ -146,4 +147,21 @@
 
     return psRegionAlloc(col0,col1,row0,row1);
+}
+
+char* psRegionToString(psRegion* region)
+{
+    char tmpText[256]; // big enough to store any region as text
+
+    if (region == NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, true,
+                PS_ERRORTEXT_psImage_REGION_NULL);
+        return NULL;
+    }
+
+    snprintf(tmpText,256,"[%g:%g,%g:%g]",
+             region->x0, region->x1,
+             region->y0, region->y1);
+
+    return psStringCopy(tmpText);
 }
 
Index: /trunk/psLib/src/image/psImage.h
===================================================================
--- /trunk/psLib/src/image/psImage.h	(revision 2878)
+++ /trunk/psLib/src/image/psImage.h	(revision 2879)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -103,10 +103,10 @@
 );
 
-/** Create an image of the specified size and type.
- *
- * Uses psLib memory allocation functions to create an image struct of the
- * specified size and type.
- *
- * @return psImage* : Pointer to psImage.
+/** Create a psRegion with the specified attributes.
+ *
+ * Uses psLib memory allocation functions to create a psRegion the
+ * specified x0, x1, y0, and y1.
+ *
+ * @return psRegion* : Pointer to psRegion.
  *
  */
@@ -118,6 +118,22 @@
 );
 
+/** Create a psRegion with the attribute values given as a string.
+ *
+ *  Create a psRegion with the attribute values given as a string.  The format
+ *  shall be of the standard IRAF form '[x0:x1,y0:y1]'
+ *
+ *  @return psRegion*:  A new psRegion struct, or NULL is not successful.
+ */
 psRegion* psRegionFromString(
     char* region                       ///< image rectangular region in the form '[x0:x1,y0:y1]'
+);
+
+/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
+ *
+ *  @return char*:  A new string representing the psRegion as text, or NULL
+ *                  is not successful.
+ */
+char* psRegionToString(
+    psRegion* region                   ///< the psRegion to convert to a string
 );
 
Index: /trunk/psLib/src/image/psImageErrors.dat
===================================================================
--- /trunk/psLib/src/image/psImageErrors.dat	(revision 2878)
+++ /trunk/psLib/src/image/psImageErrors.dat	(revision 2879)
@@ -13,4 +13,5 @@
 psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type, %s, is not supported.
 psImage_INTERPOLATE_METHOD_INVALID     Specified interpolation method (%d) is not supported.
+psImage_REGION_NULL                    Specified psRegion is NULL.  Operation could not be performed.
 psImage_SUBSET_RANGE_INVALID           Specified subset range, [%d:%d,%d:%d], is invalid or outside input psImage's boundaries, [0:%d,0:%d].
 psImage_SUBSET_RANGE_MALFORMED         Specified subset range, [%d:%d,%d:%d], is invalid.  Ranges must be incremental.
@@ -67,5 +68,5 @@
 psImageManip_OPERATION_NULL            Operation can not be NULL.
 psImageManip_OVERLAY_TYPE_MISMATCH     Input overlay psImage type, %s, must match input psImage type, %s.
-psImageManip_CLIP_VALUE_INVALID        Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].  
+psImageManip_CLIP_VALUE_INVALID        Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].
 psImageManip_OVERLAY_OPERATOR_INVALID  Specified operation, '%s', is not supported.
 psImageManip_SCALE_NOT_POSITIVE        Specified scale value, %d, must be a positive value.
@@ -76,4 +77,4 @@
 psImageConvolve_FFT_FAILED             Failed to perform a fourier transform of input image.
 psImageConvolve_KERNEL_FFT_FAILED      Failed to perform a fourier transform of kernel.
-psImageConvolve_KERNEL_TOO_LARGE       Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d. 
-psImage_COEFF_NULL                     Polynomial coefficients cannot be NULL. 
+psImageConvolve_KERNEL_TOO_LARGE       Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d.
+psImage_COEFF_NULL                     Polynomial coefficients cannot be NULL.
Index: /trunk/psLib/src/image/psImageErrors.h
===================================================================
--- /trunk/psLib/src/image/psImageErrors.h	(revision 2878)
+++ /trunk/psLib/src/image/psImageErrors.h	(revision 2879)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -35,4 +35,5 @@
 #define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type, %s, is not supported."
 #define PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID "Specified interpolation method (%d) is not supported."
+#define PS_ERRORTEXT_psImage_REGION_NULL "Specified psRegion is NULL.  Operation could not be performed."
 #define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], is invalid or outside input psImage's boundaries, [0:%d,0:%d]."
 #define PS_ERRORTEXT_psImage_SUBSET_RANGE_MALFORMED "Specified subset range, [%d:%d,%d:%d], is invalid.  Ranges must be incremental."
@@ -86,5 +87,5 @@
 #define PS_ERRORTEXT_psImageManip_OPERATION_NULL "Operation can not be NULL."
 #define PS_ERRORTEXT_psImageManip_OVERLAY_TYPE_MISMATCH "Input overlay psImage type, %s, must match input psImage type, %s."
-#define PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID "Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g].  "
+#define PS_ERRORTEXT_psImageManip_CLIP_VALUE_INVALID "Specified %s value, %g%+gi, is not the the range of input psImage's valid pixel values (%s), i.e. [%g:%g]."
 #define PS_ERRORTEXT_psImageManip_OVERLAY_OPERATOR_INVALID "Specified operation, '%s', is not supported."
 #define PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE "Specified scale value, %d, must be a positive value."
@@ -95,6 +96,6 @@
 #define PS_ERRORTEXT_psImageConvolve_FFT_FAILED "Failed to perform a fourier transform of input image."
 #define PS_ERRORTEXT_psImageConvolve_KERNEL_FFT_FAILED "Failed to perform a fourier transform of kernel."
-#define PS_ERRORTEXT_psImageConvolve_KERNEL_TOO_LARGE "Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d. "
-#define PS_ERRORTEXT_psImage_COEFF_NULL "Polynomial coefficients cannot be NULL. "
+#define PS_ERRORTEXT_psImageConvolve_KERNEL_TOO_LARGE "Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d."
+#define PS_ERRORTEXT_psImage_COEFF_NULL "Polynomial coefficients cannot be NULL."
 //~End
 
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 2878)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 2879)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-20 21:39:42 $
+ *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 #include "psError.h"
 #include "psImage.h"
+#include "psString.h"
 
 #include "psImageErrors.h"
@@ -146,4 +147,21 @@
 
     return psRegionAlloc(col0,col1,row0,row1);
+}
+
+char* psRegionToString(psRegion* region)
+{
+    char tmpText[256]; // big enough to store any region as text
+
+    if (region == NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, true,
+                PS_ERRORTEXT_psImage_REGION_NULL);
+        return NULL;
+    }
+
+    snprintf(tmpText,256,"[%g:%g,%g:%g]",
+             region->x0, region->x1,
+             region->y0, region->y1);
+
+    return psStringCopy(tmpText);
 }
 
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 2878)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 2879)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -103,10 +103,10 @@
 );
 
-/** Create an image of the specified size and type.
- *
- * Uses psLib memory allocation functions to create an image struct of the
- * specified size and type.
- *
- * @return psImage* : Pointer to psImage.
+/** Create a psRegion with the specified attributes.
+ *
+ * Uses psLib memory allocation functions to create a psRegion the
+ * specified x0, x1, y0, and y1.
+ *
+ * @return psRegion* : Pointer to psRegion.
  *
  */
@@ -118,6 +118,22 @@
 );
 
+/** Create a psRegion with the attribute values given as a string.
+ *
+ *  Create a psRegion with the attribute values given as a string.  The format
+ *  shall be of the standard IRAF form '[x0:x1,y0:y1]'
+ *
+ *  @return psRegion*:  A new psRegion struct, or NULL is not successful.
+ */
 psRegion* psRegionFromString(
     char* region                       ///< image rectangular region in the form '[x0:x1,y0:y1]'
+);
+
+/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
+ *
+ *  @return char*:  A new string representing the psRegion as text, or NULL
+ *                  is not successful.
+ */
+char* psRegionToString(
+    psRegion* region                   ///< the psRegion to convert to a string
 );
 
Index: /trunk/psLib/test/image/tst_psImage.c
===================================================================
--- /trunk/psLib/test/image/tst_psImage.c	(revision 2878)
+++ /trunk/psLib/test/image/tst_psImage.c	(revision 2879)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-04 01:05:00 $
+ *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-04 02:34:58 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,5 @@
 static psS32 testImageAlloc(void);
 static psS32 testImageCopy(void);
+static psS32 testRegion(void);
 
 testDescription tests[] = {
@@ -28,4 +29,6 @@
                               {testImageAlloc,548,"psImageFree",0,true},
                               {testImageCopy,551,"psImageCopy",0,false},
+                              {testRegion,790,"psRegionAlloc",0,false},
+                              {testRegion,791,"psRegionFromString",0,true},
                               {NULL}
                           };
@@ -394,2 +397,59 @@
 }
 
+static psS32 testRegion(void)
+{
+    int testNum = 0;
+
+
+    // Testpoint #790
+
+    psRegion* region = psRegionAlloc(1,2,3,4);
+
+    testNum++;
+    if (region == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psRegionAlloc returned a NULL pointer.");
+        return testNum;
+    }
+
+    testNum++;
+    if (region->x0 != 1 || region->x1 != 2 || region->y0 != 3 || region->y1 != 4) {
+        psError(PS_ERR_UNKNOWN, false,
+                "The region attributes are not set properly (%s)",
+                psRegionToString(region));
+        return testNum;
+    }
+
+    psFree(region);
+
+    // Testpoint #791
+
+    region = psRegionFromString("[1:2,3:4]");
+
+    testNum++;
+    if (region == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psRegionFromString returned a NULL pointer.");
+        return testNum;
+    }
+
+    testNum++;
+    if (region->x0 != 1 || region->x1 != 2 || region->y0 != 3 || region->y1 != 4) {
+        psError(PS_ERR_UNKNOWN, false,
+                "The region attributes are not set properly (%s)",
+                psRegionToString(region));
+        return testNum;
+    }
+
+    psFree(region);
+    region = psRegionFromString("[1:2,3:]");
+
+    testNum++;
+    if (region != NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psRegionFromString returned a non-NULL pointer given a malformed string.");
+        return testNum;
+    }
+
+    return 0;
+}
Index: /trunk/psLib/test/image/verified/tst_psImage.stderr
===================================================================
--- /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 2878)
+++ /trunk/psLib/test/image/verified/tst_psImage.stderr	(revision 2879)
@@ -117,2 +117,13 @@
 ---> TESTPOINT PASSED (psImage{psImageCopy} | tst_psImage.c)
 
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psImage.c                                              *
+*            TestPoint: psImage{psRegionAlloc}                                     *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+<DATE><TIME>|<HOST>|E|psRegionFromString (psImage.c:<LINENO>)
+    Specified subsection string, '[1:<LINENO>,3:]', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'.
+
+---> TESTPOINT PASSED (psImage{psRegionAlloc} | tst_psImage.c)
+
