IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3625


Ignore:
Timestamp:
Apr 1, 2005, 10:47:40 AM (21 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psModules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmObjects.c

    r3576 r3625  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-03-31 00:22:49 $
     7 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-01 20:47:40 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    147147
    148148/******************************************************************************
    149 pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
     149pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
    150150above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    151151the location (x value) of all peaks.
     
    157157Depending upon actual use, this may need to be optimized.
    158158 *****************************************************************************/
    159 psVector *pmFindVectorPeeks(const psVector *vector,
     159psVector *pmFindVectorPeaks(const psVector *vector,
    160160                            psF32 threshold)
    161161{
     
    267267MyListAddPeak(): A private function which allocates a psList, if the list
    268268argument is NULL, otherwise it adds the peak to that list.
    269  *****************************************************************************/
    270 // XXX: Switch row, col args?
     269 
     270XXX: Switch row, col args?
     271 *****************************************************************************/
    271272psList *MyListAddPeak(psList *list,
    272273                      psS32 row,
     
    275276                      psPeakType type)
    276277{
    277     psPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);
     278    psPeak *tmpPeak = pmPeakAlloc(row, col, counts, type);
    278279
    279280    if (list == NULL) {
     
    287288
    288289/******************************************************************************
    289 pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
     290pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
    290291above the given threshold.  Returns a psList containing location (x/y value)
    291292of all peaks.
     
    301302     Currently, we do not.
    302303 *****************************************************************************/
    303 psList *pmFindImagePeeks(const psImage *image,
     304psList *pmFindImagePeaks(const psImage *image,
    304305                         psF32 threshold)
    305306{
     
    319320    row = 0;
    320321    tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
    321     psVector *row1 = pmFindVectorPeeks(tmpRow, threshold);
     322    psVector *row1 = pmFindVectorPeaks(tmpRow, threshold);
    322323    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    323324        col = row1->data.U32[i];
     
    355356
    356357        } else {
    357             psError(PS_ERR_UNKNOWN, true, "peak specified valid colum range.");
     358            psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");
    358359        }
    359360    }
     
    370371    for (row = 1 ; row < (image->numRows - 1) ; row++) {
    371372        tmpRow = p_psGetRowVectorFromImage((psImage *) image, 0);
    372         row1 = pmFindVectorPeeks(tmpRow, threshold);
    373 
    374         // Step through all local peask in this row.
     373        row1 = pmFindVectorPeaks(tmpRow, threshold);
     374
     375        // Step through all local peaks in this row.
    375376        for (psU32 i = 0 ; i < row1->n ; i++ ) {
     377            psPeakType myType = PM_PEAK_UNDEF;
    376378            col = row1->data.U32[i];
    377379
    378             if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
    379                     (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
    380                     (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
    381                     (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
    382                     (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
    383                     (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
    384                     (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
    385                     (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
    386                 if (image->data.F32[row][col] > threshold) {
    387 
    388                     psPeakType myType = PM_PEAK_UNDEF;
    389                     if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) &&
    390                             (image->data.F32[row][col] > image->data.F32[row-1][col]) &&
    391                             (image->data.F32[row][col] > image->data.F32[row-1][col+1]) &&
    392                             (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
    393                             (image->data.F32[row][col] > image->data.F32[row][col+1]) &&
    394                             (image->data.F32[row][col] > image->data.F32[row+1][col-1]) &&
    395                             (image->data.F32[row][col] > image->data.F32[row+1][col]) &&
    396                             (image->data.F32[row][col] > image->data.F32[row+1][col+1])) {
    397                         myType = PM_PEAK_LONE;
    398                     }
    399                     if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) ||
    400                             (image->data.F32[row][col] == image->data.F32[row-1][col]) ||
    401                             (image->data.F32[row][col] == image->data.F32[row-1][col+1]) ||
    402                             (image->data.F32[row][col] == image->data.F32[row][col-1]) ||
    403                             (image->data.F32[row][col] == image->data.F32[row][col+1]) ||
    404                             (image->data.F32[row][col] == image->data.F32[row+1][col-1]) ||
    405                             (image->data.F32[row][col] == image->data.F32[row+1][col]) ||
    406                             (image->data.F32[row][col] == image->data.F32[row+1][col+1])) {
    407                         myType = PM_PEAK_FLAT;
    408                     }
    409 
     380            if (col == 0) {
     381                // If col==0, then we can not read col-1 pixels
     382                if ((image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
     383                        (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
     384                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
     385                        (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
     386                        (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
     387                    myType = PM_PEAK_EDGE;
    410388                    list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
    411389                }
     390            } else if (col < (image->numCols - 1)) {
     391                // This is an interior pixel
     392                if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
     393                        (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
     394                        (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
     395                        (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
     396                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
     397                        (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
     398                        (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
     399                        (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
     400                    if (image->data.F32[row][col] > threshold) {
     401                        if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) &&
     402                                (image->data.F32[row][col] > image->data.F32[row-1][col]) &&
     403                                (image->data.F32[row][col] > image->data.F32[row-1][col+1]) &&
     404                                (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
     405                                (image->data.F32[row][col] > image->data.F32[row][col+1]) &&
     406                                (image->data.F32[row][col] > image->data.F32[row+1][col-1]) &&
     407                                (image->data.F32[row][col] > image->data.F32[row+1][col]) &&
     408                                (image->data.F32[row][col] > image->data.F32[row+1][col+1])) {
     409                            myType = PM_PEAK_LONE;
     410                        }
     411
     412                        if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) ||
     413                                (image->data.F32[row][col] == image->data.F32[row-1][col]) ||
     414                                (image->data.F32[row][col] == image->data.F32[row-1][col+1]) ||
     415                                (image->data.F32[row][col] == image->data.F32[row][col-1]) ||
     416                                (image->data.F32[row][col] == image->data.F32[row][col+1]) ||
     417                                (image->data.F32[row][col] == image->data.F32[row+1][col-1]) ||
     418                                (image->data.F32[row][col] == image->data.F32[row+1][col]) ||
     419                                (image->data.F32[row][col] == image->data.F32[row+1][col+1])) {
     420                            myType = PM_PEAK_FLAT;
     421                        }
     422
     423                        list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
     424                    }
     425                }
     426            } else if (col == (image->numCols - 1)) {
     427                // If col==numCols - 1, then we can not read col+1 pixels
     428                if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
     429                        (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
     430                        (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
     431                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
     432                        (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
     433                        (image->data.F32[row][col] >= image->data.F32[row+1][col])) {
     434                    myType = PM_PEAK_EDGE;
     435                    list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
     436                }
     437            } else {
     438                psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");
    412439            }
     440
    413441        }
    414442    }
     
    419447    row = image->numRows - 1;
    420448    tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
    421     row1 = pmFindVectorPeeks(tmpRow, threshold);
     449    row1 = pmFindVectorPeaks(tmpRow, threshold);
    422450    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    423451        col = row1->data.U32[i];
     
    482510XXX: warning message if valid is NULL?
    483511 *****************************************************************************/
    484 psList *pmCullPeeks(psList *peaks,
     512psList *pmCullPeaks(psList *peaks,
    485513                    psF32 maxValue,
    486514                    const psRegion *valid)
     
    492520    psS32 indexNum = 0;
    493521
    494     //    printf("pmCullPeeks(): list size is %d\n", peaks->size);
     522    //    printf("pmCullPeaks(): list size is %d\n", peaks->size);
    495523    while (tmpListElem != NULL) {
    496524        psPeak *tmpPeak = (psPeak *) tmpListElem->data;
  • trunk/psModules/src/pmObjects.h

    r3600 r3625  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-03-31 23:45:22 $
     7 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-01 20:47:40 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    110110
    111111/******************************************************************************
    112 pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
     112pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
    113113above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    114114the location (x value) of all peaks.
     
    119119
    120120/******************************************************************************
    121 pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
     121pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
    122122above the given threshold.  Returns a psList containing the location (x/y
    123123value) of all peaks.
  • trunk/psModules/test/tst_pmObjects01.c

    r3576 r3625  
    1919 * abd never deallocate, no error is generated.
    2020 *
    21  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2005-03-31 00:22:49 $
     21 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-04-01 20:47:40 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363{
    6464    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
     65    test02();
    6566}
    6667
     
    153154
    154155#define VECTOR_SIZE 10
    155 bool test_pmFindVectorPeeks(int n)
     156bool test_pmFindVectorPeaks(int n)
    156157{
    157158    bool testStatus = true;
     
    159160    psVector *outData = NULL;
    160161
    161     printf("-------------- Calling test_pmFindVectorPeeks on an %d size vector. --------------\n", n);
     162    printf("-------------- Calling test_pmFindVectorPeaks on an %d size vector. --------------\n", n);
    162163    //
    163164    // Test first pixel peak.
    164165    //
    165     printf("Test pmFindVectorPeeks() with a first-element peak.\n");
     166    printf("Test pmFindVectorPeaks() with a first-element peak.\n");
    166167    for (psS32 i = 0 ; i < n ; i++) {
    167168        inData->data.F32[i] = (float) (n-i);
     
    169170    inData->data.F32[0] = (float) n;
    170171
    171     outData= pmFindVectorPeeks(inData, 0.0);
     172    outData= pmFindVectorPeaks(inData, 0.0);
    172173    if (outData == NULL) {
    173         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     174        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    174175        testStatus = false;
    175176    } else {
     
    189190    // Test first pixel peak, large threshold
    190191    //
    191     printf("Test pmFindVectorPeeks() with a first-element peak, large threshold.\n");
     192    printf("Test pmFindVectorPeaks() with a first-element peak, large threshold.\n");
    192193    for (psS32 i = 0 ; i < n ; i++) {
    193194        inData->data.F32[i] = (float) (n-i);
     
    195196    inData->data.F32[0] = (float) n;
    196197
    197     outData= pmFindVectorPeeks(inData, (float) (n*n));
     198    outData= pmFindVectorPeaks(inData, (float) (n*n));
    198199    if (outData == NULL) {
    199         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     200        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    200201        testStatus = false;
    201202    } else {
     
    217218    // Test last pixel peak.
    218219    //
    219     printf("Test pmFindVectorPeeks() with a last-element peak.\n");
     220    printf("Test pmFindVectorPeaks() with a last-element peak.\n");
    220221    for (psS32 i = 0 ; i < n ; i++) {
    221222        inData->data.F32[i] = (float) (i);
     
    223224    inData->data.F32[n-1] = (float) n;
    224225
    225     outData= pmFindVectorPeeks(inData, 0.0);
     226    outData= pmFindVectorPeaks(inData, 0.0);
    226227    if (outData == NULL) {
    227         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     228        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    228229        testStatus = false;
    229230    } else {
     
    243244    // Test last pixel peak, large threshold.
    244245    //
    245     printf("Test pmFindVectorPeeks() with a last-element peak, large threshold.\n");
     246    printf("Test pmFindVectorPeaks() with a last-element peak, large threshold.\n");
    246247    for (psS32 i = 0 ; i < n ; i++) {
    247248        inData->data.F32[i] = (float) (i);
     
    249250    inData->data.F32[n-1] = (float) n;
    250251
    251     outData= pmFindVectorPeeks(inData, (float) (n*n));
     252    outData= pmFindVectorPeaks(inData, (float) (n*n));
    252253    if (outData == NULL) {
    253         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     254        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    254255        testStatus = false;
    255256    } else {
     
    266267    // Set all even number elements to be peaks.
    267268    //
    268     printf("Test pmFindVectorPeeks() with all even-numbered elements peak.\n");
     269    printf("Test pmFindVectorPeaks() with all even-numbered elements peak.\n");
    269270    for (psS32 i = 0 ; i < n ; i++) {
    270271        if (0 == i%2) {
     
    277278
    278279
    279     outData= pmFindVectorPeeks(inData, 0.0);
     280    outData= pmFindVectorPeaks(inData, 0.0);
    280281    if (outData == NULL) {
    281         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     282        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    282283        testStatus = false;
    283284    } else {
     
    301302    // Should generate an empty output psVector.
    302303    //
    303     printf("Test pmFindVectorPeeks() with all even-numbered elements peak, large threshold.\n");
    304     outData= pmFindVectorPeeks(inData, (float) (n*n));
     304    printf("Test pmFindVectorPeaks() with all even-numbered elements peak, large threshold.\n");
     305    outData= pmFindVectorPeaks(inData, (float) (n*n));
    305306    if (outData == NULL) {
    306         printf("TEST ERROR: pmFindVectorPeeks returned a NULL psVector.\n");
     307        printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
    307308        testStatus = false;
    308309    } else {
     
    331332
    332333    printf("----------------------------------------------------------------------------------\n");
    333     printf("Calling pmFindVectorPeeks with NULL psVector.  Should generate error and return NULL.\n");
    334     tmpVec = pmFindVectorPeeks(NULL, 0.0);
     334    printf("Calling pmFindVectorPeaks with NULL psVector.  Should generate error and return NULL.\n");
     335    tmpVec = pmFindVectorPeaks(NULL, 0.0);
    335336    if (tmpVec != NULL) {
    336         printf("TEST ERROR: pmFindVectorPeeks() returned a non-NULL psVector.\n");
     337        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
    337338        testStatus = false;
    338339        psFree(tmpVec);
     
    340341
    341342    printf("----------------------------------------------------------------------------------\n");
    342     printf("Calling pmFindVectorPeeks with empty psVector.  Should generate error and return NULL.\n");
    343     tmpVec = pmFindVectorPeeks(tmpVecEmpty, 0.0);
     343    printf("Calling pmFindVectorPeaks with empty psVector.  Should generate error and return NULL.\n");
     344    tmpVec = pmFindVectorPeaks(tmpVecEmpty, 0.0);
    344345    if (tmpVec != NULL) {
    345         printf("TEST ERROR: pmFindVectorPeeks() returned a non-NULL psVector.\n");
     346        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
    346347        testStatus = false;
    347348        psFree(tmpVec);
     
    349350
    350351    printf("----------------------------------------------------------------------------------\n");
    351     printf("Calling pmFindVectorPeeks with PS_TYPE_F64 psVector.  Should generate error and return NULL.\n");
    352     tmpVec = pmFindVectorPeeks(tmpVecF64, 0.0);
     352    printf("Calling pmFindVectorPeaks with PS_TYPE_F64 psVector.  Should generate error and return NULL.\n");
     353    tmpVec = pmFindVectorPeaks(tmpVecF64, 0.0);
    353354    if (tmpVec != NULL) {
    354         printf("TEST ERROR: pmFindVectorPeeks() returned a non-NULL psVector.\n");
     355        printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n");
    355356        testStatus = false;
    356357        psFree(tmpVec);
    357358    }
    358     testStatus&= test_pmFindVectorPeeks(1);
    359     testStatus&= test_pmFindVectorPeeks(VECTOR_SIZE);
     359    testStatus&= test_pmFindVectorPeaks(1);
     360    testStatus&= test_pmFindVectorPeaks(VECTOR_SIZE);
    360361
    361362    psFree(tmpVecF64);
     
    366367// XXX: Add tests for the PEAK_TYPE.
    367368// XXX: Add interior peaks, edge peaks, and flat peaks.
    368 bool test_pmFindImagePeeks(int numRows, int numCols)
     369bool test_pmFindImagePeaks(int numRows, int numCols)
    369370{
    370     printf("-------------- Calling test_pmFindVectorPeeks on an %d-by-%d image. --------------\n", numRows, numCols);
     371    printf("-------------- Calling test_pmFindVectorPeaks on an %d-by-%d image. --------------\n", numRows, numCols);
    371372    bool testStatus = true;
    372373    psImage *inData = psImageAlloc(numCols, numRows, PS_TYPE_F32);
     
    392393    }
    393394
    394     outData = pmFindImagePeeks(inData, 0.0);
     395    outData = pmFindImagePeaks(inData, 0.0);
    395396
    396397    if (outData == NULL) {
    397         printf("TEST ERROR: pmFindImagePeeks returned a NULL psList.\n");
     398        printf("TEST ERROR: pmFindImagePeaks returned a NULL psList.\n");
    398399        testStatus = false;
    399400    } else {
    400401        if (outData->size != 4) {
    401             printf("TEST ERROR: pmFindImagePeeks found only %d peaks (should be 4)\n", outData->size);
     402            printf("TEST ERROR: pmFindImagePeaks found only %d peaks (should be 4)\n", outData->size);
    402403            testStatus = false;
    403404        }
    404405
     406        //HEY
    405407        psListElem *tmpPeakLE = (psListElem *) outData->head;
    406408        while (tmpPeakLE != NULL) {
     
    409411                ((tmpPeak->y == 0) || (tmpPeak->y == numCols-1))) {}
    410412            else {
    411                 printf("TEST ERROR: Peak at (%d, %d)\n", tmpPeak->x, tmpPeak->y);
     413                printf("TEST ERROR: Peak at (%d, %d) (%f)\n", tmpPeak->x, tmpPeak->y, tmpPeak->counts);
    412414                testStatus = false;
    413415            }
     
    432434
    433435    printf("----------------------------------------------------------------------------------\n");
    434     printf("Calling pmFindImagePeeks with NULL psImage.  Should generate error and return NULL.\n");
    435     tmpList = pmFindImagePeeks(NULL, 0.0);
     436    printf("Calling pmFindImagePeaks with NULL psImage.  Should generate error and return NULL.\n");
     437    tmpList = pmFindImagePeaks(NULL, 0.0);
    436438    if (tmpList != NULL) {
    437         printf("TEST ERROR: pmFindImagePeeks() returned a non-NULL psImage.\n");
     439        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
    438440        testStatus = false;
    439441        psFree(tmpList);
     
    441443
    442444    printf("----------------------------------------------------------------------------------\n");
    443     printf("Calling pmFindImagePeeks with empty psImage.  Should generate error and return NULL.\n");
    444     tmpList = pmFindImagePeeks(tmpImageEmpty, 0.0);
     445    printf("Calling pmFindImagePeaks with empty psImage.  Should generate error and return NULL.\n");
     446    tmpList = pmFindImagePeaks(tmpImageEmpty, 0.0);
    445447    if (tmpList != NULL) {
    446         printf("TEST ERROR: pmFindImagePeeks() returned a non-NULL psImage.\n");
     448        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
    447449        testStatus = false;
    448450        psFree(tmpList);
     
    450452
    451453    printf("----------------------------------------------------------------------------------\n");
    452     printf("Calling pmFindImagePeeks with PS_TYPE_F64 psImage.  Should generate error and return NULL.\n");
    453     tmpList = pmFindImagePeeks(tmpImageF64, 0.0);
     454    printf("Calling pmFindImagePeaks with PS_TYPE_F64 psImage.  Should generate error and return NULL.\n");
     455    tmpList = pmFindImagePeaks(tmpImageF64, 0.0);
    454456    if (tmpList != NULL) {
    455         printf("TEST ERROR: pmFindImagePeeks() returned a non-NULL psImage.\n");
     457        printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
    456458        testStatus = false;
    457459        psFree(tmpList);
    458460    }
    459461    printf("----------------------------------------------------------------------------------\n");
    460     //    testStatus&= test_pmFindImagePeeks(1, 1);
    461     //    testStatus&= test_pmFindImagePeeks(2, 5);
    462     //    testStatus&= test_pmFindImagePeeks(5, 2);
    463     testStatus&= test_pmFindImagePeeks(10, 10);
     462    //    testStatus&= test_pmFindImagePeaks(1, 1);
     463    //    testStatus&= test_pmFindImagePeaks(2, 5);
     464    //    testStatus&= test_pmFindImagePeaks(5, 2);
     465    testStatus&= test_pmFindImagePeaks(10, 10);
    464466
    465467
     
    470472
    471473/******************************************************************************
    472 test03(): We first test pmCullPeeks() with various NULL and unallowable input
    473 parameters.  Then we generate a list of peaks and test that pmCullPeeks()
     474test03(): We first test pmCullPeaks() with various NULL and unallowable input
     475parameters.  Then we generate a list of peaks and test that pmCullPeaks()
    474476removes them correctly.
    475477 *****************************************************************************/
     
    481483
    482484    printf("----------------------------------------------------------------------------------\n");
    483     printf("Calling pmCullPeeks with NULL psList.  Should generate error and return NULL.\n");
    484     outData = pmCullPeeks(NULL, 0.0, NULL);
     485    printf("Calling pmCullPeaks with NULL psList.  Should generate error and return NULL.\n");
     486    outData = pmCullPeaks(NULL, 0.0, NULL);
    485487    if (outData != NULL) {
    486         printf("TEST ERROR: pmCulPeeks() returned a non-NULL psList.\n");
     488        printf("TEST ERROR: pmCulPeaks() returned a non-NULL psList.\n");
    487489        testStatus = false;
    488490    }
     
    512514
    513515    //
    514     // Call pmCullPeeks() with HUGE maxValue and NULL psRegion.  Should not
     516    // Call pmCullPeaks() with HUGE maxValue and NULL psRegion.  Should not
    515517    // remove any peaks.
    516518    //
    517519    printf("----------------------------------------------------------------------------------\n");
    518     printf("Calling pmCullPeeks with large maxValue and NULL psRegion.\n");
    519     outData = pmFindImagePeeks(imgData, 0.0);
    520     outData = pmCullPeeks(outData, PS_MAX_F32, NULL);
     520    printf("Calling pmCullPeaks with large maxValue and NULL psRegion.\n");
     521    outData = pmFindImagePeaks(imgData, 0.0);
     522    outData = pmCullPeaks(outData, PS_MAX_F32, NULL);
    521523
    522524    if (outData == NULL) {
    523         printf("TEST ERROR: pmCullPeeks() returned a non-NULL psList.\n");
     525        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
    524526        testStatus = false;
    525527        return(testStatus);
    526528    }
    527529    if (outData->size != numPeaksOrig) {
    528         printf("TEST ERROR (0): pmCullPeeks incorrectly removed peaks\n");
    529         printf("The pmCullPeeks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
     530        printf("TEST ERROR (0): pmCullPeaks incorrectly removed peaks\n");
     531        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
    530532        testStatus = false;
    531533    }
     
    533535
    534536    //
    535     // Call pmCullPeeks() with TINY maxValue and NULL psRegion.  Should
     537    // Call pmCullPeaks() with TINY maxValue and NULL psRegion.  Should
    536538    // remove all peaks.
    537539    //
    538540    printf("----------------------------------------------------------------------------------\n");
    539     printf("Calling pmCullPeeks with tiny maxValue and NULL psRegion.\n");
    540     outData = pmFindImagePeeks(imgData, 0.0);
    541     printf("pmFindImagePeeks found %d peaks\n", outData->size);
    542     outData = pmCullPeeks(outData, 0.0, NULL);
     541    printf("Calling pmCullPeaks with tiny maxValue and NULL psRegion.\n");
     542    outData = pmFindImagePeaks(imgData, 0.0);
     543    printf("pmFindImagePeaks found %d peaks\n", outData->size);
     544    outData = pmCullPeaks(outData, 0.0, NULL);
    543545
    544546    if (outData == NULL) {
    545         printf("TEST ERROR: pmCullPeeks() returned a non-NULL psList.\n");
     547        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
    546548        testStatus = false;
    547549        return(testStatus);
    548550    }
    549551    if (outData->size != 0) {
    550         printf("TEST ERROR (1): pmCullPeeks incorrectly removed peaks\n");
    551         printf("The pmCullPeeks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
     552        printf("TEST ERROR (1): pmCullPeaks incorrectly removed peaks\n");
     553        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
    552554        testStatus = false;
    553555    }
     
    555557
    556558    //
    557     // Call pmCullPeeks() with HUGE maxValue and disjoint psRegion.  Should
     559    // Call pmCullPeaks() with HUGE maxValue and disjoint psRegion.  Should
    558560    // not remove any peaks.
    559561    //
    560562    printf("----------------------------------------------------------------------------------\n");
    561     printf("Calling pmCullPeeks with large maxValue and disjoint psRegion.\n");
    562     outData = pmFindImagePeeks(imgData, 0.0);
    563     printf("pmFindImagePeeks found %d peaks\n", outData->size);
     563    printf("Calling pmCullPeaks with large maxValue and disjoint psRegion.\n");
     564    outData = pmFindImagePeaks(imgData, 0.0);
     565    printf("pmFindImagePeaks found %d peaks\n", outData->size);
    564566    psRegion *tmpRegion = psRegionAlloc(10000.0, 20000.0, 10000.0, 20000.0);
    565     outData = pmCullPeeks(outData, PS_MAX_F32, tmpRegion);
     567    outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
    566568
    567569    if (outData == NULL) {
    568         printf("TEST ERROR: pmCullPeeks() returned a non-NULL psList.\n");
     570        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
    569571        testStatus = false;
    570572        return(testStatus);
    571573    }
    572574    if (outData->size != numPeaksOrig) {
    573         printf("TEST ERROR (2): pmCullPeeks incorrectly removed peaks\n");
    574         printf("The pmCullPeeks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
     575        printf("TEST ERROR (2): pmCullPeaks incorrectly removed peaks\n");
     576        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
    575577        testStatus = false;
    576578    }
     
    579581
    580582    //
    581     // Call pmCullPeeks() with HUGE maxValue and non-disjoint psRegion.  Should
     583    // Call pmCullPeaks() with HUGE maxValue and non-disjoint psRegion.  Should
    582584    // remove all peaks.
    583585    //
    584586    printf("----------------------------------------------------------------------------------\n");
    585     printf("Calling pmCullPeeks with large maxValue and non-disjoint psRegion.\n");
    586     outData = pmFindImagePeeks(imgData, 0.0);
    587     printf("pmFindImagePeeks found %d peaks\n", outData->size);
     587    printf("Calling pmCullPeaks with large maxValue and non-disjoint psRegion.\n");
     588    outData = pmFindImagePeaks(imgData, 0.0);
     589    printf("pmFindImagePeaks found %d peaks\n", outData->size);
    588590    tmpRegion = psRegionAlloc(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
    589     outData = pmCullPeeks(outData, PS_MAX_F32, tmpRegion);
     591    outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
    590592
    591593    if (outData == NULL) {
    592         printf("TEST ERROR: pmCullPeeks() returned a non-NULL psList.\n");
     594        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
    593595        testStatus = false;
    594596        return(testStatus);
    595597    }
    596598    if (outData->size != 0) {
    597         printf("TEST ERROR (3): pmCullPeeks incorrectly removed peaks\n");
    598         printf("The pmCullPeeks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
     599        printf("TEST ERROR (3): pmCullPeaks incorrectly removed peaks\n");
     600        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
    599601        testStatus = false;
    600602    }
Note: See TracChangeset for help on using the changeset viewer.