IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7071


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).

Location:
trunk/psLib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageConvolve.c

    r6937 r7071  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-04-21 20:45:56 $
     7 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-05-05 02:48:34 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    603603        /* generate normalized gaussian */ \
    604604        psVector *gaussnorm = psVectorAlloc (Npixel, PS_TYPE_##TYPE); \
     605        gaussnorm->n = gaussnorm->nalloc; \
    605606        sum = 0.0; \
    606607        for (int i = -Nrange; i < Nrange + 1; i++) { \
     
    615616        /* smooth in X direction */ \
    616617        temp = psVectorAlloc (Nx, PS_TYPE_##TYPE); \
     618        temp->n = temp->nalloc; \
    617619        for (int j = 0; j < Ny; j++) { \
    618620            ps##TYPE *vi = image->data.TYPE[j]; \
     
    661663        for (int j = 0; j < Nrange; j++) { \
    662664            temp = psVectorAlloc (Nx, PS_TYPE_##TYPE); \
     665            temp->n = temp->nalloc; \
    663666            /* zero the output row */ \
    664667            memset (temp->data.TYPE, 0, Nx*sizeof(PS_TYPE_##TYPE)); \
  • trunk/psLib/src/mathtypes/psImage.c

    r6912 r7071  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.103 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-04-20 01:13:11 $
     11 *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-05-05 02:48:34 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    714714
    715715    char buffer[20];
    716     for (int j = 0; j < a[0].numRows; j++) {
    717         for (int i = 0; i < a[0].numCols; i++) {
     716    //    for (int j = 0; j < a[0].numRows; j++) {
     717    //        for (int i = 0; i < a[0].numCols; i++) {
     718    for (int j = 0; j < a->numRows; j++) {
     719        for (int i = 0; i < a->numCols; i++) {
    718720            snprintf (buffer,20, "%f  ", p_psImageGetElementF64(a, i, j));
    719721            write(fd,buffer,strlen(buffer));
  • trunk/psLib/src/mathtypes/psVector.c

    r7056 r7071  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2006-05-04 00:09:11 $
     11*  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2006-05-05 02:48:34 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    207207    output = psVectorRecycle(output, nElements, type);
    208208    if (nElements == 0) {
    209         psWarning("Warning: psVector was copied with 0 elements!\n");
     209        //        psWarning("Warning: psVector was copied with 0 elements!\n");
    210210        return output;
    211211    }
  • trunk/psLib/test/imageops/tst_psImageSmooth.c

    r6280 r7071  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-02-01 21:35:59 $
     7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-05-05 02:48:34 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8383    }
    8484    if (VERBOSE) {
    85         p_psImagePrint(1, img, "The Smmothed Image");
     85        p_psImagePrint(1, img, "The Smoothed Image");
    8686    }
    8787
     
    132132        }
    133133        if (VERBOSE) {
    134             p_psImagePrint(1, img, "The Smmothed Image");
     134            p_psImagePrint(1, img, "The Smoothed Image");
    135135        }
    136136
     
    139139                for (psS32 j = 1 ; j < numCols-1 ; j++) {
    140140                    if ((fabs(img->data.F32[i][j] - 0.5) > 0.1)) {
    141                         printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F32[i][j]);
     141                        printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n",
     142                               i, j, img->data.F32[i][j]);
    142143                        testStatus = false;
    143144                    }
     
    150151                for (psS32 j = 1 ; j < numCols-1 ; j++) {
    151152                    if ((fabs(img->data.F64[i][j] - 0.5) > 0.1)) {
    152                         printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F64[i][j]);
     153                        printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n",
     154                               i, j, img->data.F64[i][j]);
    153155                        testStatus = false;
    154156                    }
     
    161163    return(testStatus);
    162164}
    163 
    164 
    165 
    166 
    167 
    168 
    169 
    170 
    171 
    172 
    173 
    174 
    175 
    176 
    177 
    178 
    179 
    180 
    181 
    182 
    183 
    184165
    185166static psS32 testImageSmooth()
  • 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.",
  • trunk/psLib/test/mathtypes/tst_psVectorSort_01.c

    r7043 r7071  
    1212 *  @author  Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2006-05-02 22:35:52 $
     14 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2006-05-05 02:48:35 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    165165    //    }
    166166    if (out != NULL) {
     167        if (out->n != 0) {
     168            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     169                    "psVectorSort failed to correctly return a 0-length vector.\n");
     170            return 12;
     171        }
     172    } else {
    167173        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    168                 "psVectorSort failed to return a NULL vector for 0-length input vector.\n");
    169         return 666;
     174                "psVectorSort returned a NULL vector instead of expected vector with n=0.\n");
     175        return 13;
    170176    }
    171177    /*    if(out->n != 0) {
     
    174180        }
    175181        */
     182    psFree(out);
    176183    printFooter(stdout,"psVectorSort","Sort zero element vector",true);
    177184
  • trunk/psLib/test/mathtypes/verified/tst_psVectorSort_01.stderr

    r7046 r7071  
    55<DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO)
    66    Error in psVectorSort:  psVectorCopy returned NULL vector!
    7 <DATE><TIME>|<HOST>|W|psVectorCopy (FILE:LINENO)
    8     Warning: psVector was copied with 0 elements!
    9 <DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO)
    10     Error in psVectorSort:  Vector has less than 2 data entries!
Note: See TracChangeset for help on using the changeset viewer.