IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 4, 2006, 4:48:35 PM (20 years ago)
Author:
drobbin
Message:

Fixed some tiny things and working on fixing psImageSmooth (not done).

File:
1 edited

Legend:

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

    r4547 r7071  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-07-13 02:47:00 $
     8*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-05-05 02:48:34 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6262    subset3 = psImageSubset(original,region1);
    6363
    64     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to "
     64    psLogMsg(__func__,PS_LOG_INFO,
     65             "Verify the returned psImage structure members nrow and ncol are equal to "
    6566             "the input parameter nrow and ncol respectively.");
    6667
    6768    if (subset2->numCols != c/2 || subset2->numRows != r/2) {
    68         psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
     69        psError(PS_ERR_UNKNOWN,true,
     70                "psImageSubset output size was not proper(%dx%d, should be %dx%d).",
    6971                subset2->numCols, subset2->numRows, c/2,r/2);
    7072        return 1;
     
    7274
    7375    if (subset3->numCols != c/2 || subset3->numRows != r/2) {
    74         psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).",
     76        psError(PS_ERR_UNKNOWN,true,
     77                "psImageSubset output size was not proper(%dx%d, should be %dx%d).",
    7578                subset3->numCols, subset3->numRows, c/2,r/2);
    7679        return 2;
    7780    }
    7881
    79     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
     82    psLogMsg(__func__,PS_LOG_INFO,
     83             "Verify the returned psImage structure contains expected values in the "
    8084             "row member, if the input psImage structure image contains known values.");
    8185
     
    9599    }
    96100
    97     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input "
     101    psLogMsg(__func__,PS_LOG_INFO,
     102             "Verify the returned psImage structure member type is equal to the input "
    98103             "psImage structure member type.");
    99104
     
    109114    }
    110115
    111     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members row0 and col0 are equal to "
     116    psLogMsg(__func__,PS_LOG_INFO,
     117             "Verify the returned psImage structure members row0 and col0 are equal to "
    112118             "the input parameters row0 and col0 respectively.");
    113119
    114120    if (subset2->col0 != c/4 || subset2->row0 != r/4) {
    115         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).",
     121        psError(PS_ERR_UNKNOWN,true,
     122                "psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).",
    116123                subset2->col0,subset2->row0,c/4,r/4);
    117124        return 8;
    118125    }
    119126    if (subset3->col0 != 0 || subset3->row0 != 0) {
    120         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).",
     127        psError(PS_ERR_UNKNOWN,true,
     128                "psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).",
    121129                subset3->col0,subset3->row0,0,0);
    122130        return 9;
    123131    }
    124132
    125     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member parent is equal to the "
     133    psLogMsg(__func__,PS_LOG_INFO,
     134             "Verify the returned psImage structure member parent is equal to the "
    126135             "input psImage structure pointer image.");
    127136
     
    138147    }
    139148
    140     psLogMsg(__func__,PS_LOG_INFO,"Verify the input psImage structure image only has the following members "
     149    psLogMsg(__func__,PS_LOG_INFO,
     150             "Verify the input psImage structure image only has the following members "
    141151             "changed: 1) Nchildren is increased by one. 2) parent contains pointer psImage structure "
    142152             "out at parent[Nchildren-1].");
    143153
    144154    if (original->children == NULL || original->children->n != 2) {
    145         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't increment number of children by one per subset.");
     155        psError(PS_ERR_UNKNOWN,true,
     156                "psImageSubset didn't increment number of children by one per subset.");
    146157        return 12;
    147158    }
     
    180191    }
    181192    if (memcmp(original,&preSubsetStruct,sizeof(psImage)) != 0) {
    182         psError(PS_ERR_UNKNOWN,true,"psImageSubset changed the original struct though it failed to subset.");
     193        psError(PS_ERR_UNKNOWN,true,
     194                "psImageSubset changed the original struct though it failed to subset.");
    183195        return 17;
    184196    }
    185197
    186198
    187     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program "
    188              "execution doesn't stop, if the input parameters row0 and col0 are not within the range of "
    189              "values of psImage structure image.");
     199    psLogMsg(__func__,PS_LOG_INFO,
     200             "Verify the returned psImage structure pointer is null and program "
     201             "execution doesn't stop, if the input parameters row0 and col0 are not within "
     202             "the range of values of psImage structure image.");
    190203
    191204    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    192205    subset1 = psImageSubset(original, psRegionSet(0,c/2, 0,r*2));
    193206    if (subset1 != NULL) {
    194         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of "
     207        psError(PS_ERR_UNKNOWN,true,
     208                "psImageSubset didn't return NULL when subset origin was outside of "
    195209                "image (via cols).");
    196210        return 18;
     
    199213    subset1 = psImageSubset(original,psRegionSet(0,c*2,0,r/2));
    200214    if (subset1 != NULL) {
    201         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of "
     215        psError(PS_ERR_UNKNOWN,true,
     216                "psImageSubset didn't return NULL when subset origin was outside of "
    202217                "image (via rows).");
    203218        return 19;
     
    206221    subset1 = psImageSubset(original, psRegionSet(-1,c/2,0,r/2));
    207222    if (subset1 != NULL) {
    208         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of "
     223        psError(PS_ERR_UNKNOWN,true,
     224                "psImageSubset didn't return NULL when subset origin was outside of "
    209225                "image (col0=-1).");
    210226        return 20;
     
    213229    subset1 = psImageSubset(original, psRegionSet(0,c/2,-1,r/2));
    214230    if (subset1 != NULL) {
    215         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of "
     231        psError(PS_ERR_UNKNOWN,true,
     232                "psImageSubset didn't return NULL when subset origin was outside of "
    216233                "image (row0=-1).");
    217234        return 21;
    218235    }
    219236
    220     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program "
    221              "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of "
    222              "data not within the input psImage structure image.  Also verify the input psImage structure "
    223              "is not modified.");
     237    psLogMsg(__func__,PS_LOG_INFO,
     238             "Verify the returned psImage structure pointer is null and program "
     239             "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 "
     240             "specify a range of data not within the input psImage structure image.  Also "
     241             "verify the input psImage structure is not modified.");
    224242
    225243    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    226244    subset1 = psImageSubset(original,psRegionSet(0,c/2,0,r+1));
    227245    if (subset1 != NULL) {
    228         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
     246        psError(PS_ERR_UNKNOWN,true,
     247                "psImageSubset didn't return NULL when subset was outside of image (via rows).");
    229248        return 22;
    230249    }
     
    232251    subset1 = psImageSubset(original, psRegionSet(0,c+1,0,r/2));
    233252    if (subset1 != NULL) {
    234         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
     253        psError(PS_ERR_UNKNOWN,true,
     254                "psImageSubset didn't return NULL when subset was outside of image (via cols).");
    235255        return 23;
    236256    }
     
    238258    subset1 = psImageSubset(original,psRegionSet(0,c+1,0,r+1));
    239259    if (subset1 != NULL) {
    240         psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
     260        psError(PS_ERR_UNKNOWN,true,
     261                "psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
    241262        return 24;
    242263    }
    243264
    244     psLogMsg(__func__, PS_LOG_INFO, "psImageFreeChildren shall deallocate any children images of a "
     265    psLogMsg(__func__, PS_LOG_INFO,
     266             "psImageFreeChildren shall deallocate any children images of a "
    245267             "psImage structure");
    246268
     
    251273    // Verify the returned psImage structure member Nchildren is set to zero.
    252274    if (original->children != NULL && original->children->n > 0) {
    253         psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren didn't set number of children to zero.");
     275        psError(PS_ERR_UNKNOWN,true,
     276                "psImageFreeChildren didn't set number of children to zero.");
    254277        return 25;
    255278    }
    256279
    257     //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows and parent are not
    258     // modified.
     280    //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows
     281    // and parent are not modified.
    259282    if (preSubsetStruct.numRows != original->numRows ||
    260283            preSubsetStruct.numCols != original->numCols ||
     
    262285            preSubsetStruct.col0 != original->col0) {
    263286
    264         psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren modified parent's non-children elements.");
     287        psError(PS_ERR_UNKNOWN,true,
     288                "psImageFreeChildren modified parent's non-children elements.");
    265289        return 27;
    266290    }
     
    352376            } \
    353377            if (abs(img2Row[col] - (ps##OUT)(imgRow[col])) > 0.5) { \
    354                 psError(PS_ERR_UNKNOWN, true,"returned psImage values after copy don't match at %d,%d " \
     378                psError(PS_ERR_UNKNOWN, true, \
     379                        "returned psImage values after copy don't match at %d,%d " \
    355380                        "(%d vs %d)",\
    356381                        col,row,img2Row[col], (ps##OUT)(imgRow[col])); \
     
    456481    for (psS32 row = 0; row < image2->numRows; row++) {
    457482        for (psS32 col = 0; col < image2->numCols; col++) {
    458             if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) {
     483            if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC])
     484                    > FLT_EPSILON) {
    459485                psLogMsg(__func__,PS_LOG_ERROR,
    460486                         "The value at (%d,%d) was %g, but should be %g.",
Note: See TracChangeset for help on using the changeset viewer.