diff options
author | Thomas White <taw@physics.org> | 2013-03-11 12:07:52 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2013-03-11 12:08:49 +0100 |
commit | dcfeca3dc9a38873de0d39cfcef4a80b26974352 (patch) | |
tree | ee9da8a50add5e31f2b0dbd731a28d82b75d587b /src/process_image.c | |
parent | 82ac8b4ec60e47e09f33cf925d452810d590b0a5 (diff) |
indexamajig: Add --median-filter
Diffstat (limited to 'src/process_image.c')
-rw-r--r-- | src/process_image.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/process_image.c b/src/process_image.c index 010054c8..a8eeb663 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -136,23 +136,25 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, if ( iargs->cmfilter ) filter_cm(&image); - /* Take snapshot of image after CM subtraction but before - * the aggressive noise filter. */ + /* Take snapshot of image after CM subtraction but before applying + * horrible noise filters to it */ data_size = image.width * image.height * sizeof(float); data_for_measurement = malloc(data_size); + memcpy(data_for_measurement, image.data, data_size); + + if ( iargs->median_filter > 0 ) { + filter_median(&image, iargs->median_filter); + } if ( iargs->noisefilter ) { - filter_noise(&image, data_for_measurement); - } else { - memcpy(data_for_measurement, image.data, data_size); + filter_noise(&image); } switch ( iargs->peaks ) { case PEAK_HDF5: - // Get peaks from HDF5 - if (get_peaks(&image, hdfile, - iargs->hdf5_peak_path)) { + /* Get peaks from HDF5 */ + if ( get_peaks(&image, hdfile, iargs->hdf5_peak_path) ) { ERROR("Failed to get peaks from HDF5 file.\n"); } if ( !iargs->no_revalidate ) { |