- Timestamp:
- Dec 2, 2009, 12:04:51 PM (16 years ago)
- Location:
- branches/pap/psModules/src/imcombine
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pmSubtractionEquation.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap/psModules/src/imcombine
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/eam_branches/20091201/psModules/src/imcombine merged eligible /branches/eam_branches/20091113/psModules/src/imcombine 26119-26255
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/pap/psModules/src/imcombine/pmSubtractionEquation.c
r26035 r26321 18 18 19 19 #define USE_WEIGHT // Include weight (1/variance) in equation? 20 #define USE_WINDOW // Include weight (1/variance) in equation? 20 21 21 22 … … 30 31 const psKernel *reference, // Reference image (convolution source) 31 32 const psKernel *weight, // Weight image 33 const psKernel *window, // Window image 32 34 const psArray *convolutions, // Convolutions for each kernel 33 35 const pmSubtractionKernels *kernels, // Kernels … … 76 78 #ifdef USE_WEIGHT 77 79 cc *= weight->kernel[y][x]; 80 #endif 81 #ifdef USE_WINDOW 82 if (window) { 83 cc *= window->kernel[y][x]; 84 } 78 85 #endif 79 86 sumCC += cc; … … 107 114 rc *= wtVal; 108 115 c *= wtVal; 116 #endif 117 #ifdef USE_WINDOW 118 if (window) { 119 float winVal = window->kernel[y][x]; 120 ic *= winVal; 121 rc *= winVal; 122 c *= winVal; 123 } 109 124 #endif 110 125 sumIC += ic; … … 144 159 ref *= wtVal; 145 160 one *= wtVal; 161 #endif 162 #ifdef USE_WINDOW 163 if (window) { 164 float winVal = window->kernel[y][x]; 165 rr *= winVal; 166 ir *= winVal; 167 in *= winVal; 168 ref *= winVal; 169 one *= winVal; 170 } 146 171 #endif 147 172 sumRR += rr; … … 603 628 #endif 604 629 630 // XXX visualize the set of convolved stamps 631 605 632 psImage *polyValues = p_pmSubtractionPolynomial(NULL, spatialOrder, 606 633 stamp->xNorm, stamp->yNorm); // Polynomial terms … … 620 647 case PM_SUBTRACTION_MODE_1: 621 648 status = calculateMatrixVector(stamp->matrix1, stamp->vector1, stamp->image2, stamp->image1, 622 stamp->weight, stamp ->convolutions1, kernels, polyValues,623 footprint);649 stamp->weight, stamps->window, stamp->convolutions1, kernels, 650 polyValues, footprint); 624 651 break; 625 652 case PM_SUBTRACTION_MODE_2: 626 653 status = calculateMatrixVector(stamp->matrix1, stamp->vector1, stamp->image1, stamp->image2, 627 stamp->weight, stamp ->convolutions2, kernels, polyValues,628 footprint);654 stamp->weight, stamps->window, stamp->convolutions2, kernels, 655 polyValues, footprint); 629 656 break; 630 657 case PM_SUBTRACTION_MODE_DUAL: … … 1147 1174 double devNorm = 1.0 / (double)numPixels; // Normalisation for deviations 1148 1175 int numKernels = kernels->num; // Number of kernels 1176 double norm = NAN; 1149 1177 1150 1178 psImage *polyValues = NULL; // Polynomial values 1151 1179 psKernel *residual = psKernelAlloc(-footprint, footprint, -footprint, footprint); // Residual image 1180 1181 // set up holding images for the visualization 1182 pmSubtractionVisualShowFitInit (stamps); 1152 1183 1153 1184 for (int i = 0; i < stamps->num; i++) { … … 1160 1191 // Calculate coefficients of the kernel basis functions 1161 1192 polyValues = p_pmSubtractionPolynomial(polyValues, kernels->spatialOrder, stamp->xNorm, stamp->yNorm); 1162 doublenorm = p_pmSubtractionSolutionNorm(kernels); // Normalisation1193 norm = p_pmSubtractionSolutionNorm(kernels); // Normalisation 1163 1194 double background = p_pmSubtractionSolutionBackground(kernels, polyValues);// Difference in background 1164 1195 … … 1214 1245 } 1215 1246 } 1247 1248 // XXX visualize the target, source, convolution and residual 1249 pmSubtractionVisualShowFitAddStamp (target, source, residual, background, norm, i); 1250 1216 1251 for (int y = - footprint; y <= footprint; y++) { 1217 1252 for (int x = - footprint; x <= footprint; x++) { … … 1300 1335 } 1301 1336 #endif 1302 1337 1303 1338 } 1304 1339 psFree(residual); 1305 1340 psFree(polyValues); 1306 1341 1342 psLogMsg("psModules.imcombine", PS_LOG_INFO, "normalization: %f", norm); 1343 pmSubtractionVisualShowFit(); 1344 pmSubtractionVisualPlotFit(kernels); 1345 1307 1346 return deviations; 1308 1347 }
Note:
See TracChangeset
for help on using the changeset viewer.
