Changeset 10396 for trunk/psLib/src/imageops/psImageBackground.c
- Timestamp:
- Dec 1, 2006, 1:12:16 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageBackground.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageBackground.c
r10273 r10396 13 13 // XXX allow the user to choose the stats method? 14 14 // (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) 15 bool psImageBackground(psStats *stats, const psImage *image, const psImage *mask, psMaskType maskValue, psRandom *rng) 17 16 { 18 17 PS_ASSERT_IMAGE_NON_NULL(image, NULL); … … 22 21 PS_ASSERT_IMAGES_SIZE_EQUAL(mask, image, NULL); 23 22 } 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); 29 30 PS_ASSERT_PTR_NON_NULL(rng, NULL); 30 31 … … 34 35 35 36 const int Npixels = nx*ny; // Total number of pixels 36 const int Nsubset = ( nMax == 0) ? Npixels : PS_MIN(nMax, Npixels); // Number of pixels in subset37 const int Nsubset = (stats->nSubsample == 0) ? Npixels : PS_MIN(stats->nSubsample, Npixels); // Number of pixels in subset 37 38 38 39 psVector *values = psVectorAllocEmpty(Nsubset, PS_TYPE_F32); // Vector containing subsample … … 62 63 values->n = n; 63 64 64 psStats *stats = psStatsAlloc(option); // Statistics, for return65 66 65 if (stats->options & PS_STAT_ROBUST_QUARTILE) { 67 66 // use simple stats code (old verions) 68 67 // XXX this hack is just for testing, drop when I am happy with the psStats version of the values 69 68 70 int imin = fmin * n;71 int imax = fmax * n;69 int imin = stats->min * n; 70 int imax = stats->max * n; 72 71 int npts = imax - imin + 1; 73 72
Note:
See TracChangeset
for help on using the changeset viewer.
