Changeset 14652 for trunk/psModules/src/objects/pmPeaks.c
- Timestamp:
- Aug 23, 2007, 2:11:02 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPeaks.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPeaks.c
r13034 r14652 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 4-26 01:20:29$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-08-24 00:11:02 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 35 35 pmPeakType type) 36 36 { 37 psTrace( __func__, 5, "---- begin ----\n");37 psTrace("psModules.objects", 5, "---- begin ----\n"); 38 38 39 39 if (peaks == NULL) { … … 67 67 psFree (peak); 68 68 69 psTrace( __func__, 5, "---- end ----\n");69 psTrace("psModules.objects", 5, "---- end ----\n"); 70 70 return(peaks); 71 71 } … … 118 118 *****************************************************************************/ 119 119 static void peakFree(pmPeak *tmp) 120 {} // used by pm IsPeak()120 {} // used by pmPeakTest() 121 121 122 122 pmPeak *pmPeakAlloc(psS32 x, … … 145 145 } 146 146 147 bool pm IsPeak(const psPtr ptr)147 bool pmPeakTest(const psPtr ptr) 148 148 { 149 149 return (psMemGetDeallocator(ptr) == (psFreeFunc)peakFree); … … 193 193 194 194 /****************************************************************************** 195 pm FindVectorPeaks(vector, threshold): Find all local peaks in the given vector195 pmPeaksInVector(vector, threshold): Find all local peaks in the given vector 196 196 above the given threshold. Returns a vector of type PS_TYPE_U32 containing 197 197 the location (x value) of all peaks. … … 203 203 Depending upon actual use, this may need to be optimized. 204 204 *****************************************************************************/ 205 psVector *pm FindVectorPeaks(const psVector *vector,206 psF32 threshold)205 psVector *pmPeaksInVector(const psVector *vector, 206 psF32 threshold) 207 207 { 208 208 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 295 295 296 296 /****************************************************************************** 297 pm FindImagePeaks(image, threshold): Find all local peaks in the given psImage297 pmPeaksInImage(image, threshold): Find all local peaks in the given psImage 298 298 above the given threshold. Returns a psArray containing location (x/y value) 299 299 of all peaks. … … 309 309 310 310 *****************************************************************************/ 311 psArray *pm FindImagePeaks(const psImage *image, psF32 threshold)311 psArray *pmPeaksInImage(const psImage *image, psF32 threshold) 312 312 { 313 313 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 327 327 row = 0; 328 328 tmpRow = getRowVectorFromImage((psImage *) image, row); 329 psVector *row1 = pm FindVectorPeaks(tmpRow, threshold);330 // pm FindVectorPeaksreturns coords in the vector, not corrected for col0329 psVector *row1 = pmPeaksInVector(tmpRow, threshold); 330 // pmPeaksInVector returns coords in the vector, not corrected for col0 331 331 332 332 for (psU32 i = 0 ; i < row1->n ; i++ ) { … … 382 382 for (row = 1 ; row < (image->numRows - 1) ; row++) { 383 383 tmpRow = getRowVectorFromImage((psImage *) image, row); 384 row1 = pm FindVectorPeaks(tmpRow, threshold);384 row1 = pmPeaksInVector(tmpRow, threshold); 385 385 386 386 // Step through all local peaks in this row. … … 461 461 row = image->numRows - 1; 462 462 tmpRow = getRowVectorFromImage((psImage *) image, row); 463 row1 = pm FindVectorPeaks(tmpRow, threshold);463 row1 = pmPeaksInVector(tmpRow, threshold); 464 464 for (psU32 i = 0 ; i < row1->n ; i++ ) { 465 465 col = row1->data.U32[i]; … … 501 501 } 502 502 503 504 /****************************************************************************** 505 psCullPeaks(peaks, maxValue, valid): eliminate peaks from the psArray that have 506 a peak value above the given maximum, or fall outside the valid region. 507 508 XXX: Should the sky value be used when comparing the maximum? 509 510 XXX: warning message if valid is NULL? 511 512 XXX: changed API to create a NEW output psArray (should change name as well) 513 514 XXX: Do we free the psList elements of those culled peaks? 515 516 XXX EAM : do we still need pmCullPeaks, or only pmPeaksSubset? 517 *****************************************************************************/ 518 psList *pmCullPeaks(psList *peaks, 519 psF32 maxValue, 520 const psRegion valid) 521 { 522 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); 523 PS_ASSERT_PTR_NON_NULL(peaks, NULL); 524 525 psListElem *tmpListElem = (psListElem *) peaks->head; 526 psS32 indexNum = 0; 527 528 // printf("pmCullPeaks(): list size is %d\n", peaks->size); 529 while (tmpListElem != NULL) { 530 pmPeak *tmpPeak = (pmPeak *) tmpListElem->data; 531 if ((tmpPeak->value > maxValue) || 532 (true == isItInThisRegion(valid, tmpPeak->x, tmpPeak->y))) { 533 psListRemoveData(peaks, (psPtr) tmpPeak); 534 } 535 536 indexNum++; 537 tmpListElem = tmpListElem->next; 538 } 539 540 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__); 541 return(peaks); 542 } 543 544 // XXX EAM: I changed this to return a new, subset array 545 // rather than alter the existing one 546 // XXX: Fix the *valid pointer. 503 // return a new array of peaks which are in the valid region and below threshold 504 // XXX this function is unused and probably could be dropped 547 505 psArray *pmPeaksSubset( 548 506 psArray *peaks, … … 555 513 psArray *output = psArrayAllocEmpty (200); 556 514 557 psTrace (" .pmObjects.pmCullPeaks", 3, "list size is %ld\n", peaks->n);515 psTrace ("psModules.objects", 3, "list size is %ld\n", peaks->n); 558 516 559 517 for (int i = 0; i < peaks->n; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
