Index: /trunk/psLib/test/astro/tst_psSphereOps.c
===================================================================
--- /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5253)
+++ /trunk/psLib/test/astro/tst_psSphereOps.c	(revision 5254)
@@ -6,6 +6,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-07 21:27:50 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-10-08 03:51:20 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -48,7 +48,7 @@
 #define ERROR_TOL   0.0001
 
-#define ALPHA_P 1.0
-#define DELTA_P 2.0
-#define PHI_P 3.0
+#define ALPHA_P 0.5 * M_PI
+#define DELTA_P 1.0 * M_PI
+#define PHI_P 1.5 * M_PI
 
 psS32 testSphereRotAlloc( void )
@@ -63,29 +63,35 @@
     }
     // Verify sin member is updated
-    //    double vx = cos(DELTA_P)*cos(ALPHA_P);
-    //    double vy = cos(DELTA_P)*sin(ALPHA_P);
-    //    double vz = sin(DELTA_P);
-    //    double q0 = vx * sin(PHI_P/2.0);
-    //    double q1 = vy * sin(PHI_P/2.0);
-    //    double q2 = vz * sin(PHI_P/2.0);
-    //    double q3 = cos(PHI_P/2.0);
-    /*
-        if (FLT_EPSILON < fabs(q0 - myST->q0)) {
-            psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q0, q0);
-            return 2;
-        }
-        if (FLT_EPSILON < fabs(q1 - myST->q1)) {
-            psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1);
-            return 3;
-        }
-        if (FLT_EPSILON < fabs(q2 - myST->q2)) {
-            psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2);
-            return 4;
-        }
-        if (FLT_EPSILON < fabs(q3 - myST->q3)) {
-            psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3);
-            return 5;
-        }
-    */
+    double vx = cos(DELTA_P)*cos(ALPHA_P);
+    double vy = cos(DELTA_P)*sin(ALPHA_P);
+    double vz = sin(DELTA_P);
+    double q0 = vx * sin(PHI_P/2.0);
+    double q1 = vy * sin(PHI_P/2.0);
+    double q2 = vz * sin(PHI_P/2.0);
+    double q3 = cos(PHI_P/2.0);
+    double len = sqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
+    printf("\nvz = %lf\n", vz);
+    q0 = q0/len;
+    q1 = q1/len;
+    q2 = q2/len;
+    q3 = q3/len;
+
+    if (FLT_EPSILON < fabs(q0 - myST->q0)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q0, q0);
+        return 2;
+    }
+    if (FLT_EPSILON < fabs(q1 - myST->q1)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1);
+        return 3;
+    }
+    if (FLT_EPSILON < fabs(q2 - myST->q2)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2);
+        return 4;
+    }
+    if (FLT_EPSILON < fabs(q3 - myST->q3)) {
+        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3);
+        return 5;
+    }
+
     // Free data structure
     psFree(myST);
@@ -103,5 +109,5 @@
         psSphere *rc = NULL;
         psSphereRot *myST = psSphereRotAlloc(0.0, 0.0, 0.0);
-     
+
         for (float r=0.0;r<180.0;r+=DEG_INC) {
             for (float d=0.0;d<90.0;d+=DEG_INC) {
@@ -110,5 +116,5 @@
                 in->rErr = 0.0;
                 in->dErr = 0.0;
-     
+
                 if(psSphereRotApply(out, myST, in) != out) {
                     psError(PS_ERR_UNKNOWN,true,"Did not return output pointer.");
@@ -125,5 +131,5 @@
             }
         }
-     
+
         // Verify new sphere object is created if out parameter NULL
         temp = psSphereRotApply(NULL, myST, in);
@@ -133,5 +139,5 @@
         }
         psFree(temp);
-     
+
         // Verify NULL returned if transform structure null
         psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
@@ -141,5 +147,5 @@
             return 5;
         }
