Changeset 9611
- Timestamp:
- Oct 17, 2006, 10:13:04 AM (20 years ago)
- Location:
- trunk/psModules/src/imcombine
- Files:
-
- 2 edited
-
pmReadoutCombine.c (modified) (7 diffs)
-
pmReadoutCombine.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmReadoutCombine.c
r9541 r9611 1 /** @file pmReadoutCombine.c2 *3 * This file will contain a module which will combine multiple readout images.4 *5 * @author GLG, MHPCC6 *7 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $8 * @date $Date: 2006-10-13 22:11:02 $9 *10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii11 *12 */13 14 1 #ifdef HAVE_CONFIG_H 15 2 #include <config.h> … … 27 14 #include "pmReadoutCombine.h" 28 15 29 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 30 // File-static (private) functions 31 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 32 33 // Return the statistic of interest 34 static inline double getStat(const psStats *stats, // Statistics structure 35 psStatsOptions option // Statistics option 36 ) 37 { 38 assert(stats); 39 40 switch (option) { 41 case PS_STAT_SAMPLE_MEAN: 42 return stats->sampleMean; 43 case PS_STAT_SAMPLE_MEDIAN: 44 return stats->sampleMedian; 45 case PS_STAT_SAMPLE_STDEV: 46 return stats->sampleStdev; 47 case PS_STAT_ROBUST_MEDIAN: 48 return stats->robustMedian; 49 case PS_STAT_ROBUST_STDEV: 50 return stats->robustStdev; 51 case PS_STAT_FITTED_MEAN: 52 return stats->fittedMean; 53 case PS_STAT_FITTED_STDEV: 54 return stats->fittedStdev; 55 case PS_STAT_CLIPPED_MEAN: 56 return stats->clippedMean; 57 case PS_STAT_CLIPPED_STDEV: 58 return stats->clippedStdev; 59 case PS_STAT_MAX: 60 return stats->max; 61 case PS_STAT_MIN: 62 return stats->min; 63 default: 64 psAbort(__func__, "Bad option: %x\n", option); 65 } 66 return NAN; 67 } 16 //#define SHOW_BUSY 1 // Show that the function is busy 68 17 69 18 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 82 31 params->fracHigh = 0.0; 83 32 params->iter = 1; 84 params->rej = 3.0;33 params->rej = INFINITY; 85 34 86 35 return params; … … 88 37 89 38 90 /****************************************************************************** 91 XXX: Maybe add support for S16 and S32 types. Currently, only F32 supported. 92 *****************************************************************************/ 93 bool pmReadoutCombine(pmReadout *output, 94 psArray *inputs, 95 const psVector *zero, 96 const psVector *scale, 97 pmCombineParams *params 98 ) 39 // XXX: Maybe add support for S16 and S32 types. Currently, only F32 supported. 40 bool pmReadoutCombine(pmReadout *output, const psArray *inputs, const psVector *zero, const psVector *scale, 41 const pmCombineParams *params) 99 42 { 100 43 // Check inputs 101 44 PS_ASSERT_PTR_NON_NULL(output, false); 102 PS_ASSERT_ PTR_NON_NULL(inputs, false);45 PS_ASSERT_ARRAY_NON_NULL(inputs, false); 103 46 PS_ASSERT_PTR_NON_NULL(params, false); 104 47 if (zero) { … … 307 250 for (int i = minInputRows; i < maxInputRows; i++) { 308 251 int yOut = i - output->row0; // y position on output readout 309 #if 0252 #ifdef SHOW_BUSY 310 253 311 254 if (psTraceGetLevel("psModules.imcombine") > 9) { … … 325 268 psImage *image = readout->image; // The readout image 326 269 327 #if 0 328 // This should have been taken care of already: 270 #if 0 // This should have been taken care of already: 329 271 // Check bounds 330 272 if (xIn < 0 || xIn >= image->numCols || yIn < 0 || yIn >= image->numRows) { … … 382 324 // Combination 383 325 psVectorStats(stats, pixels, weights, mask, 1); 384 outputImage[yOut][xOut] = getStat(stats, params->combine);326 outputImage[yOut][xOut] = psStatsGetValue(stats, params->combine); 385 327 if (haveWeights) { 386 float stdev = getStat(stats, combineStdev);328 float stdev = psStatsGetValue(stats, combineStdev); 387 329 outputWeight[yOut][xOut] = PS_SQR(stdev); // Variance 388 330 } 389 331 } 390 332 } 391 #if 0333 #ifdef SHOW_BUSY 392 334 if (psTraceGetLevel("psModules.imcombine") > 9) { 393 335 printf("\n"); -
trunk/psModules/src/imcombine/pmReadoutCombine.h
r7256 r9611 1 /** @file pmReadoutCombine.h 2 * 3 * This file will contain a module which will combine multiple readout images. 4 * 5 * @author GLG, MHPCC 6 * 7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-06-01 02:26:32 $ 9 * 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 * 12 */ 1 /// @file pmReadoutCombine.h 2 /// 3 /// @brief Combine multiple readouts 4 /// 5 /// @ingroup Image combination 6 /// 7 /// @author George Gusciora, MHPCC 8 /// @author Paul Price, IfA 9 /// 10 /// @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 11 /// @date $Date: 2006-10-17 20:13:04 $ 12 /// 13 /// Copyright 2004-2006 Institute for Astronomy, University of Hawaii 14 /// 15 /// 13 16 14 #if !defined(PM_READOUT_COMBINE_H)17 #ifndef PM_READOUT_COMBINE_H 15 18 #define PM_READOUT_COMBINE_H 16 17 #if HAVE_CONFIG_H18 #include <config.h>19 #endif20 19 21 20 #include <pslib.h> 22 21 #include "pmFPA.h" 23 22 24 // Combination parameters for pmReadoutCombine. These values define how the combination is performed, and 25 // should not vary by detector, so that it can be re-used for multiple combinations. 23 /// Combination parameters for pmReadoutCombine. 24 /// 25 /// These values define how the combination is performed, and should not vary by detector, so that it can be 26 /// re-used for multiple combinations. 26 27 typedef struct 27 28 { 28 psStatsOptions combine; // Statistic to use when performing the combination29 psMaskType maskVal; // Mask value30 int nKeep; // Mimimum number of pixels to keep31 float fracHigh; // Fraction of high pixels to immediately throw32 float fracLow; // Fraction of low pixels to immediately throw33 int iter; // Number of iterations for clipping (for CLIPPED_MEAN only)34 float rej; // Rejection threshould for clipping (for CLIPPED_MEAN only)29 psStatsOptions combine; ///< Statistic to use when performing the combination 30 psMaskType maskVal; ///< Mask value 31 int nKeep; ///< Mimimum number of pixels to keep 32 float fracHigh; ///< Fraction of high pixels to immediately throw 33 float fracLow; ///< Fraction of low pixels to immediately throw 34 int iter; ///< Number of iterations for clipping (for CLIPPED_MEAN only) 35 float rej; ///< Rejection threshould for clipping (for CLIPPED_MEAN only) 35 36 } 36 37 pmCombineParams; 37 38 38 // Allocator 39 pmCombineParams *pmCombineParamsAlloc(psStatsOptions statsOptions // Statistic to use for combination39 // Allocator for pmCombineParams 40 pmCombineParams *pmCombineParamsAlloc(psStatsOptions statsOptions ///< Statistic to use for combination 40 41 ); 41 42 42 // Combine multiple readouts, applying zero and scale, with optional minmax clipping43 bool pmReadoutCombine(pmReadout *output,// Output readout; altered and returned44 psArray *inputs, //Array of input readouts (F32 image and weight, U8 mask)45 const psVector *zero, // Zero corrections to subtract from input, or NULL46 const psVector *scale, // Scale corrections to divide into input, or NULL47 pmCombineParams *params //Combination parameters43 /// Combine multiple readouts, applying zero and scale, with optional minmax clipping 44 bool pmReadoutCombine(pmReadout *output,///< Output readout; altered and returned 45 const psArray *inputs, ///< Array of input readouts (F32 image and weight, U8 mask) 46 const psVector *zero, ///< Zero corrections to subtract from input, or NULL 47 const psVector *scale, ///< Scale corrections to divide into input, or NULL 48 const pmCombineParams *params ///< Combination parameters 48 49 ); 49 50
Note:
See TracChangeset
for help on using the changeset viewer.
