IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 27, 2004, 3:43:17 PM (22 years ago)
Author:
desonia
Message:

Bug #1066 - psImageOverlaySection shall return the number of pixels overlaid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImageManip.c

    r2754 r2835  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-12-18 00:01:08 $
     8 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-12-28 01:43:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    331331    1. Create a complex image with a wide range of complex values
    332332
    333     2. call psImageClipComplexRegion with min and max where there is at least 
     333    2. call psImageClipComplexRegion with min and max where there is at least
    334334       2 pixels in the image above) that is:
    335335        a) real(p) < real(min) && complex(p) < complex(min),
     
    347347    4. verify that all pixels in case (d) are unchanged from input
    348348
    349     5. verify that all pixels in case (e), (f), (g), (h), and (i) have the 
     349    5. verify that all pixels in case (e), (f), (g), (h), and (i) have the
    350350       value vmax
    351351
     
    606606    */
    607607
    608 
    609 
    610608    #define testOverlayTypeOP(DATATYPE,OP,OPSTRING) \
    611609    img = psImageAlloc(c,r,PS_TYPE_##DATATYPE); \
     
    624622    } \
    625623    retVal = psImageOverlaySection(img,img2,c/4,r/4,OPSTRING); \
    626     if (retVal != 0) { \
    627         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned non-zero %s op",OPSTRING); \
     624    if (retVal == 0) { \
     625        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero with %s op", \
     626                OPSTRING); \
    628627        return 1; \
    629628    } \
     
    705704             "within image boundaries");
    706705    retVal = psImageOverlaySection(img,img2,c/4,r/4,"+");
    707     if (retVal == 0) {
    708         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero even though "
    709                 "overlay too big");
     706    if (retVal != 0) {
     707        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection did not return "
     708                "zero even though overlay too big");
    710709        return 3;
    711710    }
     
    728727    psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay is NULL");
    729728    retVal = psImageOverlaySection(img,NULL,c/4,r/4,"+");
    730     if (retVal == 0) {
    731         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero even though "
    732                 "overlay too big");
     729    if (retVal != 0) {
     730        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection did not return "
     731                "zero even though overlay too big");
    733732        return 5;
    734733    }
     
    750749    psLogMsg(__func__,PS_LOG_INFO,"Following should error as image input is NULL");
    751750    retVal = psImageOverlaySection(NULL,img2,c/4,r/4,"+");
    752     if (retVal == 0) {
    753         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero even though "
     751    if (retVal != 0) {
     752        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned non-zero even though "
    754753                "overlay too big");
    755754        return 7;
     
    763762    psLogMsg(__func__,PS_LOG_INFO,"Following should error as operator is invalid");
    764763    retVal = psImageOverlaySection(img,img2,0,0,"$");
    765     if (retVal == 0) {
    766         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero even though "
     764    if (retVal != 0) {
     765        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned non-zero even though "
    767766                "overlay operator is invalid");
    768767        return 8;
     
    776775    psLogMsg(__func__,PS_LOG_INFO,"Following should error as operator is invalid");
    777776    retVal = psImageOverlaySection(img,img2,0,0,NULL);
    778     if(retVal == 0) {
    779         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero even though "
     777    if(retVal != 0) {
     778        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned non-zero even though "
    780779                "overlay operator is NULL");
    781780        return 9;
     
    783782
    784783    /*
    785     Verify the return integer is equal to non-zero and program execution 
     784    Verify the return integer is equal to non-zero and program execution
    786785    doesn't stop, if overlay image is a different type than the input image
    787786    */
     
    789788             "a different type");
    790789    retVal = psImageOverlaySection(img,img3,0,0,"+");
    791     if(retVal == 0) {
    792         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero eventhough "
     790    if(retVal != 0) {
     791        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned nonzero eventhough "
    793792                " overlay image type is different than input image.");
    794793        return 10;
    795     }
    796 
    797     /*
    798     Verify the return integer is equal to non-zero and program execution
    799     doesn't stop, if invalid input and overlay images
    800     */
    801     psLogMsg(__func__,PS_LOG_INFO,"Following should error as overlay and "
    802              "image are not valid for the psImageOverlaySection function.");
    803     retVal = psImageOverlaySection(img3,img4,0,0,"+");
    804     if(retVal == 0) {
    805         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero eventhough "
    806                 "overlay and image type are invalid type.");
    807         return 11;
    808794    }
    809795
     
    819805    }
    820806    retVal = psImageOverlaySection(img,img2,0,0,"/");
    821     if (retVal != 0) {
    822         psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned non-zero when "
     807    if (retVal == 0) {
     808        psError(PS_ERR_UNKNOWN, true,"psImageOverlaySection returned zero when "
    823809                "checking divide-by-zero.");
    824810        return 12;
     
    837823
    838824    /*
    839     This function shall generate a rescaled version of a psImage structure 
     825    This function shall generate a rescaled version of a psImage structure
    840826    derived from a specified statistics method.
    841827    */
     
    852838
    853839    /*
    854     Verify the returned psImage structure contains expected values, if the 
    855     input parameter input contains known data, the input scale is a known 
    856     value with a known statistical method specified in stats. Cases should 
    857     include at least two different scales and statistical methods. Comparison 
    858     of expected values should include a delta to allow testing on different 
     840    Verify the returned psImage structure contains expected values, if the
     841    input parameter input contains known data, the input scale is a known
     842    value with a known statistical method specified in stats. Cases should
     843    include at least two different scales and statistical methods. Comparison
     844    of expected values should include a delta to allow testing on different
    859845    platforms.
    860846    */
     
    10941080
    10951081    /*
    1096      The function psImageRoll shall generate a new psImage structure by 
     1082     The function psImageRoll shall generate a new psImage structure by
    10971083     rolling the input image the correponding number of pixels in the vertical
    10981084     and/or horizontal direction. The image output image shall be the same size
    1099      as the input image. Values which roll off the image are wrapped to the 
     1085     as the input image. Values which roll off the image are wrapped to the
    11001086     other side.
    11011087
    1102      Verify the returned psImage structure contains expected values, if the 
    1103      input image contains known values and the roll performed is known. 
    1104      Cases should include no roll, vertical roll, horizontal roll and 
    1105      combination vertical/horizontal rolls. Positive and negative rolls 
     1088     Verify the returned psImage structure contains expected values, if the
     1089     input image contains known values and the roll performed is known.
     1090     Cases should include no roll, vertical roll, horizontal roll and
     1091     combination vertical/horizontal rolls. Positive and negative rolls
    11061092     should be performed.
    11071093    */
     
    12741260    /*
    12751261
    1276     This function shall calculate a new psImage structure based upon the 
    1277     rotation of a given psImage structure. The center of rotation shall be the 
     1262    This function shall calculate a new psImage structure based upon the
     1263    rotation of a given psImage structure. The center of rotation shall be the
    12781264    center pixel of the input image.
    12791265
    1280     The following steps of the testpoint are done manually via inspection of 
     1266    The following steps of the testpoint are done manually via inspection of
    12811267    temp/fOut.fits & temp/sOut.fits.
    12821268
    1283         * Verify the returned psImage structure contains expected values, if 
    1284           the input parameter psImage contains known values. Cases should 
    1285           include rotations of 0, 45, 90, 135, 180, 225, 270, 315, 360 and at leat one 
     1269        * Verify the returned psImage structure contains expected values, if
     1270          the input parameter psImage contains known values. Cases should
     1271          include rotations of 0, 45, 90, 135, 180, 225, 270, 315, 360 and at leat one
    12861272          other arbitrary angle. Cases of the input image should include image
    12871273          with a center pixel and an image without a center pixel.
     
    15411527    /* psImageShift:
    15421528
    1543        This functions shall generate a new psImage structure by shifting the 
    1544        input psImage structure a specified number of pixels in the horizontal 
     1529       This functions shall generate a new psImage structure by shifting the
     1530       input psImage structure a specified number of pixels in the horizontal
    15451531       and/or vertical directions.
    15461532
    1547        Verify the returned psImage structure contains expected values, if the 
    1548        input psImage structure contains known values and a know shift in the 
    1549        vertical and/or horizontal directions. Cases should include no shift, 
    1550        vertical only(up,down), horizontal only(right, left), and combination 
    1551        shift. Cases should include fractional shifts. Comparison of expected 
    1552        values should include a delta to allow for testing on different 
     1533       Verify the returned psImage structure contains expected values, if the
     1534       input psImage structure contains known values and a know shift in the
     1535       vertical and/or horizontal directions. Cases should include no shift,
     1536       vertical only(up,down), horizontal only(right, left), and combination
     1537       shift. Cases should include fractional shifts. Comparison of expected
     1538       values should include a delta to allow for testing on different
    15531539       platforms.
    15541540
    1555        Verify the returned psImage structure contains values for pixels not in 
     1541       Verify the returned psImage structure contains values for pixels not in
    15561542       the original image set to the input parameter exposed.
    15571543
     
    15901576
    15911577    /*
    1592        Verify the returned psImage structure pointer is equal to the input 
     1578       Verify the returned psImage structure pointer is equal to the input
    15931579       parameter out if provided.
    15941580    */
     
    16031589
    16041590    /*
    1605        Verify the returned psImage structure pointer is null and program 
     1591       Verify the returned psImage structure pointer is null and program
    16061592       execution doesn't stop, if the input psImage structure pointer is null.
    16071593    */
     
    18201806    psErrorClear();
    18211807    psImage* invImage = psImageAlloc(cols,rows,PS_TYPE_PTR);
     1808    memset(invImage->rawDataBuffer,0,cols*rows*sizeof(psPtr)); // make sure the image is of all NULLs
    18221809    result = psImageResample(result,invImage,2,PS_INTERPOLATE_FLAT);
    18231810    if (result != NULL) {
Note: See TracChangeset for help on using the changeset viewer.