Changeset 27319 for trunk/ppStack/src/ppStackCombineFinal.c
- Timestamp:
- Mar 18, 2010, 12:01:15 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackCombineFinal.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackCombineFinal.c
r27004 r27319 15 15 16 16 bool ppStackCombineFinal(pmReadout *target, ppStackThreadData *stack, psArray *covariances, 17 ppStackOptions *options, pmConfig *config, bool safe, bool normalise )17 ppStackOptions *options, pmConfig *config, bool safe, bool normalise, bool grow) 18 18 { 19 19 psAssert(stack, "Require stack"); 20 20 psAssert(options, "Require options"); 21 21 psAssert(config, "Require configuration"); 22 23 int numCols = target->image->numCols, numRows = target->image->numRows; // Size of image 24 25 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe 26 psAssert(recipe, "We've thrown an error on this before."); 27 float poorFrac = psMetadataLookupF32(NULL, recipe, "POOR.FRACTION"); // Fraction for "poor" 28 29 // Grow the list of rejected pixels, if desired 30 psArray *reject = psArrayAlloc(options->num); // Pixels rejected for each image 31 for (int i = 0; i < options->num; i++) { 32 if (grow) { 33 reject->data[i] = pmStackRejectGrow(options->rejected->data[i], numCols, numRows, poorFrac, 34 options->regions->data[i], options->kernels->data[i]); 35 if (!reject->data[i]) { 36 psError(psErrorCodeLast(), false, "Unable to grow rejected pixels for image %d", i); 37 psFree(reject); 38 return false; 39 } 40 } else { 41 reject->data[i] = psMemIncrRefCounter(options->rejected->data[i]); 42 } 43 } 22 44 23 45 if (!target->mask) { … … 32 54 // Something went wrong 33 55 psError(psErrorCodeLast(), false, "Unable to read chunk %d", numChunk); 56 psFree(reject); 34 57 return false; 35 58 } … … 43 66 psArrayAdd(job->args, 1, target); 44 67 psArrayAdd(job->args, 1, thread); 68 psArrayAdd(job->args, 1, reject); 45 69 psArrayAdd(job->args, 1, options); 46 70 psArrayAdd(job->args, 1, config); … … 49 73 if (!psThreadJobAddPending(job)) { 50 74 psFree(job); 75 psFree(reject); 51 76 return false; 52 77 } … … 56 81 if (!psThreadPoolWait(true)) { 57 82 psError(psErrorCodeLast(), false, "Unable to do final combination."); 83 psFree(reject); 58 84 return false; 59 85 } 86 87 psFree(reject); 60 88 61 89 // Sum covariance matrices
Note:
See TracChangeset
for help on using the changeset viewer.
