Changeset 21363 for trunk/psModules/src/imcombine/pmSubtractionMatch.c
- Timestamp:
- Feb 5, 2009, 4:31:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionMatch.c
r21247 r21363 60 60 const pmReadout *ro2, // Readout 2 61 61 const psImage *subMask, // Mask for subtraction, or NULL 62 psImage * weight, // Weightmap62 psImage *variance, // Variance map 63 63 const psRegion *region, // Region of interest, or NULL 64 64 float threshold, // Threshold for stamp finding … … 80 80 81 81 psTrace("psModules.imcombine", 3, "Extracting stamps...\n"); 82 if (!pmSubtractionStampsExtract(*stamps, ro1->image, ro2 ? ro2->image : NULL, weight, size)) {82 if (!pmSubtractionStampsExtract(*stamps, ro1->image, ro2 ? ro2->image : NULL, variance, size)) { 83 83 psError(PS_ERR_UNKNOWN, false, "Unable to extract stamps."); 84 84 return false; … … 111 111 conv1->mask = NULL; 112 112 } 113 if (conv1-> weight) {114 psFree(conv1-> weight);115 conv1-> weight= NULL;113 if (conv1->variance) { 114 psFree(conv1->variance); 115 conv1->variance = NULL; 116 116 } 117 117 } … … 126 126 conv2->mask = NULL; 127 127 } 128 if (conv2-> weight) {129 psFree(conv2-> weight);130 conv2-> weight= NULL;128 if (conv2->variance) { 129 psFree(conv2->variance); 130 conv2->variance = NULL; 131 131 } 132 132 } … … 191 191 } 192 192 193 // Where does our weightmap come from?194 // Getting the weightexactly right is not necessary --- it's just used for weighting.195 psImage * weight = NULL; // Weightimage to use196 if (ro1-> weight && ro2->weight) {197 weight = (psImage*)psBinaryOp(NULL, ro1->weight, "+", ro2->weight);198 } else if (ro1-> weight) {199 weight = psMemIncrRefCounter(ro1->weight);200 } else if (ro2-> weight) {201 weight = psMemIncrRefCounter(ro2->weight);193 // Where does our variance map come from? 194 // Getting the variance exactly right is not necessary --- it's just used for weighting. 195 psImage *variance = NULL; // Variance image to use 196 if (ro1->variance && ro2->variance) { 197 variance = (psImage*)psBinaryOp(NULL, ro1->variance, "+", ro2->variance); 198 } else if (ro1->variance) { 199 variance = psMemIncrRefCounter(ro1->variance); 200 } else if (ro2->variance) { 201 variance = psMemIncrRefCounter(ro2->variance); 202 202 } else { 203 weight= (psImage*)psBinaryOp(NULL, ro1->image, "+", ro2->image);203 variance = (psImage*)psBinaryOp(NULL, ro1->image, "+", ro2->image); 204 204 } 205 205 … … 274 274 // We get the stamps here; we will also attempt to get stamps at the first iteration, but it 275 275 // doesn't matter. 276 if (!getStamps(&stamps, ro1, ro2, subMask, weight, NULL, threshold, stampSpacing,276 if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, threshold, stampSpacing, 277 277 size, footprint, subMode)) { 278 278 goto MATCH_ERROR; … … 336 336 psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k); 337 337 338 if (!getStamps(&stamps, ro1, ro2, subMask, weight, region, threshold, stampSpacing,338 if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, threshold, stampSpacing, 339 339 size, footprint, subMode)) { 340 340 goto MATCH_ERROR; … … 439 439 psFree(subMask); 440 440 subMask = NULL; 441 psFree( weight);442 weight= NULL;443 444 if (!pmSubtractionBorder(conv1->image, conv1-> weight, conv1->mask, size, maskBad)) {441 psFree(variance); 442 variance = NULL; 443 444 if (!pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) { 445 445 psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image."); 446 446 goto MATCH_ERROR; … … 482 482 psFree(kernels); 483 483 psFree(stamps); 484 psFree( weight);484 psFree(variance); 485 485 psFree(rng); 486 486 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