-     
+
         // Verify NULL returned when input sphere is NULL
         psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error");
@@ -149,5 +155,5 @@
             return 6;
         }
-     
+
         psFree(myST);
         psFree(out);
@@ -180,6 +186,6 @@
         psSphereRot *mySphereRotForward = NULL;
         psSphereRot *mySphereRotReverse = NULL;
-     
-     
+
+
         mySphereRotForward = psSphereRotAlloc(DEG_TO_RAD(22.0),
                                               0.0,
@@ -188,5 +194,5 @@
                                               0.0,
                                               0.0);
-     
+
         for (float r=0.1;r<180.0;r+=(DEG_INC/5.0)) {
             for (float d=0.1;d<90.0;d+=(DEG_INC/5.0)) {
@@ -195,8 +201,8 @@
                 in.rErr = 0.0;
                 in.dErr = 0.0;
-     
+
                 psSphereRotApply(&out, mySphereRotForward, &in);
                 psSphereRotApply(&out2, mySphereRotReverse, &out);
-     
+
                 if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
                         (fabs((in.d - out2.d) / in.d) > ERROR_PERCENT)) {
@@ -210,5 +216,5 @@
         psFree(mySphereRotForward);
         psFree(mySphereRotReverse);
-     
+
         mySphereRotForward = psSphereRotAlloc(0.0,
                                               DEG_TO_RAD(33.0),
@@ -223,8 +229,8 @@
                 in.rErr = 0.0;
                 in.dErr = 0.0;
-     
+
                 psSphereRotApply(&out, mySphereRotForward, &in);
                 psSphereRotApply(&out2, mySphereRotReverse, &out);
-     
+
                 if ((fabs((in.r - out2.r) / in.r) > ERROR_PERCENT) ||
                         (fabs((in.d - out2.d) / in.d) > ERROR_PERCENT)) {
@@ -238,5 +244,5 @@
         psFree(mySphereRotForward);
         psFree(mySphereRotReverse);
-     
+
         return(testStatus);
         */
@@ -257,13 +263,13 @@
         double l[] =     { 96.337272, 122.93192, 195.639488};
         double b[] =     {-60.188553,  27.12825,  78.353806};
-     
+
         double t[] =     {  MJD_2000,  MJD_2000,   MJD_2100};
-     
+
         double TOLERANCE = 0.001;
-     
-     
-     
+
+
+
         for (int x = 0; x < numTestPoints; x++) {
-     
+
             psTime* time = psTimeFromMJD(t[x]);
             psSphereRot* toEcliptic = psSphereRotICRSToEcliptic(time);
@@ -272,14 +278,14 @@
             psSphereRot* fromGalactic = psSphereRotGalacticToICRS();
             psFree(time);
-     
+
             // set the ICRS coordinate
             psSphere* icrs = psSphereAlloc();
             icrs->r = DEG_TO_RAD(alpha[x]);
             icrs->d = DEG_TO_RAD(delta[x]);
-     
+
             // apply/unapply Ecliptic
             psSphere* ecliptic = psSphereRotApply(NULL, toEcliptic, icrs);
             psSphere* icrsFromEcliptic = psSphereRotApply(NULL, fromEcliptic, ecliptic);
-     
+
             // check ecliptic transforms for correctness
             if (abs(RAD_TO_DEG(ecliptic->r) - lambda[x]) > TOLERANCE ||
@@ -301,9 +307,9 @@
             psFree(ecliptic);
             psFree(icrsFromEcliptic);
-     
+
             // apply/unapply Galactic
             psSphere* galactic = psSphereRotApply(NULL, toGalactic, icrs);
             psSphere* icrsFromGalactic = psSphereRotApply(NULL, fromGalactic, galactic);
-     
+
             // check ecliptic transforms for correctness
             if (abs(RAD_TO_DEG(galactic->r) - l[x]) > TOLERANCE ||
@@ -325,10 +331,10 @@
             psFree(galactic);
             psFree(icrsFromGalactic);
-     
+
             psFree(toEcliptic);
             psFree(fromEcliptic);
             psFree(toGalactic);
             psFree(fromGalactic);
-     
+
         }
     */
@@ -356,5 +362,5 @@
         psTime*       fromTime    = psTimeFromMJD(MJD_2100);
         psTime*       toTime      = psTimeFromMJD(MJD_1900);
-     
+
         // Set input coordinate
         inputCoord->r = SPHERE_PRECESS_TP1_R;
@@ -362,5 +368,5 @@
         inputCoord->rErr = 0.0;
         inputCoord->dErr = 0.0;
-     
+
         // Calculate precess
         outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
@@ -382,5 +388,5 @@
         }
         psFree(outputCoord);
-     
+
         // Set input coordinate
         inputCoord->r = SPHERE_PRECESS_TP2_R;
@@ -388,5 +394,5 @@
         inputCoord->rErr = 0.0;
         inputCoord->dErr = 0.0;
-     
+
         // Calculate precess
         outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
@@ -408,5 +414,5 @@
         }
         psFree(outputCoord);
-     
+
         // Set input coordinate
         inputCoord->r = SPHERE_PRECESS_TP3_R;
@@ -414,5 +420,5 @@
         inputCoord->rErr = 0.0;
         inputCoord->dErr = 0.0;
-     
+
         // Calculate precess
         outputCoord = psSpherePrecess(inputCoord, fromTime, toTime);
@@ -434,5 +440,5 @@
         }
         psFree(outputCoord);
-     
+
         // Invoke precess with invalid parameter
         psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
@@ -442,5 +448,5 @@
             return 10;
         }
-     
+
         // Invoke precess with invalid parameter
         psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
@@ -450,5 +456,5 @@
             return 11;
         }
-     
+
         // Invoke precess with invalid parameter
         psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message");
@@ -458,5 +464,5 @@
             return 12;
         }
