Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 4885)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 4886)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-18 21:44:40 $
+ *  @version $Revision: 1.76 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-26 03:35:02 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -209,4 +209,5 @@
     psF32 vF32;
     psF64 vF64;
+    int temp;
 
     if (image == NULL)
@@ -217,6 +218,9 @@
     switch (image->type.type) {
     case PS_TYPE_U8:
-        vU8 = va_arg (argp, psU32);
-
+        temp = va_arg (argp, psU32);
+        if ( temp >= 0 || temp <= 255 )
+            vU8 = temp;
+        else
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U8 Value out of Range.\n");
         for (int iy = 0; iy < image->numRows; iy++) {
             for (int ix = 0; ix < image->numCols; ix++) {
@@ -224,5 +228,5 @@
             }
         }
-        break;
+        return (true);
 
     case PS_TYPE_F32:
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 4885)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 4886)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-08-18 21:44:40 $
+ *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-26 03:35:02 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/test/mathtypes/tst_psImage.c
===================================================================
--- /trunk/psLib/test/mathtypes/tst_psImage.c	(revision 4885)
+++ /trunk/psLib/test/mathtypes/tst_psImage.c	(revision 4886)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-13 02:47:00 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-08-26 03:35:03 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -23,4 +23,7 @@
 static psS32 testImageAlloc(void);
 static psS32 testRegion(void);
+static psS32 testRegion2(void);
+static psS32 testRegion3(void);
+static psS32 testImageInit(void);
 
 testDescription tests[] = {
@@ -29,4 +32,7 @@
                               {testRegion,790,"psRegionSet",0,false},
                               {testRegion,791,"psRegionFromString",0,true},
+                              {testRegion2,792,"psRegionForImage",0,false},
+                              {testRegion3,793,"psRegionForSquare",0,false},
+                              {testImageInit,794,"psImageInit",0,false},
                               {NULL}
                           };
@@ -275,2 +281,73 @@
     return 0;
 }
+
+//psRegionForImage//
+static psS32 testRegion2(void)
+{
+    psImage *in = NULL;
+    psRegion *inReg;
+    psRegion out;
+    in = psImageAlloc(1, 1, PS_TYPE_S32);
+    *inReg = psRegionSet(1, 2, 1, 2);
+    out = psRegionForImage(in, inReg);
+    psRegion *inReg2;
+    psRegion out2;
+    *inReg2 = psRegionSet(-1, 0, -2, -1);
+    out2 = psRegionForImage(in, inReg2);
+    if( out.x0 != 1 || out.x1 != 1 || out.y0 != 1 || out.y1 != 1 ) {
+        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Image returned incorrect values.\n");
+    }
+    if( out2.x0 != 0 || out2.x1 != 1 || out2.y0 != 0 || out2.y1 != 0 ) {
+        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Image returned incorrect values.\n");
+    }
+    psFree(in);
+    return 0;
+}
+
+//psRegionForSquare//
+static psS32 testRegion3(void)
+{
+    float X = 1;
+    float Y = 1;
+    float RAD = 1;
+    psRegion out;
+    out = psRegionForSquare(X, Y, RAD);
+    if (out.x0 != 0 || out.x1 != 3 || out.y0 != 0 || out.y1!= 3)
+        psError(PS_ERR_UNKNOWN, true, "Error:  Region For Square returned incorrect values.\n");
+    return 0;
+}
+
+//Initialize an image with a given value.//
+static psS32 testImageInit(void)
+{
+    psImage *in1 = NULL;
+    psImage *in2 = NULL;
+    psImage *in3 = NULL;
+    psImage *in4 = NULL;
+    int nRow = 1;
+    int nCol = 1;
+    in1 = psImageAlloc(nRow, nCol, PS_TYPE_U8);
+    if ( !psImageInit(in1, 1 ) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  U8 Case - 1x1\n");
+    }
+    nRow = 5;
+    in2 = psImageAlloc(nRow, nCol, PS_TYPE_F32);
+    if ( !psImageInit(in2, 3) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  F32 Case - 5x1\n");
+    }
+    nCol = 5;
+    in3 = psImageAlloc(nRow, nCol, PS_TYPE_F64);
+    if ( !psImageInit(in3, 3.141) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  F64 Case - 5x5\n");
+    }
+    in4 = psImageAlloc(nRow, nCol, PS_TYPE_S32);
+    if ( !psImageInit(in4, 3) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  S32 Case - 5x5\n");
+    }
+    psFree(in1);
+    psFree(in2);
+    psFree(in3);
+    psFree(in4);
+    return 0;
+}
+
Index: /trunk/psLib/test/mathtypes/verified/tst_psImage.stderr
===================================================================
--- /trunk/psLib/test/mathtypes/verified/tst_psImage.stderr	(revision 4885)
+++ /trunk/psLib/test/mathtypes/verified/tst_psImage.stderr	(revision 4886)
@@ -97,2 +97,33 @@
 ---> TESTPOINT PASSED (psImage{psRegionSet} | tst_psImage.c)
 
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psImage.c                                              *
+*            TestPoint: psImage{psRegionForImage}                                  *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psImage{psRegionForImage} | tst_psImage.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psImage.c                                              *
+*            TestPoint: psImage{psRegionForSquare}                                 *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psImage{psRegionForSquare} | tst_psImage.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psImage.c                                              *
+*            TestPoint: psImage{psImageInit}                                       *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+<DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO)
+    datatype 260 not defined in psImageInit
+<DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO)
+    ImageInit failed.  S32 Case - 5x5
+
+---> TESTPOINT PASSED (psImage{psImageInit} | tst_psImage.c)
+
