- Timestamp:
- Feb 14, 2011, 1:05:28 PM (15 years ago)
- Location:
- branches/czw_branch/20101203
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20101203
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/psphot
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/psphot/src/psphotSourceMatch.c
r30118 r30631 187 187 pmPhotObj *obj = objects->data[i]; 188 188 189 // we will find the input source with the max number of spans and reproduce that footprint 190 int nSpansMax = 0; 191 int iSpansMax = -1; 192 189 193 // mark the images for which sources have been found 190 194 psVectorInit (found, 0); … … 196 200 psAssert (index < found->n, "invalid index"); 197 201 202 if (src->peak && src->peak->footprint && src->peak->footprint->nspans > nSpansMax) { 203 nSpansMax = src->peak->footprint->nspans; 204 iSpansMax = j; 205 } 206 198 207 found->data.U8[index] = 1; 208 } 209 210 // we make a copy of the largest footprint; this will be used for all new sources associated with this object 211 pmFootprint *footprint = NULL; 212 if (iSpansMax != -1) { // copy the footprint info 213 pmSource *src = obj->sources->data[iSpansMax]; 214 psAssert(src->peak, "source does not exist?"); 215 psAssert(src->peak->footprint, "footprint does not exist"); 216 psAssert(src->peak->footprint->nspans == nSpansMax, "wrong footprint?"); 217 218 // we only care about the spans, do not worry about the image of this footprint 219 footprint = pmFootprintCopyData(src->peak->footprint, NULL); 199 220 } 200 221 … … 219 240 peak->dy = NAN; 220 241 221 // XXX assign to a footprint? 222 242 // assign to a footprint on this readout->image 243 peak->footprint = pmFootprintCopyData(footprint, readout->image); 244 245 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 246 // footprint on detections->footprints so we can free it later 247 psArrayAdd(detections->footprints, 100, peak->footprint); 248 psFree (peak->footprint); 249 223 250 // create a new source 224 251 pmSource *source = pmSourceAlloc(); … … 227 254 228 255 // add the peak 229 source->peak = p sMemIncrRefCounter(peak);256 source->peak = peak; 230 257 231 258 // allocate space for moments … … 239 266 psArrayAdd (detections->newSources, 100, source); 240 267 psFree (source); 241 psFree (peak);242 }268 } 269 psFree (footprint); 243 270 } 244 271
Note:
See TracChangeset
for help on using the changeset viewer.