-     
+
         // Free objects
         psFree(fromTime);
Index: /trunk/psLib/test/imageops/tst_psImageMaskOps.c
===================================================================
--- /trunk/psLib/test/imageops/tst_psImageMaskOps.c	(revision 5253)
+++ /trunk/psLib/test/imageops/tst_psImageMaskOps.c	(revision 5254)
@@ -6,6 +6,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-06 02:41:07 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-10-08 03:51:20 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -152,5 +152,5 @@
         return 1;
     }
-    in = psImageAlloc(3, 3, PS_TYPE_MASK);
+    in = psImageAlloc(5, 5, PS_TYPE_MASK);
     //return null for incompatible image size
     test = psImageAlloc(2, 2, PS_TYPE_MASK);
@@ -161,14 +161,60 @@
         return 2;
     }
-    //return null for incompatible image type
-    test = psImageRecycle(test, 3, 3, PS_TYPE_F32);
+    //return null for incompatible out image type
+    test = psImageRecycle(test, 5, 5, PS_TYPE_F32);
     out = psImageGrowMask(test, in, maskVal, growSize, growVal);
     if (out != NULL) {
         fprintf(stderr,
-                "psImageGrowMask failed to return NULL for incompatible image type.\n");
+                "psImageGrowMask failed to return NULL for incompatible output image type.\n");
         return 3;
     }
