Index: trunk/psLib/test/image/tst_psImage.c
===================================================================
--- trunk/psLib/test/image/tst_psImage.c	(revision 1193)
+++ trunk/psLib/test/image/tst_psImage.c	(revision 1212)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 01:05:01 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-13 01:37:58 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -24,7 +24,4 @@
 static int testImageSubset(void);
 static int testImageCopy(void);
-static int testImageClip(void);
-static int testImageClipNAN(void);
-static int testImageOverlay(void);
 
 testDescription tests[] = {
@@ -34,7 +31,4 @@
                               {testImageSubset,550,"psImageSubset",0,true},
                               {testImageCopy,551,"psImageCopy",0,false},
-                              {testImageClip,571,"psImageClip",0,false},
-                              {testImageClipNAN,572,"psImageClipNAN",0,false},
-                              {testImageOverlay,573,"psImageOverlay",0,false},
                               {NULL}
                           };
@@ -623,418 +617,2 @@
 }
 
-int testImageClip(void)
-{
-    psImage* img = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
-    psF32 min;
-    psF32 max;
-    int numClipped = 0;
-    int retVal;
-
-    psLogMsg(__func__,PS_LOG_INFO,
-             "psImageClip shall limit the minimum and maximum data value within a psImage structure");
-
-    /*
-
-        psImageClip shall limit the minimum and maximum data value within a
-        psImage structure to a specified min and max value.
-
-        Verify the returned integer is equal to the number of pixels clipped,
-        if the input psImage structure contains known values and input parameters
-        min and max have know values.
-
-        Verify the psImage structure specified by the input parameter input is
-        modified to contain the expected values, if the input psImage structure
-        contains known values, min and max are specified and vmin and vmax
-        parameters are known.
-
-        Verify the retuned integer is zero, psImage structure input is unmodified
-        and program executions doesn't stop, if input parameter psImage structure
-        pointer is null.
-
-        Verify the retuned integer is zero, psImage structure input is unmodified
-        and program executions doesn't stop, if input parameter min is larger than max.
-    */
-
-    // create image
-    #define testImageClipByType(datatype) \
-    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned int row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
-            imgRow[col] = (ps##datatype)(row+col); \
-        } \
-    } \
-    min = (float)r/2.0f; \
-    max = (float)r; \
-    \
-    retVal = psImageClip(img,min,-1.0f,max,-2.0f); \
-    \
-    numClipped = 0; \
-    for (unsigned int row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
-            ps##datatype value = (ps##datatype)(row+col); \
-            if (value < (ps##datatype)min) { \
-                numClipped++; \
-                value = -1; \
-            } else if (value > (ps##datatype)max) { \
-                numClipped++; \
-                value = -2; \
-            } \
-            if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \
-                psError(__func__,"Pixel value is not as expected (%d vs %d) at %u,%u", \
-                        imgRow[col],value,col,row); \
-                return 1; \
-            } \
-        } \
-    } \
-    if (retVal != numClipped) { \
-        psError(__func__,"Expected %d clips, but got %d", \
-                numClipped,retVal); \
-        return 2; \
-    } \
-    psFree(img);
-
-    #define testImageClipByComplexType(datatype) \
-    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned int row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
-            imgRow[col] = (ps##datatype)(row+I*col); \
-        } \
-    } \
-    min = (float)r/2.0f; \
-    max = (float)r; \
-    \
-    retVal = psImageClip(img,min,-1.0f,max,-2.0f); \
-    \
-    numClipped = 0; \
-    for (unsigned int row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
-            ps##datatype value = row+I*col; \
-            if (cabs(value) < min) { \
-                numClipped++; \
-                value = -1.0f; \
-            } else if (cabs(value) > max) { \
-                numClipped++; \
-                value = -2.0f; \
-            } \
-            if (fabsf(creal(imgRow[col])-creal(value)) > FLT_EPSILON || \
-                    fabsf(cimag(imgRow[col])-cimag(value)) > FLT_EPSILON) { \
-                psError(__func__,"Pixel value is not as expected (%.2f+%.2fi vs %.2f+%.2fi) at %u,%u", \
-                        creal(imgRow[col]),cimag(imgRow[col]),creal(value),cimag(value),col,row); \
-                return 1; \
-            } \
-        } \
-    } \
-    if (retVal != numClipped) { \
-        psError(__func__,"Expected %d clips, but got %d", \
-                numClipped,retVal); \
-        return 2; \
-    } \
-    psFree(img);
-
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
-    testImageClipByType(F64);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F32 imagery");
-    testImageClipByType(F32);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S32 imagery");
-    testImageClipByType(S32);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S16 imagery");
-    testImageClipByType(S16);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of S8 imagery");
-    testImageClipByType(S8);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U32 imagery");
-    testImageClipByType(U32);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U16 imagery");
-    testImageClipByType(U16);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of U8 imagery");
-    testImageClipByType(U8);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C32 imagery");
-    testImageClipByComplexType(C32);
-    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of C64 imagery");
-    testImageClipByComplexType(C64);
-
-    // Verify the retuned integer is zero, psImage structure input is unmodified
-    // and program executions doesn't stop, if input parameter psImage structure
-    // pointer is null.
-    retVal = psImageClip(NULL,min,-1.0f,max,-2.0f);
-    if (retVal != 0) {
-        psError(__func__,"Expected zero return for clips of a NULL image.");
-        return 3;
-    }
-
-    // Verify the retuned integer is zero, psImage structure input is unmodified
-    // and program executions doesn't stop, if input parameter min is larger than max.
-    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error (max<min)");
-    retVal = psImageClip(img,max,-1.0f,min,-2.0f);
-    if (retVal != 0) {
-        psError(__func__,"Expected zero return for clips when max < min.");
-        return 4;
-    }
-
-    return 0;
-}
-
-int testImageClipNAN(void)
-{
-    psImage* img = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
-    int numClipped = 0;
-    int retVal;
-
-    psLogMsg(__func__,PS_LOG_INFO,
-             "psImageClipNaN shall modified pixel values of NaN with a specified value");
-
-    /*
-        psImageClipNaN shall modify a psImage structure with pixel values set
-        to NaN to a value specified as an input parameter.
-
-        Verify the returned integer is equal to the number of pixels modified
-        and the psImage is modified at locations where NaN pixels where
-        located to the value specified in the input parameter value.
-
-        Verify the returned integer is zero and program execution doesn't stop,
-        if the input parameter psImage structure pointer is null.
-    */
-
-    // create image
-    #define testImageClipNaNByType(datatype) \
-    img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned col=0;col<c;col++) { \
-            if (row == col) { \
-                imgRow[col] = NAN; \
-            } else if (row+1 == col) { \
-                imgRow[col] = INFINITY; \
-            } else { \
-                imgRow[col] = (ps##datatype)(row+col); \
-            } \
-        } \
-    } \
-    \
-    retVal = psImageClipNaN(img,-1.0f); \
-    \
-    numClipped = 0; \
-    for (unsigned row=0;row<r;row++) { \
-        ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned col=0;col<c;col++) { \
-            ps##datatype value = (ps##datatype)(row+col); \
-            if ( (row == col) || (row+1 == col) ) { \
-                numClipped++; \
-                value = -1.0; \
-            } \
-            if (fabsf(imgRow[col]-value) > FLT_EPSILON) { \
-                psError(__func__,"Pixel value is not as expected (%f vs %f) at %d,%d", \
-                        imgRow[col],value,col,row); \
-                return 1; \
-            } \
-        } \
-    } \
-    if (retVal != numClipped) { \
-        psError(__func__,"Expected %d clips, but got %d", \
-                numClipped,retVal); \
-        return 2; \
-    } \
-    psFree(img);
-
-    testImageClipNaNByType(F32);
-    testImageClipNaNByType(F64);
-
-    // Verify the retuned integer is zero, psImage structure input is unmodified
-    // and program executions doesn't stop, if input parameter psImage structure
-    // pointer is null.
-    retVal = psImageClipNaN(NULL,-1.0f);
-    if (retVal != 0) {
-        psError(__func__,"Expected zero return for clips of a NULL image.");
-        return 3;
-    }
-
-    return 0;
-}
-
-int testImageOverlay(void)
-{
-
-    psImage* img = NULL;
-    psImage* img2 = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
-    int retVal;
-
-    /*
-    psImageSectionOverlay shall modified pixel values in a psImage structure to
-    be equal to the value of the originaldata and an overlay image with a
-    specified operation. Valid operations include =, +, -, *, /.
-
-    Verify the returned integer is zero
-    and the input parameter psImage structure is modified at the specified
-    location and range with the given overlay image and the specified
-    function. Cases should include all the valid operations. Comparison of
-    expected values should include a delta to allow for testing on
-    different platforms.
-
-    */
-
-
-
-    #define testOverlayTypeOP(DATATYPE,OP,OPSTRING) \
-    img = psImageAlloc(c,r,PS_TYPE_##DATATYPE); \
-    for (unsigned row=0;row<r;row++) { \
-        ps##DATATYPE* imgRow = img->data.DATATYPE[row]; \
-        for (unsigned col=0;col<c;col++) { \
-            imgRow[col] = 6.0; \
-        } \
-    } \
-    img2 = psImageAlloc(c/2,r/2,PS_TYPE_##DATATYPE); \
-    for (unsigned row=0;row<r/2;row++) { \
-        ps##DATATYPE* img2Row = img2->data.DATATYPE[row]; \
-        for (unsigned col=0;col<c/2;col++) { \
-            img2Row[col] = 2.0; \
-        } \
-    } \
-    retVal = psImageOverlaySection(img,img2,c/4,r/4,OPSTRING); \
-    if (retVal != 0) { \
-        psError(__func__,"psImageOverlaySection returned non-zero %s op",OPSTRING); \
-        return 1; \
-    } \
-    for (unsigned row=0;row<r;row++) { \
-        ps##DATATYPE* imgRow = img->data.DATATYPE[row]; \
-        ps##DATATYPE* img2Row = img2->data.DATATYPE[row]; \
-        for (unsigned col=0;col<c;col++) { \
-            ps##DATATYPE val = 6.0; \
-            if ( ! (row < r/4 || row >= r/2+r/4 || col < c/4 || col >= c/2+c/4)) { \
-                val OP 2.0; \
-            } \
-            if (fabsf(imgRow[col] - val) > FLT_EPSILON) { \
-                psError(__func__,"Value incorrect at %d,%d (%.2f vs %.2f for %s)", \
-                        col,row,imgRow[col],val,OPSTRING); \
-                return 2; \
-            } \
-            if (row < r/2 && col < c/2 && fabsf(img2Row[col] - 2.0) > FLT_EPSILON) { \
-                psError(__func__,"Overlay modified at %d,%d (%.2f for %s)", \
-                        col,row,img2Row[col],OPSTRING); \
-                return 2; \
-            } \
-        } \
-    } \
-    psFree(img); \
-    psFree(img2);
-
-    #define testOverlayType(DATATYPE) \
-    testOverlayTypeOP(DATATYPE,+=,"+"); \
-    testOverlayTypeOP(DATATYPE,-=,"-"); \
-    testOverlayTypeOP(DATATYPE,*=,"*");\
-    testOverlayTypeOP(DATATYPE,/=,"/");\
-    testOverlayTypeOP(DATATYPE,=,"=");
-
-    testOverlayType(C64);
-    testOverlayType(C32);
-    testOverlayType(F64);
-    testOverlayType(F32);
-    testOverlayType(S16);
-    testOverlayType(S8);
-    testOverlayType(U16);
-    testOverlayType(U8);
-
-    /*
-    Verify the returned integer is equal to non-zero and the input psImage structure
-    is unmodified, if the overlay specified is not within the data range of the
-    input psImage structure.
-    */
-
-    img = psImageAlloc(c,r,PS_TYPE_F32);
-    for (unsigned row=0;row<r;row++) {
-        psF32* imgRow = img->data.F32[row];
-        for (unsigned col=0;col<c;col++) {
-            imgRow[col] = 6.0f;
-        }
-    }
-    img2 = psImageAlloc(c,r,PS_TYPE_F32);
-    for (unsigned row=0;row<r;row++) {
-        psF32* img2Row = img2->data.F32[row];
-        for (unsigned col=0;col<c;col++) {
-            img2Row[col] = 2.0f;
-        }
-    }
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay isn't within image boundaries");
-    retVal = psImageOverlaySection(img,img2,c/4,r/4,"+");
-    if (retVal == 0) {
-        psError(__func__,"psImageOverlaySection returned zero even though "
-                "overlay too big");
-        return 3;
-    }
-    for (unsigned row=0;row<r;row++) {
-        psF32* imgRow = img->data.F32[row];
-        for (unsigned col=0;col<c;col++) {
-            if (imgRow[col] != 6.0f) {
-                psError(__func__,"Input image modified when overlay size too big");
-                return 4;
-            }
-        }
-    }
-
-    /*
-    Verify the returned integer is equal to non-zero, the input psImage
-    structure is unmodified and program execution doesn't stop, if the
-    overlay specified is null.
-    */
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay is NULL");
-    retVal = psImageOverlaySection(img,NULL,c/4,r/4,"+");
-    if (retVal == 0) {
-        psError(__func__,"psImageOverlaySection returned zero even though "
-                "overlay too big");
-        return 5;
-    }
-    for (unsigned row=0;row<r;row++) {
-        psF32* imgRow = img->data.F32[row];
-        for (unsigned col=0;col<c;col++) {
-            if (imgRow[col] != 6.0f) {
-                psError(__func__,"Input image modified when overlay NULL");
-                return 6;
-            }
-        }
-    }
-
-    /*
-    Verify the returned integer is equal to non-zero and program execution
-    doesn't stop, if the input parameter image is null.
-    */
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should error as image input is NULL");
-    retVal = psImageOverlaySection(NULL,img2,c/4,r/4,"+");
-    if (retVal == 0) {
-        psError(__func__,"psImageOverlaySection returned zero even though "
-                "overlay too big");
-        return 7;
-    }
-
-    /*
-    Verify program execution doen't stop, if the overly image contains
-    zero values with division operation is specified.
-    */
-    for (unsigned row=0;row<r;row++) {
-        psF32* img2Row = img2->data.F32[row];
-        for (unsigned col=0;col<c;col++) {
-            img2Row[col] = 0.0f;
-        }
-    }
-    retVal = psImageOverlaySection(img,img2,0,0,"/");
-    if (retVal != 0) {
-        psError(__func__,"psImageOverlaySection returned non-zero when "
-                "checking divide-by-zero.");
-        return 8;
-    }
-
-    psFree(img);
-    psFree(img2);
-
-    return 0;
-}
