IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 13, 2007, 7:53:28 AM (19 years ago)
Author:
eugene
Message:

updates to get new mask api working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071212/ppMerge/src/ppMergeMaskByImageStats.c

    r15804 r15807  
    1515#include "ppMergeMask.h"
    1616
     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.
    1719
    1820// Generate a mask image consisting of pixels which are outliers from the image mean
     
    6567                            view->chip, view->cell, view->readout);
    6668                    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
    6787                    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);
    6992                }
    7093
Note: See TracChangeset for help on using the changeset viewer.