IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 1, 2007, 6:14:33 PM (19 years ago)
Author:
gusciora
Message:

Added tabular file of all psLib functions in Chapter 6 of the SDRS (Data
Manipulation). Most of the test file changes in this check-in are fairly
cosmetic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/imageops/tap_psImageGeomManip.c

    r13084 r13123  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-05-01 00:08:52 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-05-02 04:14:33 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    154154    plan_tests(237);
    155155
    156     // testImageRebin()
    157     // This function shall generate a rescaled version of a psImage structure
    158     // derived from a specified statistics method.
     156    // test psImageRebin()
     157    // This function shall generate a rescaled version of a psImage
     158    // structure derived from a specified statistics method.
    159159    if (1) {
    160160        psMemId id = psMemGetId();
     
    295295        testRebinType(U16);
    296296        testRebinType(S8);
    297         // Verify the returned psImage structure is null and program execution
     297        // Verify the returned psImage structure is NULL and program execution
    298298        // doesn't stop, if the input image type is not supported.
    299299        // Following should be an error for unsupported type
     
    305305        ok(out == NULL, "psImageRebin returned NULL for unsupported type");
    306306
    307         // Verify the returned psImage structure is null and program execution
     307        // Verify the returned psImage structure is NULL and program execution
    308308        // doesn't stop, if the mask type is not U8
    309309        // Following should be an error for invallid mask type
     
    314314        psFree(in);
    315315
    316         // Verify the returned psImage structure is null and program execution
    317         // doesn't stop, if the input parameter input is null.
     316        // Verify the returned psImage structure is NULL and program execution
     317        // doesn't stop, if the input parameter input is NULL.
    318318        out2 = psImageRebin(NULL,NULL,NULL,0,1,&stats);
    319319        ok(out2 == NULL, "psImageRebin returned NULL with NULL input");
    320320
    321         // Verify the returned psImage structure is null and program execution
     321        // Verify the returned psImage structure is NULL and program execution
    322322        // doesn't stop, if the input parameter scale is less than or equal to zero.
    323323        in = psImageAlloc(16, 16, PS_TYPE_F32);
     
    327327        ok(out2 == NULL, "psImageRebin returned NULL when the scale was zero");
    328328
    329         // Verify the returned psImage structure is null and program execution
    330         // doesn't stop, if the input parameter stats is null.
    331         // Following should be an error for stats null
     329        // Verify the returned psImage structure is NULL and program execution
     330        // doesn't stop, if the input parameter stats is NULL.
     331        // Following should be an error for stats NULL
    332332        // XXX: Verify error
    333333        out2 = psImageRebin(NULL,in,NULL,0,1,NULL);
    334334        ok(out2 == NULL, "psImageRebin returned an NULL when the stats was NULL");
    335335
    336         // Verify the returned psImage structure is null and program execution
     336        // Verify the returned psImage structure is NULL and program execution
    337337        // doesn't stop, if the input parameter psStats structure member options
    338338        // is zero or any value which doesn't correspond to a valid statistical
     
    350350        ok(out2 == NULL, "psImageRebin returned an image though the stats options was PS_STAT_USE_RANGE");
    351351
    352         // Verify the returned psImage structure is null and program execution
     352        // Verify the returned psImage structure is NULL and program execution
    353353        // doesn't stop, if the input parameter psStats structure member options
    354354        // specifies more than one valid statistical method.
     
    363363    }
    364364
    365     // testImageRoll()
     365    // test psImageRoll()
    366366    if (1) {
    367367        psMemId id = psMemGetId();
     
    387387
    388388        in = psImageAlloc(cols,rows,PS_TYPE_F32);
    389         for (psS32 row=0;row<rows;row++)
    390         {
    391             psF32 *inRow = in->data.F32[row];
    392             for (psS32 col=0;col<cols;col++) {
    393                 inRow[col] = (psF32)row+(psF32)col/1000.0f;
     389        for (psS32 row=0;row<rows;row++) {
     390            for (psS32 col=0;col<cols;col++) {
     391                in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f;
    394392            }
    395393        }
     
    397395        out = psImageRoll(NULL,in,0,0);
    398396        bool errorFlag = false;
    399         for (psS32 row=0;row<rows;row++)
    400         {
     397        for (psS32 row=0;row<rows;row++) {
    401398            psF32 *inRow = in->data.F32[row];
    402399            psF32 *outRow = out->data.F32[row];
     
    519516
    520517
    521         // Verify the returned psImage structure pointer is null and program
    522         // execution doesn't stop, if input parameter input is null.
     518        // Verify the returned psImage structure pointer is NULL and program
     519        // execution doesn't stop, if input parameter input is NULL.
    523520        out2 = psImageRoll(NULL,NULL,0,0);
    524         if (out2 != NULL)
    525         {
     521        if (out2 != NULL) {
    526522            psError(PS_ERR_UNKNOWN, true,"psImageRoll did not return NULL though input image was NULL!?");
    527523            return 2;
     
    567563    }
    568564
    569 
    570     // testImageRotate()
     565    // test psImageRotate()
    571566    if (1) {
    572567        psMemId id = psMemGetId();
     
    599594        psImage *sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
    600595
    601         for(psS32 row=0;row<rows;row++)
    602         {
     596        for(psS32 row=0;row<rows;row++) {
    603597            psF32 *fRow = fImg->data.F32[row];
    604598            psS16 *sRow = sImg->data.S16[row];
     
    612606        // is to verify the results manually and bless it for automated comparison
    613607        // thereafter
    614 
    615608
    616609        // write results of various rotates to a file and verify with truth images
     
    796789        }
    797790//HERE
    798         // Verify the returned psImage structure pointer is null and program
    799         // execution doesn't stop, if the input parameter input is null.
     791        // Verify the returned psImage structure pointer is NULL and program
     792        // execution doesn't stop, if the input parameter input is NULL.
    800793        // Following should be an error
    801794        // XXX: Verify error
     
    803796        ok(fOut == NULL, "NULL was returned when the input image was NULL");
    804797
    805         // Verify the returned psImage structure pointer is null and program
     798        // Verify the returned psImage structure pointer is NULL and program
    806799        // execution doesn't stop, if the specified interpolation mode is unallowed
    807800        // Following should be an error for unallowed interpolation type
     
    882875        ok(fRecycle == fOut, "psImageShift did recycle my image");
    883876
    884         // Verify the returned psImage structure pointer is null and program
    885         // execution doesn't stop, if the input psImage structure pointer is null.
     877        // Verify the returned psImage structure pointer is NULL and program
     878        // execution doesn't stop, if the input psImage structure pointer is NULL.
    886879        // Following should be an error
    887880        // XXX: Verify error
     
    889882        ok(fOut == NULL, "psImageShift did return NULL given a NULL input image");
    890883
    891         // Verify the returned psImage structure is null and program execution
     884        // Verify the returned psImage structure is NULL and program execution
    892885        // doesn't stop, if the specified interpolation mode is unallowed.
    893886        // Following should be an error for unallowed interpolation mode
     
    901894
    902895
    903     // testImageResample()
     896    // test psImageResample()
    904897    if (1) {
    905898        psMemId id = psMemGetId();
    906 
    907899        psS32 rows = 60;
    908900        psS32 cols = 80;
     
    911903        psErr *err;
    912904
    913         psImage *image = psImageAlloc(cols,rows,PS_TYPE_F32);
    914         for(psS32 row=0;row<rows;row++)
    915         {
    916             psF32 *imageRow = image->data.F32[row];
    917             for (psS32 col=0;col<cols;col++) {
    918                 imageRow[col] = row+2*col;
     905        psImage *image = psImageAlloc(cols, rows, PS_TYPE_F32);
     906        for(psS32 row=0;row<rows;row++) {
     907            for (psS32 col=0;col<cols;col++) {
     908                image->data.F32[row][col] = row+2*col;
    919909            }
    920910        }
     
    925915        ok(result == orig, "psImageResample() recycled image");
    926916        ok(result->type.type == PS_TYPE_F32, "psImageResample() produced the correct type");
    927 
    928 
    929917        ok(result->numCols == image->numCols*scale && result->numRows == image->numRows*scale,
    930918           "psImageResample() produced the correct size");
    931 
    932919
    933920        bool errorFlag = false;
     
    939926            psMaskType maskVal;
    940927            psF32 truthValue;
    941             for(psS32 row=0;row<result->numRows;row++)
    942             {
     928            for(psS32 row=0;row<result->numRows;row++) {
    943929                for (psS32 col=0;col<result->numCols;col++) {
    944930//                    truthValue = psImagePixelInterpolate(image,
     
    961947        ok(!errorFlag, "psImageResample() produced the correct data values");
    962948
    963         // verify that image=null is handled properly.
     949        // verify that image=NULL is handled properly.
    964950        psErrorClear();
    965951        result = psImageResample(result,NULL,scale,PS_INTERPOLATE_FLAT);
     
    1002988
    1003989
    1004     // testImageTransform()
     990    // test psImageTransform()
    1005991    if (1) {
    1006992        psMemId id = psMemGetId();
     
    1013999
    10141000        psImage *in = psImageAlloc(cols,rows,PS_TYPE_F32);
    1015         for (psS32 row=0;row<rows;row++)
    1016         {
    1017             psF32 *inRow = in->data.F32[row];
    1018             for (psS32 col=0;col<cols;col++) {
    1019                 inRow[col] = (psF32)row+(psF32)col/1000.0f;
     1001        for (psS32 row=0;row<rows;row++) {
     1002            for (psS32 col=0;col<cols;col++) {
     1003                in->data.F32[row][col] = (psF32)row+(psF32)col/1000.0f;
    10201004            }
    10211005        }
    10221006        P_PSIMAGE_SET_COL0(in, 1);
    1023         psImage *out = psImageTransform(NULL,
    1024                                         NULL,
    1025                                         in,
    1026                                         NULL,
    1027                                         0,
    1028                                         trans,
    1029                                         psRegionSet(1,1+cols*2,0,rows*2),
    1030                                         NULL,
    1031                                         PS_INTERPOLATE_FLAT,
    1032                                         -1);
     1007        psImage *out = psImageTransform(NULL, NULL, in, NULL, 0, trans,
     1008                                        psRegionSet(1,1+cols*2,0,rows*2), NULL,
     1009                                        PS_INTERPOLATE_FLAT, -1);
    10331010
    10341011        ok(out != NULL, "psImageTransform() returned non-NULL");
     
    10361013        ok(out->numRows == rows*2 && out->numCols == cols*2, "psImageTransform() produced the correct size");
    10371014
    1038         if (0) {
     1015        if (1) {
    10391016            psMemId id = psMemGetId();
    10401017            psImageInterpolateOptions *tmpIntOpts = psImageInterpolateOptionsAlloc(
     
    10451022            psMaskType maskVal;
    10461023            bool errorFlag = false;
    1047             for (psS32 row=0;row<out->numRows;row++)
    1048             {
    1049                 psF32 *outRow = out->data.F32[row];
     1024            for (psS32 row=0;row<out->numRows;row++) {
    10501025                for (psS32 col=0;col<cols;col++) {
    10511026                    psImageInterpolate(&imgVal, &varVal, &maskVal,
     
    10541029                                       tmpIntOpts);
    10551030                    float inValue = imgVal;
    1056                     if (fabsf(outRow[col] - inValue) > 0.01) {
    1057                         diag("out at %d,%d was %g, expected %g", col,row,outRow[col], inValue);
     1031                    if (fabsf(out->data.F32[row][col] - inValue) > 0.01) {
     1032                        diag("out at %d,%d was %g, expected %g", col,row,
     1033                              out->data.F32[row][col], inValue);
    10581034                        errorFlag = true;
    10591035                    }
Note: See TracChangeset for help on using the changeset viewer.