IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 1, 2006, 1:12:16 PM (19 years ago)
Author:
magnier
Message:

API change: moved several arguments to a new psStats argument

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageBackground.c

    r10273 r10396  
    1313// XXX allow the user to choose the stats method?
    1414// (SAMPLE_MEAN, CLIPPED_MEAN, ROBUST_MEDIAN, FITTED_MEAN)
    15 psStats *psImageBackground(const psImage *image, const psImage *mask, psMaskType maskValue,
    16                            double fmin, double fmax, long nMax, psStatsOptions option, psRandom *rng)
     15bool psImageBackground(psStats *stats, const psImage *image, const psImage *mask, psMaskType maskValue, psRandom *rng)
    1716{
    1817    PS_ASSERT_IMAGE_NON_NULL(image, NULL);
     
    2221        PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, NULL);
    2322    }
    24     PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(fmin, 0.0, NULL);
    25     PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(fmax, 0.0, NULL);
    26     PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(fmin, 1.0, NULL);
    27     PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(fmax, 1.0, NULL);
    28     PS_ASSERT_INT_NONNEGATIVE(nMax, NULL);
     23    if (stats->options & PS_STAT_ROBUST_QUARTILE) {
     24        PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(stats->min, 0.0, NULL);
     25        PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(stats->max, 0.0, NULL);
     26        PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(stats->min, 1.0, NULL);
     27        PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(stats->max, 1.0, NULL);
     28    }
     29    PS_ASSERT_INT_NONNEGATIVE(stats->nSubsample, NULL);
    2930    PS_ASSERT_PTR_NON_NULL(rng, NULL);
    3031
     
    3435
    3536    const int Npixels = nx*ny;                // Total number of pixels
    36     const int Nsubset = (nMax == 0) ? Npixels : PS_MIN(nMax, Npixels); // Number of pixels in subset
     37    const int Nsubset = (stats->nSubsample == 0) ? Npixels : PS_MIN(stats->nSubsample, Npixels); // Number of pixels in subset
    3738
    3839    psVector *values = psVectorAllocEmpty(Nsubset, PS_TYPE_F32); // Vector containing subsample
     
    6263    values->n = n;
    6364
    64     psStats *stats = psStatsAlloc(option); // Statistics, for return
    65 
    6665    if (stats->options & PS_STAT_ROBUST_QUARTILE) {
    6766        // use simple stats code (old verions)
    6867        // XXX this hack is just for testing, drop when I am happy with the psStats version of the values
    6968
    70         int imin = fmin * n;
    71         int imax = fmax * n;
     69        int imin = stats->min * n;
     70        int imax = stats->max * n;
    7271        int npts = imax - imin + 1;
    7372
Note: See TracChangeset for help on using the changeset viewer.