IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2005, 1:44:54 PM (21 years ago)
Author:
gusciora
Message:

pmFindImagePeaks() should now work with images of 1-row, or 1-col.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/tst_pmObjects01.c

    r3717 r3723  
    1919 * abd never deallocate, no error is generated.
    2020 *
    21  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2005-04-19 22:58:48 $
     21 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-04-19 23:44:54 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    479479{
    480480    printf("-------------- Calling test_pmFindVectorPeaks on an %d-by-%d image. --------------\n", numRows, numCols);
    481     if ((numRows < 4) || (numCols < 4)) {
    482         printf("WARNING: Don't call this test with a smaller than 4-by-4 image.\n");
    483         return(true);
    484     }
     481    //    if ((numRows < 4) || (numCols < 4)) {
     482    //        printf("WARNING: Don't call this test with a smaller than 4-by-4 image.\n");
     483    //        return(true);
     484    //    }
    485485    bool testStatus = true;
    486486    psImage *inData = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     
    523523        testStatus = false;
    524524    } else {
    525         if (outData->size != 5) {
    526             printf("TEST ERROR: pmFindImagePeaks found %d peaks (should be 4)\n", outData->size);
    527             testStatus = false;
    528         }
    529 
     525        psS32 expectedNumPeaks;
     526        if ((numRows == 1) && (numCols == 1)) {
     527            expectedNumPeaks = 1;
     528        } else if ((numRows == 1) || (numCols == 1)) {
     529            expectedNumPeaks = 3;
     530        } else {
     531            expectedNumPeaks = 5;
     532        }
     533        if (outData->size != expectedNumPeaks) {
     534            printf("TEST ERROR: pmFindImagePeaks found %d peaks (should be %d)\n", outData->size, expectedNumPeaks);
     535            testStatus = false;
     536        }
     537
     538        // HEY
    530539        psListElem *tmpPeakLE = (psListElem *) outData->head;
    531540        while (tmpPeakLE != NULL) {
     
    537546                if (!(tmpPeak->class & PM_PEAK_LONE) ||
    538547                        !(tmpPeak->class & PM_PEAK_EDGE)) {
    539                     printf("TEST ERROR: peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
     548                    printf("TEST ERROR: (0) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
    540549                    testStatus = false;
    541550                }
    542551            } else if ((tmpPeak->x == numCols/2) && (tmpPeak->y == numRows/2)) {
    543552                if (!(tmpPeak->class & PM_PEAK_LONE)) {
    544                     printf("TEST ERROR: peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
     553                    printf("TEST ERROR: (1) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class);
    545554                    testStatus = false;
    546555                }
     
    599608    //    testStatus&= test_pmFindImagePeaks(5, 2);
    600609    // HEY
     610    testStatus&= test_pmFindImagePeaks(1, 1);
     611    testStatus&= test_pmFindImagePeaks(1, 8);
     612    testStatus&= test_pmFindImagePeaks(8, 1);
    601613    testStatus&= test_pmFindImagePeaks(TST02_NUM_ROWS,   TST02_NUM_COLS);
    602614    testStatus&= test_pmFindImagePeaks(2*TST02_NUM_ROWS, TST02_NUM_COLS);
Note: See TracChangeset for help on using the changeset viewer.