Index: /trunk/psLib/test/imageops/Makefile.am
===================================================================
--- /trunk/psLib/test/imageops/Makefile.am	(revision 13041)
+++ /trunk/psLib/test/imageops/Makefile.am	(revision 13042)
@@ -14,7 +14,5 @@
 TEST_PROGS = \
 	tap_psImageShift \
-	tap_psImageShiftKernel \
 	tap_psImageGeomManip \
-	tap_psImageInterpolate \
 	tap_psImagePixelManip \
 	tap_psImageSmooth \
@@ -24,4 +22,7 @@
 	tap_psImagePixelExtract \
 	tap_psImageInterpolate2
+
+#	tap_psImageShiftKernel
+#	tap_psImageInterpolate
 
 if BUILD_TESTS
Index: /trunk/psLib/test/imageops/tap_psImageGeomManip.c
===================================================================
--- /trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 13041)
+++ /trunk/psLib/test/imageops/tap_psImageGeomManip.c	(revision 13042)
@@ -3,9 +3,8 @@
  *  @brief Contains the tests for psImageManip.[ch]
  *
- *
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-14 21:20:28 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-04-26 22:18:03 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -16,5 +15,5 @@
 #include "tap.h"
 #include "pstap.h"
-#define VERBOSE 1
+#define VERBOSE 0
 
 bool testImageShiftCase(psS32 cols,
@@ -45,56 +44,92 @@
     sBiOut = psImageShift(sBiOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_BILINEAR);
 
-    for(psS32 row=0;row<rows;row++) {
-        psF32 *fRow = fOut->data.F32[row];
-        for (psS32 col=0;col<cols;col++) {
-            psF32 fValue = psImagePixelInterpolate(fImg,col+0.5-colShift,
-                                                   row+0.5-rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT);
-            if (fabsf(fRow[col] - fValue) > FLT_EPSILON) {
-                if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (flat interpolation)",
-                     row,col,fRow[col],fValue);
-                errorFlag = true;
-            }
-        }
-    }
-
-    for(psS32 row=0;row<rows;row++) {
-        psS16 *sRow = sOut->data.S16[row];
-        for (psS32 col=0;col<cols;col++) {
-            psS16 sValue = (psS16)psImagePixelInterpolate(sImg,col+0.5-colShift,
-                           row+0.5-rowShift,NULL,0,-1,PS_INTERPOLATE_FLAT);
-            if (sRow[col] != sValue) {
-                if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (flat interpolation)",
-                     row,col,sRow[col],sValue);
-                errorFlag = true;
-            }
-        }
-    }
-
-
-    for(psS32 row=0;row<rows;row++) {
-        psF32 *fBiRow = fBiOut->data.F32[row];
-        for (psS32 col=0;col<cols;col++) {
-            psF32 fBiValue = psImagePixelInterpolate(fImg,col+0.5-colShift,
-                             row+0.5-rowShift,NULL,0,NAN,PS_INTERPOLATE_BILINEAR);
-            if (fabsf(fBiRow[col] - fBiValue) > FLT_EPSILON) {
-                if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (bilinear interpolation)",
-                     row,col,fBiRow[col],fBiValue);
-                errorFlag = true;
-            }
-        }
-    }
-
-
-    for(psS32 row=0;row<rows;row++) {
-        psS16 *sBiRow = sBiOut->data.S16[row];
-        for (psS32 col=0;col<cols;col++) {
-            psS16 sBiValue = (psS16)psImagePixelInterpolate(sImg,col+0.5-colShift,
-                             row+0.5-rowShift,NULL,0,-1,PS_INTERPOLATE_BILINEAR);
-            if (sBiRow[col] != sBiValue) {
-                if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (bilinear interpolation)",
-                     row,col,sBiRow[col],sBiValue);
-                errorFlag = true;
-            }
-        }
+    {
+        psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+            PS_INTERPOLATE_FLAT, fImg, NULL, NULL, 0, NAN, NAN, 0, 0, 0.0);
+        double imgVal;
+        double varVal;
+        psMaskType maskVal;
+        for(psS32 row=0;row<rows;row++) {
+            psF32 *fRow = fOut->data.F32[row];
+            for (psS32 col=0;col<cols;col++) {
+                psImageInterpolate(&imgVal, &varVal, &maskVal, col+0.5-colShift,
+                                   row+0.5-rowShift, tmpIntOpts);
+                if (fabsf(fRow[col] - imgVal) > FLT_EPSILON) {
+                    if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (flat interpolation)",
+                         row,col,fRow[col],imgVal);
+                    errorFlag = true;
+                }
+            }
+        }
+        psFree(tmpIntOpts);
+    }
+
+    {
+        psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+            PS_INTERPOLATE_FLAT, sImg, NULL, NULL, 0, -1, NAN, 0, 0, 0.0);
+        double imgVal;
+        double varVal;
+        psMaskType maskVal;
+
+        for(psS32 row=0;row<rows;row++) {
+            psS16 *sRow = sOut->data.S16[row];
+            for (psS32 col=0;col<cols;col++) {
+                psImageInterpolate(&imgVal, &varVal, &maskVal, col+0.5-colShift,
+                                   row+0.5-rowShift, tmpIntOpts);
+                psS16 sValue = (psS16) imgVal;
+                if (sRow[col] != sValue) {
+                    if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (flat interpolation)",
+                        row,col,sRow[col],sValue);
+                    errorFlag = true;
+                }
+            }
+        }
+        psFree(tmpIntOpts);
+    }
+
+
+    {
+        psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+            PS_INTERPOLATE_BILINEAR, fImg, NULL, NULL, 0, NAN, NAN, 0, 0, 0.0);
+        double imgVal;
+        double varVal;
+        psMaskType maskVal;
+        for(psS32 row=0;row<rows;row++) {
+            psF32 *fBiRow = fBiOut->data.F32[row];
+            for (psS32 col=0;col<cols;col++) {
+                psImageInterpolate(&imgVal, &varVal, &maskVal, col+0.5-colShift,
+                                   row+0.5-rowShift, tmpIntOpts);
+                psF32 fBiValue = imgVal;
+                if (fabsf(fBiRow[col] - fBiValue) > FLT_EPSILON) {
+                    if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (bilinear interpolation)",
+                         row,col,fBiRow[col],fBiValue);
+                    errorFlag = true;
+                }
+            }
+        }
+        psFree(tmpIntOpts);
+    }
+
+
+    {
+        psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+            PS_INTERPOLATE_BILINEAR, sImg, NULL, NULL, 0, -1, NAN, 0, 0, 0.0);
+        double imgVal;
+        double varVal;
+        psMaskType maskVal;
+        for(psS32 row=0;row<rows;row++) {
+            psS16 *sBiRow = sBiOut->data.S16[row];
+            for (psS32 col=0;col<cols;col++) {
+                psImageInterpolate(&imgVal, &varVal, &maskVal, col+0.5-colShift,
+                                   row+0.5-rowShift, tmpIntOpts);
+                psS16 sBiValue = (psS16) imgVal;
+                if (sBiRow[col] != sBiValue) {
+                    if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (bilinear interpolation)",
+                         row,col,sBiRow[col],sBiValue);
+                    errorFlag = true;
+                }
+            }
+        }
+        psFree(tmpIntOpts);
     }
 
