Changeset 2832 for trunk/psModules/src/pmReadoutCombine.c
- Timestamp:
- Dec 27, 2004, 1:16:51 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmReadoutCombine.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmReadoutCombine.c
r2829 r2832 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-12-27 2 0:14:29$7 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-27 23:16:51 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 p_psDetermineNumBits(data): This routine takes an enum psStatsOptions as an 21 21 argument and returns the number of non-zero bits. 22 23 XXX: Use static vectors.24 22 *****************************************************************************/ 25 psStatsOptions p_psDetermineNumBits(psStatsOptions data)23 psStatsOptions DetermineNumBits(psStatsOptions data) 26 24 { 27 25 psS32 i; … … 38 36 } 39 37 38 /****************************************************************************** 39 p_psDetermineNumBits(data): This routine takes an enum psStatsOptions as an 40 argument and returns the number of non-zero bits. 41 42 XXX: Must add support for S16 and S32 types. F32 currently supported. 43 *****************************************************************************/ 40 44 psImage *pmReadoutCombine(psImage *output, 41 45 const psList *inputs, … … 52 56 if (zero != NULL) { 53 57 PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL); 58 // PS_VECTOR_CHECK_TYPE_S16_S32_F32(zero, NULL); 54 59 } 55 60 if (scale != NULL) { 56 61 PS_VECTOR_CHECK_TYPE(scale, PS_TYPE_F32, NULL); 62 // PS_VECTOR_CHECK_TYPE_S16_S32_F32(scale, NULL); 57 63 } 58 64 if ((zero != NULL) && (scale != NULL)) { 59 65 PS_VECTOR_CHECK_TYPE_EQUAL(zero, scale, NULL); 60 // XXX: Currently only type F32 is implemented.61 66 // PS_VECTOR_CHECK_TYPE_S16_S32_F32(scale, NULL); 62 67 } … … 75 80 psElemType outputType = PS_TYPE_F32; 76 81 77 if (1 < p_psDetermineNumBits(params->stats->options)) {82 if (1 < DetermineNumBits(params->stats->options)) { 78 83 psError(PS_ERR_UNKNOWN, true, 79 84 "Multiple statistical options have been requested.\n"); … … 92 97 // output->row0 + output->numRows 93 98 // to determine if the output image actually stores that pixel. A similar 94 // thing is done for the minimu lrow and column.99 // thing is done for the minimum row and column. 95 100 // 96 101 tmpInput = (psListElem *) inputs->head; … … 120 125 121 126 // We ensure that the zero vector is of the proper size. 122 123 127 if (zero != NULL) { 124 128 PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL); … … 166 170 167 171 if ((output->col0 > minInputCols) || (output->row0 > minInputRows)) { 168 //XXX ERROR "Output image offset is larger then input image offset.\n"); 172 psError(PS_ERR_UNKNOWN, true, 173 "Output image offset is larger then input image offset.\n"); 169 174 return(NULL); 170 175 } … … 172 177 173 178 psVector *tmpPixels = psVectorAlloc(numInputs, PS_TYPE_F32); 179 psVector *tmpPixelErrors = psVectorAlloc(numInputs, PS_TYPE_F32); 174 180 psVector *tmpPixelMask = psVectorAlloc(numInputs, PS_TYPE_U8); 175 181 psVector *tmpPixelMaskNKeep = psVectorAlloc(numInputs, PS_TYPE_U8); … … 266 272 } 267 273 268 // XXX: Still waiting on clarification of the algorithm. 269 #define SOME_FUNC(X, SIGMA) ((X)) 270 if ((gain > 0.0) && (readnoise >= 0.0)) 271 { 274 if ((gain > 0.0) && (readnoise >= 0.0)) { 272 275 psF32 x; 273 276 psF32 sigma; … … 286 289 sigma = PS_SQRT_F32((readnoise*readnoise) + gain * x) / gain; 287 290 288 tmpPixels->data.F32[r]= SOME_FUNC(x, sigma); 291 tmpPixelErrors->data.F32[r] = sigma; 292 tmpPixels->data.F32[r]= x; 289 293 } 290 294 } else { … … 304 308 sigma = PS_SQRT_F32((readnoise*readnoise) + (gain * sigma)) / gain; 305 309 306 tmpPixels->data.F32[r]= SOME_FUNC(x, sigma); 307 } 308 } 310 tmpPixelErrors->data.F32[r] = sigma; 311 tmpPixels->data.F32[r]= x; 312 } 313 } 314 // Calculate the specified statistic on the stack of pixels. 315 stats = psVectorStats(stats, 316 tmpPixels, 317 tmpPixelErrors, 318 tmpPixelMaskNKeep, 319 1); 309 320 } else { 310 321 if (scale != NULL) { … … 320 331 } 321 332 } 322 } 323 324 // Calculate the specified statistic on the stack of pixels. 325 stats = psVectorStats(stats, 326 tmpPixels, 327 NULL, 328 tmpPixelMaskNKeep, 329 1); 333 334 // Calculate the specified statistic on the stack of pixels. 335 stats = psVectorStats(stats, 336 tmpPixels, 337 NULL, 338 tmpPixelMaskNKeep, 339 1); 340 } 341 330 342 331 343 // Set the pixel value in the output image to the stat value. 332 344 double statValue; 333 345 if (!p_psGetStatValue(stats, &statValue)) { 334 //XXX ERROR: "Could not determine stats value.\n"346 psError(PS_ERR_UNKNOWN, true, "Could not determine stats value.\n"); 335 347 return(NULL); 336 348 } else { … … 341 353 342 354 psFree(tmpPixels); 355 psFree(tmpPixelErrors); 343 356 psFree(tmpPixelMask); 344 357 psFree(tmpPixelMaskNKeep);
Note:
See TracChangeset
for help on using the changeset viewer.
