Changeset 15910 for trunk/psModules/src/detrend/pmMaskBadPixels.c
- Timestamp:
- Dec 24, 2007, 11:10:28 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmMaskBadPixels.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmMaskBadPixels.c
r15865 r15910 82 82 83 83 psImage *pmMaskFlagSuspectPixels(psImage *out, const pmReadout *readout, float rej, 84 psMaskType maskVal , float frac, psRandom *rng)84 psMaskType maskVal) 85 85 { 86 86 PS_ASSERT_PTR_NON_NULL(readout, NULL); 87 87 PS_ASSERT_FLOAT_LARGER_THAN(rej, 0.0, NULL); 88 PS_ASSERT_FLOAT_WITHIN_RANGE(frac, 0.0, 1.0, NULL);89 88 PS_ASSERT_IMAGE_NON_NULL(readout->image, NULL); 90 89 PS_ASSERT_IMAGE_NON_EMPTY(readout->image, NULL); … … 101 100 } 102 101 102 bool status; 103 103 psImage *image = readout->image; // Image of interest 104 104 psImage *mask = readout->mask; // Corresponding mask 105 105 106 if (rng) { 107 psMemIncrRefCounter(rng); 108 } else { 109 rng = psRandomAlloc(PS_RANDOM_TAUS, 0); 110 } 111 112 // XXX note that this now will accept any of several stats options 113 psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 114 stats->nSubsample = frac * image->numCols * image->numRows; 115 if (!psImageBackground(stats, NULL, image, mask, maskVal, rng) || 116 !isfinite(stats->robustMedian) || !isfinite(stats->robustUQ) || !isfinite(stats->robustLQ)) { 117 psError(PS_ERR_UNKNOWN, false, "Unable to measure image statistics.\n"); 118 psFree(stats); 119 psFree(rng); 120 return NULL; 121 } 122 psFree(rng); 123 124 float median = stats->robustMedian; // Median value 125 float stdev = stats->robustStdev; // Estimate of the standard deviation 126 psFree(stats); 106 float median = psMetadataLookupF32 (&status, readout->analysis, "READOUT.MEDIAN"); 107 if (!status) { 108 psError(PS_ERR_PROGRAMMING, true, "Missing READOUT.MEDIAN from readout analysis data"); 109 return NULL; 110 } 111 112 float stdev = psMetadataLookupF32 (&status, readout->analysis, "READOUT.STDEV"); 113 if (!status) { 114 psError(PS_ERR_PROGRAMMING, true, "Missing READOUT.STDEV from readout analysis data"); 115 return NULL; 116 } 127 117 128 118 psTrace ("psModules.detrend", 3, "suspect: %f +/- %f\n", median, stdev);
Note:
See TracChangeset
for help on using the changeset viewer.
