Changeset 30221
- Timestamp:
- Jan 7, 2011, 2:12:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/psModules/src/objects/pmFootprintAssignPeaks.c
r29004 r30221 24 24 /* 25 25 * Given a psArray of pmFootprints and another of pmPeaks, assign the peaks to the 26 * footprints in which th atfall; if they _don't_ fall in a footprint, add a suitable26 * footprints in which they fall; if they _don't_ fall in a footprint, add a suitable 27 27 * one to the list. 28 28 */ … … 83 83 84 84 // XXX are we allowed to have peak-less footprints?? 85 if (!fp->peaks->n) continue; 85 if (fp->peaks->n == 0) continue; 86 if (fp->peaks->n == 1) continue; 86 87 87 88 fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN); 89 90 // XXX WHY am I culling duplicates? how can there be duplicates? 91 continue; 88 92 89 93 // XXX EAM : the algorithm below should be much faster than using psArrayRemove if … … 93 97 94 98 // track the number of good peaks in the footprint 95 int nGood = 1;99 int lastGood = 0; 96 100 97 101 // check for duplicates … … 100 104 // (if sorted list has A, B, A, B ...) 101 105 for (int j = 1; j < fp->peaks->n; j++) { 102 if (fp->peaks->data[j] == fp->peaks->data[ nGood]) {106 if (fp->peaks->data[j] == fp->peaks->data[lastGood]) { 103 107 // everything on the array has its own mem reference; free and drop this one 104 108 psFree (fp->peaks->data[j]); 105 109 fp->peaks->data[j] = NULL; 106 110 } else { 107 nGood ++;111 lastGood ++; 108 112 } 109 113 } 114 int nGood = lastGood + 1; 110 115 111 116 // no deleted peaks, go to next footprint
Note:
See TracChangeset
for help on using the changeset viewer.
