IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 23, 2004, 12:36:04 PM (22 years ago)
Author:
desonia
Message:

changed psImageSubset to subset an image without making a deep copy.

File:
1 edited

Legend:

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

    r1406 r1606  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-08-06 22:34:06 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-08-23 22:36:03 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psLogSetLevel(PS_LOG_INFO);
    5151
    52     if (! runTestSuite(stderr,"psImage",tests,argc,argv)) {
    53         psError(__FILE__,"One or more tests failed");
    54         return 1;
    55     }
    56     return 0;
     52    return ! runTestSuite(stderr,"psImage",tests,argc,argv);
    5753}
    5854
     
    247243    // children isfreed.
    248244    image = psImageAlloc(100,100,PS_TYPE_F32);
    249     psImageSubset(NULL,image,50,50,0,0);
    250     psImageSubset(NULL,image,50,50,20,20);
     245    psImageSubset(image,50,50,0,0);
     246    psImageSubset(image,50,50,20,20);
    251247
    252248    psFree(image);
     
    273269    }
    274270
    275     psLogMsg(__func__,PS_LOG_INFO,"memcpy(&preSubsetStruct,original,sizeof(psImage));");
    276271    memcpy(&preSubsetStruct,original,sizeof(psImage));
    277272
    278     psLogMsg(__func__,PS_LOG_INFO,"subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);");
    279     subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);
    280 
    281     psLogMsg(__func__,PS_LOG_INFO,"subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);");
    282     subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);
    283 
    284     psLogMsg(__func__,PS_LOG_INFO,"subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);");
    285     subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);
    286 
    287     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure is equal to the input psImage "
    288              "structure parameter out, if input parameter out is specified.");
    289 
    290     if (subset1 != subset2 || subset2 == NULL) {
    291         psError(__func__,"psImageSubset didn't recycle the psImage given");
    292         return 1;
    293     }
    294 
    295     psLogMsg(__func__,PS_LOG_INFO,"Verify a new psImage structure is created, if input parameter out is set "
    296              "to null.");
    297 
    298     if (subset3 == NULL) {
    299         psError(__func__,"psImageSubset output was NULL for subset3.");
    300         return 2;
    301     }
     273    subset2 = psImageSubset(original,c/2,r/2,c/4,r/4);
     274
     275    subset3 = psImageSubset(original,c/2,r/2,0,0);
    302276
    303277    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
     
    397371
    398372    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    399     subset1 = psImageSubset(NULL,NULL,c/2,r/2,0,0);
     373    subset1 = psImageSubset(NULL,c/2,r/2,0,0);
    400374    if (subset1 != NULL) {
    401375        psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
     
    409383    memcpy(&preSubsetStruct,original,sizeof(psImage));
    410384    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    411     subset1 = psImageSubset(NULL,original,c/2,0,0,0);
     385    subset1 = psImageSubset(original,c/2,0,0,0);
    412386    if (subset1 != NULL) {
    413387        psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
     
    415389    }
    416390    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    417     subset1 = psImageSubset(NULL,original,0,r/2,0,0);
     391    subset1 = psImageSubset(original,0,r/2,0,0);
    418392    if (subset1 != NULL) {
    419393        psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
     
    431405
    432406    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    433     subset1 = psImageSubset(NULL,original,c/2,r/2,c,0);
     407    subset1 = psImageSubset(original,c/2,r/2,c,0);
    434408    if (subset1 != NULL) {
    435409        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    438412    }
    439413    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    440     subset1 = psImageSubset(NULL,original,c/2,r/2,0,r);
     414    subset1 = psImageSubset(original,c/2,r/2,0,r);
    441415    if (subset1 != NULL) {
    442416        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    445419    }
    446420    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    447     subset1 = psImageSubset(NULL,original,c/2,r/2,-1,0);
     421    subset1 = psImageSubset(original,c/2,r/2,-1,0);
    448422    if (subset1 != NULL) {
    449423        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    452426    }
    453427    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    454     subset1 = psImageSubset(NULL,original,c/2,r/2,0,-1);
     428    subset1 = psImageSubset(original,c/2,r/2,0,-1);
    455429    if (subset1 != NULL) {
    456430        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    465439
    466440    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    467     subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,0);
     441    subset1 = psImageSubset(original,c/2,r/2,c/2,0);
    468442    if (subset1 != NULL) {
    469443        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
     
    471445    }
    472446    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    473     subset1 = psImageSubset(NULL,original,c/2,r/2,0,r/2);
     447    subset1 = psImageSubset(original,c/2,r/2,0,r/2);
    474448    if (subset1 != NULL) {
    475449        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
     
    477451    }
    478452    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    479     subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,r/2);
     453    subset1 = psImageSubset(original,c/2,r/2,c/2,r/2);
    480454    if (subset1 != NULL) {
    481455        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
Note: See TracChangeset for help on using the changeset viewer.