aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c10
-rw-r--r--src/process_image.c18
-rw-r--r--src/process_image.h1
3 files changed, 21 insertions, 8 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9b868b9f..27ec31fc 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -111,6 +111,10 @@ static void show_help(const char *s)
" pixels in each 3x3 region to zero if any of them\n"
" have negative values. Intensity measurement will\n"
" be performed on the image as it was before this.\n"
+" --median-filter=<n> Apply a median filter to the image data. Intensity\n"
+" measurement will be performed on the image as it\n"
+" was before this. The side length of the median\n"
+" filter box will be <n>. Default: 0 (no filter).\n"
" --no-sat-corr Don't correct values of saturated peaks using a\n"
" table included in the HDF5 file.\n"
" --threshold=<n> Only accept peaks above <n> ADU. Default: 800.\n"
@@ -183,6 +187,7 @@ int main(int argc, char *argv[])
iargs.cell = NULL;
iargs.cmfilter = 0;
iargs.noisefilter = 0;
+ iargs.median_filter = 0;
iargs.satcorr = 1;
iargs.closer = 0;
iargs.bgsub = 1;
@@ -266,6 +271,7 @@ int main(int argc, char *argv[])
{"min-integration-snr",1, NULL, 12},
{"tolerance", 1, NULL, 13},
{"int-radius", 1, NULL, 14},
+ {"median-filter", 1, NULL, 15},
{0, 0, NULL, 0}
};
@@ -386,6 +392,10 @@ int main(int argc, char *argv[])
intrad = strdup(optarg);
break;
+ case 15 :
+ iargs.median_filter = atoi(optarg);
+ break;
+
case 0 :
break;
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 ) {
diff --git a/src/process_image.h b/src/process_image.h
index f2f034d9..5fe11e33 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -46,6 +46,7 @@ struct index_args
UnitCell *cell;
int cmfilter;
int noisefilter;
+ int median_filter;
int satcorr;
int closer;
int bgsub;