Changeset 2849 for trunk/psModules/src/pmSubtractBias.c
- Timestamp:
- Dec 29, 2004, 2:34:02 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmSubtractBias.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractBias.c
r2848 r2849 6 6 * @author George Gusciora, MHPCC 7 7 * 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 29 22:44:33$8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-30 00:34:02 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 159 159 { 160 160 psTrace(".psModule.pmSubtracBias.ScaleOverscanVector", 4, 161 "---- ScaleOverscanVector() begin ----\n"); 162 163 printf("HMMM: fit is %d\n", fit); 161 "---- ScaleOverscanVector() begin (%d -> %d) ----\n", overscanVector->n, n); 164 162 165 163 if (NULL == overscanVector) { … … 196 194 } 197 195 } else if (fit == PM_FIT_SPLINE) { 196 psS32 mustFreeSpline = 0; 198 197 // Fit a spline to the old overscan vector. 199 198 mySpline = (psSpline1D *) fitSpec; 199 if (mySpline == NULL) { 200 mustFreeSpline = 1; 201 } 202 // 203 // NOTE: Since the X arg in the psVectorFitSpline1D() function is NULL, 204 // splines enpoints will be from 0.0 to overscanVector->n-1. Must scale 205 // properly when doing the spline eval. 206 // 200 207 mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL); 201 208 … … 204 211 // interpolated value at that point, and set the new vector. 205 212 for (i=0;i<n;i++) { 206 x = ((float) i) * ((float) overscanVector->n) / ((float) n); 213 // Scale to [0 : overscanVector->n - 1] 214 x = ((float) i) * ((float) (overscanVector->n-1)) / ((float) n); 207 215 newVec->data.F32[i] = psSpline1DEval(mySpline, x); 208 216 } 217 if (mustFreeSpline ==1) { 218 psFree(mySpline); 219 } 220 209 221 } else { 210 222 psError(PS_ERR_UNKNOWN, true, "unknown fit type\n"); … … 226 238 { 227 239 psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4, 228 "---- ScaleOverscanVector() begin ----\n");240 "---- pmSubtractBias() begin ----\n"); 229 241 PS_READOUT_CHECK_NULL(in, NULL); 230 242 PS_READOUT_CHECK_EMPTY(in, NULL); … … 335 347 overscanVector->data.F32[i] = 0.0; 336 348 } 337 tmpRow = psVectorAlloc( (in->image)->numRows, PS_TYPE_F32);349 tmpRow = psVectorAlloc(myOverscanImage->numRows, PS_TYPE_F32); 338 350 339 351 // For each column of the input image, loop through every row, … … 378 390 overscanVector->data.F32[i] = 0.0; 379 391 } 380 tmpCol = psVectorAlloc( (in->image)->numCols, PS_TYPE_F32);392 tmpCol = psVectorAlloc(myOverscanImage->numCols, PS_TYPE_F32); 381 393 382 394 // For each row of the input image, loop through every column, … … 449 461 // image divided by numBins. 450 462 // 463 451 464 if (!((fitSpec == NULL) || (fit == PM_FIT_NONE))) { 452 465 // … … 482 495 tmpF32 = psSpline1DEval(mySpline, ((float) i) / ((float) nBin)); 483 496 } 484 485 497 for (j=0;j<(in->image)->numRows;j++) { 486 498 (in->image)->data.F32[j][i]-= tmpF32; … … 541 553 542 554 psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4, 543 "---- ScaleOverscanVector() exit ----\n");555 "---- pmSubtractBias() exit ----\n"); 544 556 545 557 if (bias != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.
