Changeset 13372
- Timestamp:
- May 12, 2007, 9:51:20 AM (19 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 edited
-
pmFootprint.c (modified) (4 diffs)
-
pmFootprint.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pmFootprint.c
r13351 r13372 893 893 } 894 894 895 psImage *grownIdImage = psImageConvolveDirect(idImage, circle); 895 psImage *grownIdImage = psImageConvolveDirect(idImage, circle); // Here's the actual grow step 896 896 psFree(circle); 897 897 898 psArray *grown = pmFindFootprints(grownIdImage, 0.5, 1); 898 psArray *grown = pmFindFootprints(grownIdImage, 0.5, 1); // and here we rebuild the grown footprints 899 899 assert (grown != NULL); 900 900 psFree(idImage); psFree(grownIdImage); 901 901 /* 902 902 * Now assign the peaks appropriately. We could do this more efficiently 903 * using idImage (which we just freed), but this is easy and probably fast enough903 * using grownIdImage (which we just freed), but this is easy and probably fast enough 904 904 */ 905 905 const psArray *peaks = pmFootprintArrayToPeaks(footprints); … … 918 918 * their reference counters suitable incremented) 919 919 */ 920 psArray *pmMergeFootprintArrays(const psArray *footprints1, 921 const psArray *footprints2) { 920 psArray *pmMergeFootprintArrays(const psArray *footprints1, // one set of footprints 921 const psArray *footprints2, // the other set 922 const int includePeaks) { // which peaks to set? 0x1 => footprints1, 0x2 => 2 922 923 assert (footprints1->n == 0 || pmIsFootprint(footprints1->data[0])); 923 924 assert (footprints2->n == 0 || pmIsFootprint(footprints2->data[0])); … … 962 963 * Now assign the peaks appropriately. We could do this more efficiently 963 964 * using idImage (which we just freed), but this is easy and probably fast enough 964 */ 965 const psArray *peaks; 965 */ 966 if (includePeaks & 0x1) { 967 const psArray *peaks = pmFootprintArrayToPeaks(footprints1); 968 pmPeaksAssignToFootprints(merged, peaks); 969 psFree((psArray *)peaks); 970 } 971 972 if (includePeaks & 0x2) { 973 const psArray *peaks = pmFootprintArrayToPeaks(footprints2); 974 pmPeaksAssignToFootprints(merged, peaks); 975 psFree((psArray *)peaks); 976 } 966 977 967 peaks = pmFootprintArrayToPeaks(footprints1);968 pmPeaksAssignToFootprints(merged, peaks);969 psFree((psArray *)peaks);970 971 peaks = pmFootprintArrayToPeaks(footprints2);972 pmPeaksAssignToFootprints(merged, peaks);973 psFree((psArray *)peaks);974 975 978 return merged; 976 979 } … … 1031 1034 psFree(ids); 1032 1035 // 1033 // Make sure that peaks within each footprint are sorted 1036 // Make sure that peaks within each footprint are sorted and unique 1034 1037 // 1035 1038 for (int i = 0; i < footprints->n; i++) { 1036 1039 pmFootprint *fp = footprints->data[i]; 1037 1040 fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN); 1041 1042 for (int j = 1; j < fp->peaks->n; j++) { // check for duplicates 1043 if (fp->peaks->data[j] == fp->peaks->data[j-1]) { 1044 (void)psArrayRemoveIndex(fp->peaks, j); 1045 j--; // we moved everything down one 1046 } 1047 } 1038 1048 } 1039 1049 -
trunk/psphot/src/pmFootprint.h
r13351 r13372 36 36 37 37 psArray *pmGrowFootprintArray(const psArray *footprints, int r); 38 psArray *pmMergeFootprintArrays(const psArray *footprints1, const psArray *footprints2); 38 psArray *pmMergeFootprintArrays(const psArray *footprints1, const psArray *footprints2, 39 const int includePeaks); 39 40 40 41 psImage *pmSetFootprintArrayIDs(const psArray *footprints, const bool relativeIDs);
Note:
See TracChangeset
for help on using the changeset viewer.
