- Timestamp:
- Dec 13, 2007, 7:53:28 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20071212/ppMerge/src/ppMergeMaskByImageStats.c
r15804 r15807 15 15 #include "ppMergeMask.h" 16 16 17 // this function measures the statistics of the pixel values for a single readout (median and stdev) 18 // and identifies pixels which deviate from the median by more than MASK.SUSPECT * stdev. 17 19 18 20 // Generate a mask image consisting of pixels which are outliers from the image mean … … 65 67 view->chip, view->cell, view->readout); 66 68 float frac = options->sample / (float)(roIn->image->numCols * roIn->image->numRows); 69 70 // measure the global image stats: median and stdev 71 // XXX note that this now will accept any of several stats options 72 psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 73 stats->nSubsample = frac * image->numCols * image->numRows; 74 if (!psImageBackground(stats, NULL, image, mask, maskVal, rng) || 75 !isfinite(stats->robustMedian) || !isfinite(stats->robustUQ) || !isfinite(stats->robustLQ)) { 76 psError(PS_ERR_UNKNOWN, false, "Unable to measure image statistics.\n"); 77 psFree(stats); 78 psFree(rng); 79 return NULL; 80 } 81 psFree(rng); 82 83 float median = stats->robustMedian; // Median value 84 float stdev = stats->robustStdev; // Estimate of the standard deviation 85 psFree(stats); 86 67 87 suspect = pmMaskFlagSuspectPixels(suspect, roIn, options->maskSuspect, 68 options->combine->maskVal, frac, rng); 88 options->combine->maskVal, median, stdev); 89 90 psMetadataAddF32(roIn->analysis, PS_LIST_TAIL, "MEDIAN", 0, "median", median); 91 psMetadataAddF32(roIn->analysis, PS_LIST_TAIL, "STDEV", 0, "stdev", stdev); 69 92 } 70 93
Note:
See TracChangeset
for help on using the changeset viewer.
