Changeset 17444 for trunk/psphot/src/psphotFindDetections.c
- Timestamp:
- Apr 12, 2008, 10:07:26 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotFindDetections.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFindDetections.c
r17396 r17444 1 1 # include "psphotInternal.h" 2 2 3 // XXX let's make a better distinction between 'pass' (used for counting intput / output 4 // entries) and needing/having a PSF. In this function, we smooth the image, then search for 5 // the peaks 3 // smooth the image, search for peaks, optionally define footprints based on the peaks 6 4 pmDetections *psphotFindDetections (pmDetections *detections, pmReadout *readout, psMetadata *recipe) { 7 5 … … 27 25 28 26 // move the old peaks array (if it exists) to oldPeaks 27 // XXX generically, we should be able to call this function an arbitrary number of times 29 28 assert (detections->oldPeaks == NULL); 30 29 detections->oldPeaks = detections->peaks; 31 30 detections->peaks = NULL; 32 31 33 // if footprints are not requested, find the peaks and return them 34 if (!useFootprints) { 35 detections->peaks = psphotFindPeaks (readout, recipe, useFootprints, pass, maskVal); 36 return detections; 32 // generate the smoothed significance image 33 psImage *significance = psphotSignificanceImage (readout, recipe, pass, maskVal); 34 35 // detect the peaks in the significance image 36 detections->peaks = psphotFindPeaks (significance, readout, recipe, pass, maskVal); 37 38 // optionally merge peaks into footprints 39 if (useFootprints) { 40 psphotFindFootprints (detections, significance, readout, recipe, pass, maskVal); 37 41 } 38 42 39 // psphotFindPeaks returns a different set of objects if useFootprints is true! 40 // XXX fix this by splitting psphotFindPeaks into smooth / peaks / footprint stages? 41 psArray *footprints = psphotFindPeaks (readout, recipe, useFootprints, pass, maskVal); 42 43 int growRadius = 0; 44 if (pass == 1) { 45 growRadius = psMetadataLookupS32(NULL, recipe, "FOOTPRINT_GROW_RADIUS"); 46 } else { 47 growRadius = psMetadataLookupS32(NULL, recipe, "FOOTPRINT_GROW_RADIUS_2"); 48 } 49 50 if (growRadius > 0) { 51 psArray *tmp = pmGrowFootprintArray(footprints, growRadius); 52 psFree(footprints); 53 footprints = tmp; 54 } 55 56 if (pass == 2) { 57 // merge in old peaks; 58 const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints 59 60 psLogMsg ("psphot", PS_LOG_INFO, "merging %ld new footprints into %ld existing ones\n", footprints->n, detections->footprints->n); 61 psArray *mergedFootprints = pmMergeFootprintArrays(detections->footprints, footprints, includePeaks); 62 psFree(footprints); 63 psFree(detections->footprints); 64 detections->footprints = mergedFootprints; 65 } else { 66 detections->footprints = footprints; 67 } 68 69 psphotCullPeaks(readout->image, readout->weight, recipe, detections->footprints); 70 detections->peaks = pmFootprintArrayToPeaks(detections->footprints); 71 psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks, %ld total footprints: %f sec\n", detections->peaks->n, detections->footprints->n, psTimerMark ("psphot")); 72 43 psFree (significance); 73 44 return detections; 74 45 }
Note:
See TracChangeset
for help on using the changeset viewer.
