Changeset 24274
- Timestamp:
- May 28, 2009, 2:17:52 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
psModules/src/objects/pmFootprintArraysMerge.c (modified) (3 diffs)
-
psphot/src/psphotFindFootprints.c (modified) (1 diff)
-
psphot/src/psphotReadoutMinimal.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmFootprintArraysMerge.c
r20937 r24274 28 28 */ 29 29 psArray *pmFootprintArraysMerge(const psArray *footprints1, // one set of footprints 30 const psArray *footprints2, // the other set 31 const int includePeaks) { // which peaks to set? 0x1 => footprints1, 0x2 => 2 32 assert (footprints1->n == 0 || pmFootprintTest(footprints1->data[0])); 33 assert (footprints2->n == 0 || pmFootprintTest(footprints2->data[0])); 30 const psArray *footprints2, // the other set 31 const int includePeaks // which peaks to set? 0x1 => footprints1, 0x2 => 2 32 ) 33 { 34 if (!footprints1 && !footprints2) { 35 // No footprints in merged array 36 return psArrayAllocEmpty(0); 37 } 34 38 35 if (footprints1->n == 0 || footprints2->n == 0) { // nothing to do but put copies on merged36 const psArray *old = (footprints1->n == 0) ? footprints2 : footprints1;39 assert(!footprints1 || footprints1->n == 0 || pmFootprintTest(footprints1->data[0])); 40 assert(!footprints2 || footprints2->n == 0 || pmFootprintTest(footprints2->data[0])); 37 41 38 psArray *merged = psArrayAllocEmpty(old->n); 39 for (int i = 0; i < old->n; i++) { 40 psArrayAdd(merged, 1, old->data[i]); 41 } 42 43 return merged; 42 if (!footprints1 || footprints1->n == 0 || !footprints2 || footprints2->n == 0) { 43 // nothing to do but put copies on merged 44 const psArray *old = (!footprints1 || footprints1->n == 0) ? footprints2 : footprints1; 45 46 psArray *merged = psArrayAllocEmpty(old->n); 47 for (int i = 0; i < old->n; i++) { 48 psArrayAdd(merged, 1, old->data[i]); 49 } 50 51 return merged; 44 52 } 45 53 /* … … 48 56 */ 49 57 { 50 pmFootprint *fp1 = footprints1->data[0];51 pmFootprint *fp2 = footprints2->data[0];52 if (fp1->region.x0 != fp2->region.x0 ||53 fp1->region.x1 != fp2->region.x1 ||54 fp1->region.y0 != fp2->region.y0 ||55 fp1->region.y1 != fp2->region.y1) {56 psError(PS_ERR_BAD_PARAMETER_SIZE, true,57 "The two pmFootprint arrays correspnond to different-sized regions");58 return NULL;59 }58 pmFootprint *fp1 = footprints1->data[0]; 59 pmFootprint *fp2 = footprints2->data[0]; 60 if (fp1->region.x0 != fp2->region.x0 || 61 fp1->region.x1 != fp2->region.x1 || 62 fp1->region.y0 != fp2->region.y0 || 63 fp1->region.y1 != fp2->region.y1) { 64 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 65 "The two pmFootprint arrays correspnond to different-sized regions"); 66 return NULL; 67 } 60 68 } 61 69 /* … … 72 80 * Now assign the peaks appropriately. We could do this more efficiently 73 81 * using idImage (which we just freed), but this is easy and probably fast enough 74 */ 82 */ 75 83 if (includePeaks & 0x1) { 76 psArray *peaks = pmFootprintArrayToPeaks(footprints1);77 pmFootprintsAssignPeaks(merged, peaks);78 psFree(peaks);84 psArray *peaks = pmFootprintArrayToPeaks(footprints1); 85 pmFootprintsAssignPeaks(merged, peaks); 86 psFree(peaks); 79 87 } 80 88 81 89 if (includePeaks & 0x2) { 82 psArray *peaks = pmFootprintArrayToPeaks(footprints2);83 pmFootprintsAssignPeaks(merged, peaks);84 psFree(peaks);90 psArray *peaks = pmFootprintArrayToPeaks(footprints2); 91 pmFootprintsAssignPeaks(merged, peaks); 92 psFree(peaks); 85 93 } 86 94 87 95 return merged; 88 96 } -
trunk/psphot/src/psphotFindFootprints.c
r21366 r24274 59 59 60 60 psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks); 61 psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));61 psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, (detections->footprints ? detections->footprints->n : 0), psTimerMark ("psphot.footprints")); 62 62 63 63 psFree(footprints); -
trunk/psphot/src/psphotReadoutMinimal.c
r23442 r24274 46 46 47 47 // find the detections (by peak and/or footprint) in the image. 48 pmDetections *detections = psphotFindDetections (NULL, readout, recipe); 48 pmDetections *detections = pmDetectionsAlloc(); // New detections; allocated to ensure pass=2 49 detections = psphotFindDetections(detections, readout, recipe); 49 50 if (!detections) { 50 51 psLogMsg ("psphot", 3, "unable to find detections in this image");
Note:
See TracChangeset
for help on using the changeset viewer.