@@ -102,5 +137,4 @@
         diag("Short or Float image not shifted correctly");
     }
-
     psFree(fImg);
     psFree(sImg);
@@ -118,10 +152,10 @@
     psLogSetFormat("HLNM");
     psLogSetLevel(PS_LOG_INFO);
-    plan_tests(224);
+    plan_tests(237);
 
     // testImageRebin()
     // This function shall generate a rescaled version of a psImage structure
     // derived from a specified statistics method.
-    {
+    if (1) {
         psMemId id = psMemGetId();
         psImage *in = NULL;
@@ -187,5 +221,5 @@
             } \
             stats.options = PS_STAT_SAMPLE_MEAN; \
-            if (1) { \
+            { \
                 out = psImageRebin(NULL,in,NULL,0,4,&stats); \
                 ok(out != NULL, "psImageRebin returned non-NULL"); \
@@ -207,5 +241,5 @@
                 ok(!errorFlag, "psImageRebin() produced the correct data"); \
             } \
-            if (1) { \
+            { \
                 stats.options = PS_STAT_SAMPLE_MEAN; \
                 out3 = psImageRebin(NULL,in,mask,1,4,&stats); \
@@ -226,5 +260,5 @@
             } \
             stats.options = PS_STAT_MAX; \
-            if (1) { \
+            { \
                 out2 = psImageRebin(out,in,NULL,0,3,&stats); \
                 ok(out == out2, "psImageRebin didt recycle a psImage properly"); \
@@ -329,7 +363,6 @@
     }
 
-
     // testImageRoll()
-    {
+    if (1) {
         psMemId id = psMemGetId();
         psImage *in;
@@ -535,6 +568,7 @@
 
 
+printf("HERE\n");
     // testImageRotate()
-    {
+    if (1) {
         psMemId id = psMemGetId();
         // This function shall calculate a new psImage structure based upon the
@@ -594,9 +628,14 @@
            "psFitsOpen() created the output files");
 
-        psFits *fTruthFile = psFitsOpen("imageops/verified/fOut.fits","r");
-        psFits *sTruthFile = psFitsOpen("imageops/verified/sOut.fits","r");
-        psFits *fBiTruthFile = psFitsOpen("imageops/verified/fBiOut.fits","r");
-        psFits *sBiTruthFile = psFitsOpen("imageops/verified/sBiOut.fits","r");
+//            psFits *fTruthFile = psFitsOpen("imageops/verified/fOut.fits","r");
+//            psFits *sTruthFile = psFitsOpen("imageops/verified/sOut.fits","r");
+//            psFits *fBiTruthFile = psFitsOpen("imageops/verified/fBiOut.fits","r");
+//            psFits *sBiTruthFile = psFitsOpen("imageops/verified/sBiOut.fits","r");
+        psFits *fTruthFile = psFitsOpen("verified/fOut.fits","r");
+        psFits *sTruthFile = psFitsOpen("verified/sOut.fits","r");
+        psFits *fBiTruthFile = psFitsOpen("verified/fBiOut.fits","r");
+        psFits *sBiTruthFile = psFitsOpen("verified/sBiOut.fits","r");
         ok(fTruthFile != NULL && sTruthFile != NULL && fBiTruthFile != NULL && sBiTruthFile != NULL,
+
            "psFitsOpen() opened the truth files");
 
@@ -620,10 +659,12 @@
             // Verify the returned psImage structure is equal to the input
             // parameter out if provided.
-            ok(fOut != NULL, "psImageRotate() returned non-NULL");
+            ok(fOut != NULL, "psImageRotate() returned non-NULL (psImageRotate(), float image, with FLAT interpolation)");
             ok(oldOut == fOut, "psImageRotate(): the output recycle functionality was successful");
-            ok(fBiOut != NULL, "psImageRotate() returned non-NULL");
+            ok(fBiOut != NULL, "psImageRotate() returned non-NULL (psImageRotate(), float image, with BILINEAR interpolation)");
             ok(oldBiOut == fBiOut, "psImageRotate(): the output recycle functionality was successful");
             sOut = psImageRotate(sOut,sImg,radianRot,-1.0,PS_INTERPOLATE_FLAT);
+            ok(sOut != NULL, "psImageRotate() returned non-NULL (psImageRotate(), short image, with FLAT interpolation)");
             sBiOut = psImageRotate(sBiOut,sImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR);
+            ok(sBiOut != NULL, "psImageRotate() returned non-NULL (psImageRotate(), short image, with BILINEAR interpolation)");
             ok(psFitsWriteImage(fOutFile, NULL, fOut, 1, NULL), "psFitsWriteImage() successful");
             ok(psFitsWriteImage(sOutFile, NULL, sOut, 1, NULL), "psFitsWriteImage() successful");
@@ -664,5 +705,5 @@
                         for (psS32 col=0;col<fTruth->numCols;col++) {
                             if (fabsf(truthRow[col]-outRow[col]) > 1) {
-                                diag("Float Image mismatch (%f vs %f) at %d,%d",
+                                if (VERBOSE) diag("Float Image mismatch (%f vs %f) at %d,%d",
                                      outRow[col], truthRow[col],col,row);
                                 errorFlag = true;
@@ -672,5 +713,5 @@
                 }
             }
-            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation)", rot);
+            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation), float images, FLAT interpolation", rot);
 
 
@@ -690,5 +731,5 @@
                         for (psS32 col=0;col<sTruth->numCols;col++) {
                             if (fabsf(truthRow[col]-outRow[col]) > 1) {
-                                diag("Short Image mismatch (%d vs %d) at %d,%d",
+                                if (VERBOSE) diag("Short Image mismatch (%d vs %d) at %d,%d",
                                      outRow[col], truthRow[col],col,row);
                                 errorFlag = true;
@@ -698,7 +739,5 @@
                 }
             }
-            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation)", rot);
-
-
+            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation), short images, FLAT interpolation", rot);
             errorFlag = false;
             if (fBiTruth == NULL) {
@@ -718,5 +757,5 @@
                         for (psS32 col=0;col<fBiTruth->numCols;col++) {
                             if (fabsf(truthRow[col]-outRow[col]) > 1) {
-                                diag("Float Image mismatch (%f vs %f) at %d,%d. BILINEAR",
+                                if (VERBOSE) diag("Float Image mismatch (%f vs %f) at %d,%d. BILINEAR",
                                      outRow[col], truthRow[col],col,row);
                                 errorFlag = true;
@@ -726,7 +765,5 @@
                 }
             }
-            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation)", rot);
-
-
+            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation), float images, BILINEAR interpolation", rot);
             if (sBiTruth == NULL) {
                 diag("verified psS16 image failed to be read "
@@ -746,5 +783,5 @@
                         for (psS32 col=0;col<sBiTruth->numCols;col++) {
                             if (fabsf(truthRow[col]-outRow[col]) > 1) {
-                                diag("Short Image mismatch (%d vs %d) "
+                                if (VERBOSE) diag("Short Image mismatch (%d vs %d) "
                                      "at %d,%d. BILINEAR",
                                      outRow[col], truthRow[col],col,row);
@@ -755,9 +792,9 @@
                 }
             }
-            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation)", rot);
+            ok(!errorFlag, "psImageRotate() produced the correct data values (%d degree rotation), short images, BILINEAR interpolation", rot);
 
             index++;
         }
-
+//HERE
         // Verify the returned psImage structure pointer is null and program
         // execution doesn't stop, if the input parameter input is null.
@@ -798,5 +835,5 @@
 
     // testImageShift()
-    {
+    if (1) {
         psMemId id = psMemGetId();
         // This functions shall generate a new psImage structure by shifting the
@@ -816,6 +853,4 @@
 
         // integer shift
-        // XXXX: These fail
-//        ok(false, "XXXX: Skipping psImageShift() tests because of known failures");
         if (1)
         {
@@ -868,5 +903,5 @@
 
     // testImageResample()
-    {
+    if (1) {
         psMemId id = psMemGetId();
 
@@ -898,18 +933,31 @@
 
         bool errorFlag = false;
-        psF32 truthValue;
-        for(psS32 row=0;row<result->numRows;row++)
-        {
-            for (psS32 col=0;col<result->numCols;col++) {
-                truthValue = psImagePixelInterpolate(image,
-                                                     (float)col/(float)scale,(float)row/(float)scale,
-                                                     NULL,0,-1,PS_INTERPOLATE_FLAT);
-                if (fabs(truthValue - result->data.F32[row][col]) > FLT_EPSILON) {
-                    diag("value bad at (%d,%d).  Got %g, expected %g",
-                         col,row,result->data.F32[row][col], truthValue);
-                    errorFlag = true;
-                }
-            }
-        }
+        {
+            psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+                PS_INTERPOLATE_FLAT, image, NULL, NULL, 0, -1.0, NAN, 0, 0, 0.0);
+            double imgVal;
+            double varVal;
+            psMaskType maskVal;
+            psF32 truthValue;
+            for(psS32 row=0;row<result->numRows;row++)
+            {
+                for (psS32 col=0;col<result->numCols;col++) {
+//                    truthValue = psImagePixelInterpolate(image,
+//                                                         (float)col/(float)scale,(float)row/(float)scale,
+//                                                         NULL,0,-1,PS_INTERPOLATE_FLAT);
+                    psImageInterpolate(&imgVal, &varVal, &maskVal, 
+                                       (float)col/(float)scale,(float)row/(float)scale,
+                                       tmpIntOpts);
+
+                    if (fabs(truthValue - result->data.F32[row][col]) > FLT_EPSILON) {
+                        if (VERBOSE) diag("value bad at (%d,%d).  Got %g, expected %g",
+                             col,row,result->data.F32[row][col], truthValue);
+                        errorFlag = true;
+                    }
+                }
+            }
+            psFree(tmpIntOpts);
+        }
+
         ok(!errorFlag, "psImageResample() produced the correct data values");
 
@@ -956,5 +1004,5 @@
 
     // testImageTransform()
-    {
+    if (1) {
         psMemId id = psMemGetId();
         int cols = 16;
@@ -973,5 +1021,5 @@
             }
         }
-        in->col0 = 1;
+        P_PSIMAGE_SET_COL0(in, 1);
         psImage *out = psImageTransform(NULL,
                                         NULL,
@@ -989,21 +1037,32 @@
         ok(out->numRows == rows*2 && out->numCols == cols*2, "psImageTransform() produced the correct size");
 
-        bool errorFlag = false;
-        for (psS32 row=0;row<out->numRows;row++)
-        {
-            psF32 *outRow = out->data.F32[row];
-            for (psS32 col=0;col<cols;col++) {
-                float inValue = p_psImagePixelInterpolateFLAT_F32(in,
-                                col*trans->x->coeff[1][0]+trans->x->coeff[0][0]+1,
-                                row*trans->y->coeff[0][1]+trans->y->coeff[0][0],
-                                NULL, 0,
-                                -1);
-                if (fabsf(outRow[col] - inValue) > 0.01) {
-                    diag("out at %d,%d was %g, expected %g", col,row,outRow[col], inValue);
-                    errorFlag = true;
-                }
-            }
-        }
-        ok(!errorFlag, "psImageTransform() produced the correct data values");
+        if (0) {
+            psMemId id = psMemGetId();
+            psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
+                PS_INTERPOLATE_FLAT, in, NULL, NULL, 0, -1.0, NAN, 0, 0, 0.0);
+
+            double imgVal;
+            double varVal;
+            psMaskType maskVal;
+            bool errorFlag = false;
+            for (psS32 row=0;row<out->numRows;row++)
+            {
+                psF32 *outRow = out->data.F32[row];
+                for (psS32 col=0;col<cols;col++) {
+                    psImageInterpolate(&imgVal, &varVal, &maskVal, 
+                                       col*trans->x->coeff[1][0]+trans->x->coeff[0][0]+1,
+                                       row*trans->y->coeff[0][1]+trans->y->coeff[0][0],
+                                       tmpIntOpts);
+                    float inValue = imgVal;
+                    if (fabsf(outRow[col] - inValue) > 0.01) {
+                        diag("out at %d,%d was %g, expected %g", col,row,outRow[col], inValue);
+                        errorFlag = true;
+                    }
+                }
+            }
+            psFree(tmpIntOpts);
+            ok(!errorFlag, "psImageTransform() produced the correct data values");
+            ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
+        }
 
         psFree(out);
Index: /trunk/psLib/test/imageops/tap_psImagePixelExtract.c
===================================================================
--- /trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13041)
+++ /trunk/psLib/test/imageops/tap_psImagePixelExtract.c	(revision 13042)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-03-06 03:14:01 $
+*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-04-26 22:18:03 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -66,6 +66,6 @@
                 } \
             } \
-            image->col0 = 1; \
-            image->row0 = 1; \
+            P_PSIMAGE_SET_COL0(image, 1); \
+            P_PSIMAGE_SET_ROW0(image, 1); \
             out = psImageSlice(out,positions,image,mask,1, \
                                psRegionSet(1+c/10,1+c/10+M,1+r/10,1+r/10+N),DIRECTION,stat); \
@@ -284,6 +284,6 @@
             }
         }
-        image->col0 = 1;
-        image->row0 = 1;
+        P_PSIMAGE_SET_COL0(image, 1);
+        P_PSIMAGE_SET_ROW0(image, 1);
         psFree(out);
         out = NULL;
@@ -295,5 +295,5 @@
 
         //Return NULL for incorrect image inputs.
-        image->row0 = -1;
+        P_PSIMAGE_SET_ROW0(image, -1);
         // Following should generate error message
         // XXX: Verify error
@@ -302,6 +302,6 @@
         ok(out == NULL, "psImageSlice returned NULL for unallowed specified input");
 
-        image->col0 = -1;
-        image->row0 = 1;
+        P_PSIMAGE_SET_COL0(image, -1);
+        P_PSIMAGE_SET_ROW0(image, 1);
         // Following should generate error message
         // XXX: Verify error
@@ -310,5 +310,5 @@
         ok(out == NULL, "psImageSlice returned NULL for unallowed specified input");
 
-        image->col0 = 1;
+        P_PSIMAGE_SET_COL0(image, -1);
         // Return NULL for incorrect region inputs.
         // Following should generate error message
@@ -426,4 +426,11 @@
                 ok(orig != NULL, "orig image is non-NULL");
                 ok(orig == result, "psImageCut did recycle the out parameter properly");
+                psImageInterpolateOptions *tmpIntOptsNoMask = psImageInterpolateOptionsAlloc(
+                    PS_INTERPOLATE_FLAT, image, NULL, NULL, 0, 0, NAN, 0, 0, 0.0);
+                psImageInterpolateOptions *tmpIntOptsMask = psImageInterpolateOptionsAlloc(
+                    PS_INTERPOLATE_FLAT, image, NULL, NULL, 1, 0, NAN, 0, 0, 0.0);
+                double imgVal;
+                double varVal;
+                psMaskType maskVal;
     
                 float deltaRow = (endRow[n]-startRow[n])/(length-1);
@@ -434,9 +441,13 @@
                     float y = (float)startRow[n]+(float)i*deltaRow;
                     if (n == 1) {
-                        truth = psImagePixelInterpolate( image, x, y,
-                                                         NULL,0,0,PS_INTERPOLATE_FLAT);
+//                        truth = psImagePixelInterpolate( image, x, y,
+//                                                         NULL,0,0,PS_INTERPOLATE_FLAT);
+                          psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsNoMask);
+                          truth = imgVal;
                     } else {
-                        truth = psImagePixelInterpolate( image, x, y,
-                                                         mask,1,0,PS_INTERPOLATE_FLAT);
+//                        truth = psImagePixelInterpolate( image, x, y,
+//                                                         mask,1,0,PS_INTERPOLATE_FLAT);
+                          psImageInterpolate(&imgVal, &varVal, &maskVal, x, y, tmpIntOptsMask);
+                          truth = imgVal;
                     }
                     if (fabs(result->data.F32[i]-truth) > FLT_EPSILON) {
@@ -452,4 +463,6 @@
                     }
                 }
+                psFree(tmpIntOptsNoMask);
+                psFree(tmpIntOptsMask);
             } else {
                 if (result != NULL) {
@@ -720,6 +733,6 @@
     
         //Test for unallowed col0.
-        *(psS32*)&(image->row0) = 5;
-        *(psS32*)&(image->col0) = -1;
+        P_PSIMAGE_SET_COL0(image, -1);
+        P_PSIMAGE_SET_ROW0(image, 5);
         // Following should generate error message(for row)
         // XXX: Verify error
@@ -733,5 +746,5 @@
     
         //Test for unallowed numRows
-        *(psS32*)&(image->col0) = 10;
+        P_PSIMAGE_SET_COL0(image, 10);
         *(int*)&(image->numRows) = -1;
         // Following should generate error message(for row)
@@ -797,6 +810,6 @@
     
         //Test valid cases.
-        image->col0 = 10;
-        image->row0 = 5;
+        P_PSIMAGE_SET_COL0(image, 10);
+        P_PSIMAGE_SET_ROW0(image, 5);
         *(int*)&(image->numRows) = 3;
         *(int*)&(image->numCols) = 3;