-
-
+    //return NULL for input image that doesn't match PS_TYPE_MASK
+    in = psImageRecycle(in, 5, 5, PS_TYPE_F32);
+    out = psImageGrowMask(test, in, maskVal, growSize, growVal);
+    if (out != NULL) {
+        fprintf(stderr,
+                "psImageGrowMask failed to return NULL for incompatible input image type.\n");
+        return 4;
+    }
+    //Test for valid function (image growth)
+    in = psImageRecycle(in, 5, 5, PS_TYPE_MASK);
+    in->data.PS_TYPE_MASK_DATA[0][0] = 1;
+    in->data.PS_TYPE_MASK_DATA[0][1] = 1;
+    in->data.PS_TYPE_MASK_DATA[0][2] = 1;
+    in->data.PS_TYPE_MASK_DATA[0][3] = 1;
+    in->data.PS_TYPE_MASK_DATA[0][4] = 1;
+    in->data.PS_TYPE_MASK_DATA[1][0] = 1;
+    in->data.PS_TYPE_MASK_DATA[1][1] = 1;
+    in->data.PS_TYPE_MASK_DATA[1][2] = 2;
+    in->data.PS_TYPE_MASK_DATA[1][3] = 1;
+    in->data.PS_TYPE_MASK_DATA[1][4] = 1;
+    in->data.PS_TYPE_MASK_DATA[2][0] = 1;
+    in->data.PS_TYPE_MASK_DATA[2][1] = 1;
+    in->data.PS_TYPE_MASK_DATA[2][2] = 2;
+    in->data.PS_TYPE_MASK_DATA[2][3] = 1;
+    in->data.PS_TYPE_MASK_DATA[2][4] = 1;
+    in->data.PS_TYPE_MASK_DATA[3][0] = 1;
+    in->data.PS_TYPE_MASK_DATA[3][1] = 1;
+    in->data.PS_TYPE_MASK_DATA[3][2] = 1;
+    in->data.PS_TYPE_MASK_DATA[3][3] = 1;
+    in->data.PS_TYPE_MASK_DATA[3][4] = 2;
+    in->data.PS_TYPE_MASK_DATA[4][0] = 1;
+    in->data.PS_TYPE_MASK_DATA[4][1] = 1;
+    in->data.PS_TYPE_MASK_DATA[4][2] = 1;
+    in->data.PS_TYPE_MASK_DATA[4][3] = 1;
+    in->data.PS_TYPE_MASK_DATA[4][4] = 1;
+    maskVal = 2;
+    growSize = 1;
+    growVal = 2;
+
+    out = psImageGrowMask(out, in, maskVal, growSize, growVal);
+    //0,2 1,1 1,3 2,1 2,3 3,2 should all be 3.  All other should be unchanged.
+    for (int i = 0; i < 5; i++) {
+        printf("\n ");
+        for (int j = 0; j < 5; j++) {
+            printf("  %d,%d= %d  ", i, j, out->data.PS_TYPE_MASK_DATA[i][j]);
+        }
+    }
+    psFree(out);
     psFree(in);
     psFree(test);
Index: /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stderr
===================================================================
--- /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stderr	(revision 5253)
+++ /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stderr	(revision 5254)
@@ -24,4 +24,6 @@
 <DATE><TIME>|<HOST>|E|psImageGrowMask (FILE:LINENO)
     Invalid out image.  Type of out does not match type of in.
+<DATE><TIME>|<HOST>|E|psImageGrowMask (FILE:LINENO)
+    Invalid input image.  Input image type must match psMaskType.
 
 ---> TESTPOINT PASSED (psImage{psImageGrowMask} | tst_psImageMaskOps.c)
Index: /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stdout
===================================================================
--- /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stdout	(revision 5253)
+++ /trunk/psLib/test/imageops/verified/tst_psImageMaskOps.stdout	(revision 5254)
@@ -40,2 +40,8 @@
 in->data.u8 [i][j] i=2, j=1 = 1
 in->data.u8 [i][j] i=2, j=2 = 2
+
+   0,0= 1    0,1= 1    0,2= 3    0,3= 1    0,4= 1  
+   1,0= 1    1,1= 3    1,2= 2    1,3= 3    1,4= 1  
+   2,0= 1    2,1= 3    2,2= 2    2,3= 3    2,4= 3  
+   3,0= 1    3,1= 1    3,2= 3    3,3= 3    3,4= 2  
+   4,0= 1    4,1= 1    4,2= 1    4,3= 1    4,4= 3  
