Changeset 7868
- Timestamp:
- Jul 11, 2006, 5:30:53 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmReadoutCombine.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmReadoutCombine.c
r7851 r7868 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-07- 08 05:35:59$7 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-07-12 03:30:53 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 176 176 } 177 177 178 // Apply scale and zero179 if (scale || zero) {180 for (int i = 0; i < inputs->n; i++) {181 pmReadout *readout = inputs->data[i]; // The particular readout182 if (zero) {183 psBinaryOp(readout->image, readout->image, "-",184 psScalarAlloc(zero->data.F32[i], PS_TYPE_F32));185 }186 if (scale) {187 float scaleFactor = 1.0 / scale->data.F32[i]; // Scaling188 psBinaryOp(readout->image, readout->image, "*", psScalarAlloc(scaleFactor, PS_TYPE_F32));189 if (haveWeights) {190 psBinaryOp(readout->weight, readout->weight, "*",191 psScalarAlloc(scaleFactor * scaleFactor, PS_TYPE_F32));192 }193 }194 }195 }196 197 178 // Update the origin 198 179 if (output->image) { … … 291 272 psMaskType maskVal = params->maskVal; // The mask value 292 273 274 #ifndef PS_NO_TRACE 275 293 276 psTrace(__func__, 3, "Iterating output: %d --> %d, %d --> %d\n", 294 277 minInputCols - output->col0, maxInputCols - output->col0, … … 302 285 } 303 286 } 287 #endif 304 288 305 289 // Dereference output products … … 311 295 } 312 296 297 psVector *invScale = NULL; // Inverse scale; pre-calculated for efficiency 298 if (scale) { 299 invScale = (psVector*)psBinaryOp(NULL, psScalarAlloc(1.0, PS_TYPE_F32), "/", (const psPtr)scale); 300 } 301 313 302 for (int i = minInputRows; i < maxInputRows; i++) { 314 303 int yOut = i - output->row0; // y position on output readout … … 329 318 int yIn = i - readout->row0; // y position on input readout 330 319 int xIn = j - readout->col0; // x position on input readout 331 332 320 psImage *image = readout->image; // The readout image 333 321 322 #if 0 323 // This should have been taken care of already: 334 324 // Check bounds 335 325 if (xIn < 0 || xIn >= image->numCols || yIn < 0 || yIn >= image->numRows) { 336 326 continue; 337 327 } 338 328 #endif 339 329 pixelsData[r] = image->data.F32[yIn][xIn]; 330 if (zero) { 331 pixelsData[r] -= zero->data.F32[r]; 332 } 333 if (scale) { 334 pixelsData[r] *= invScale->data.F32[r]; 335 } 340 336 341 337 // Check mask … … 398 394 psFree(weights); 399 395 psFree(stats); 396 psFree(invScale); 400 397 401 398 // Update the "concepts"
Note:
See TracChangeset
for help on using the changeset viewer.
