diff options
author | Thomas White <taw@physics.org> | 2017-03-24 14:48:00 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-03-24 14:48:00 +0100 |
commit | 1f613c288763a165b6e803d918f9fd8613996212 (patch) | |
tree | 957275219c6d87fe36cb3b6091e8dc90358aa0ae /src | |
parent | 48f66a24733cca076b56ef5981f79ff690f7e39c (diff) | |
parent | 425619c37c3973cd354a667a61e84ccab7d81572 (diff) |
Merge branch 'valerio/peakfinder8'
Diffstat (limited to 'src')
-rw-r--r-- | src/indexamajig.c | 87 | ||||
-rw-r--r-- | src/process_image.c | 24 | ||||
-rw-r--r-- | src/process_image.h | 11 |
3 files changed, 102 insertions, 20 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index 82a15e21..6300f7ff 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -13,6 +13,7 @@ * 2011 Richard Kirian * 2012 Lorenzo Galli * 2012 Chunhong Yoon + * 2017 Valerio Mariani <valerio.mariani@desy.de> * * This file is part of CrystFEL. * @@ -88,6 +89,7 @@ static void show_help(const char *s) " --peaks=<method> Use 'method' for finding peaks. Choose from:\n" " zaef : Use Zaefferer (2000) gradient detection.\n" " This is the default method.\n" +" peakfinder8: Use Peakfinder8 algorithm.\n" " hdf5 : Get from a table in HDF5 file.\n" " cxi : Get from CXI format HDF5 file.\n" " --hdf5-peaks=<p> Find peaks table in HDF5 file here.\n" @@ -95,23 +97,42 @@ static void show_help(const char *s) " --integration=<meth> Perform final pattern integration using <meth>.\n" "\n\n" "For more control over the process, you might need:\n\n" -" --tolerance=<tol> Set the tolerances for cell comparison.\n" -" Default: 5,5,5,1.5.\n" -" --filter-noise Apply an aggressive noise filter which sets all\n" -" 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 2<n>+1. 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" -" --min-gradient=<n> Minimum squared gradient for Zaefferer peak search.\n" -" Default: 100,000.\n" -" --min-snr=<n> Minimum signal-to-noise ratio for peaks.\n" -" Default: 5.\n" +" --tolerance=<tol> Set the tolerances for cell comparison.\n" +" Default: 5,5,5,1.5.\n" +" --filter-noise Apply an aggressive noise filter which sets all\n" +" 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 2<n>+1.\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 in both the\n" +" Zaefferer and Peakfinder8 algorithms." +" Default: 800.\n" +" --min-gradient=<n> Minimum squared gradient for Zaefferer peak\n" +" search. Default: 100,000.\n" +" --min-snr=<n> Minimum signal-to-noise ratio for peaks, with both" +" Zaefferer and Peakfinder8 algorithms.\n" +" Default: 5.\n" +" --min-pix-count=<n> Only accept peaks if they include more than <n>" +" pixels, in the Peakfinder8 algorithm." +" Default: 2.\n" +" --max-pix-count=<n> Only accept peaks if they include less than <n>" +" pixels, in the Peakfinder8 algorithm." +" Default: 200.\n" +" --local-bg-radius=<n> Radius (in pixels) to use for the estimation of\n" +" local background in the Peakfinder8 algorithm.\n" +" Default: 3.\n" +" --min-res=<n> Only accept peaks if they lay at more than <n>\n" +" pixels from the center of the detector, int the\n" +" peakfinder8 algorithm. Default: 0.\n" +" --max-res=<n> Only accept peaks if they lay at less than <n>\n" +" pixels from the center of the detector, int the\n" +" peakfinder8 algorithm. Default: 1200.\n" " --check-hdf5-snr Check SNR for peaks from --peaks=hdf5.\n" " --peak-radius=<r> Integration radii for peak search.\n" " --int-radius=<r> Set the integration radii. Default: 4,5,7.\n" @@ -212,6 +233,11 @@ int main(int argc, char *argv[]) iargs.threshold = 800.0; iargs.min_gradient = 100000.0; iargs.min_snr = 5.0; + iargs.min_pix_count = 2; + iargs.max_pix_count = 200; + iargs.min_res = 0; + iargs.max_res = 1200; + iargs.local_bg_radius = 3; iargs.check_hdf5_snr = 0; iargs.det = NULL; iargs.peaks = PEAK_ZAEF; @@ -303,6 +329,11 @@ int main(int argc, char *argv[]) {"fix-bandwidth", 1, NULL, 23}, {"fix-divergence", 1, NULL, 24}, {"felix-options", 1, NULL, 25}, + {"min-pix-count", 1, NULL, 26}, + {"max-pix-count", 1, NULL, 27}, + {"local-bg-radius", 1, NULL, 28}, + {"min-res", 1, NULL, 29}, + {"max-res", 1, NULL, 30}, {0, 0, NULL, 0} }; @@ -486,6 +517,26 @@ int main(int argc, char *argv[]) } break; + case 26: + iargs.min_pix_count = atoi(optarg); + break; + + case 27: + iargs.max_pix_count = atoi(optarg); + break; + + case 28: + iargs.local_bg_radius = atoi(optarg); + break; + + case 29: + iargs.min_res = atoi(optarg); + break; + + case 30: + iargs.max_res = atoi(optarg); + break; + case 0 : break; @@ -538,6 +589,8 @@ int main(int argc, char *argv[]) } if ( strcmp(speaks, "zaef") == 0 ) { iargs.peaks = PEAK_ZAEF; + } else if ( strcmp(speaks, "peakfinder8") == 0 ) { + iargs.peaks = PEAK_PEAKFINDER8; } else if ( strcmp(speaks, "hdf5") == 0 ) { iargs.peaks = PEAK_HDF5; } else if ( strcmp(speaks, "cxi") == 0 ) { diff --git a/src/process_image.c b/src/process_image.c index f3629e0e..e6e6d22a 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -8,7 +8,7 @@ * * Authors: * 2010-2017 Thomas White <taw@physics.org> - * 2014 Valerio Mariani + * 2014-2017 Valerio Mariani <valerio.mariani@desy.de> * * This file is part of CrystFEL. * @@ -191,6 +191,28 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, iargs->use_saturated); break; + case PEAK_PEAKFINDER8: + if ( search_peaks_peakfinder8(&image, 2048, + iargs->threshold, + iargs->min_snr, + iargs->min_pix_count, + iargs->max_pix_count, + iargs->local_bg_radius, + iargs->min_res, + iargs->max_res, + iargs->use_saturated) ) { + if ( image.event != NULL ) { + ERROR("Failed to find peaks in image %s" + "(event %s).\n", image.filename, + get_event_string(image.event)); + } else { + ERROR("Failed to find peaks in image %s.", + image.filename); + } + + } + break; + } restore_image_data(image.dp, image.det, prefilter); diff --git a/src/process_image.h b/src/process_image.h index 57be255c..bc8b31fd 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -3,12 +3,12 @@ * * The processing pipeline for one image * - * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: * 2010-2016 Thomas White <taw@physics.org> - * 2014 Valerio Mariani + * 2014-2017 Valerio Mariani <valerio.mariani@desy.de> * * This file is part of CrystFEL. * @@ -42,6 +42,7 @@ struct index_args; enum { + PEAK_PEAKFINDER8, PEAK_ZAEF, PEAK_HDF5, PEAK_CXI, @@ -72,6 +73,12 @@ struct index_args float ir_inn; float ir_mid; float ir_out; + int min_res; + int max_res; + int max_n_peaks; + int min_pix_count; + int max_pix_count; + int local_bg_radius; struct copy_hdf5_field *copyme; int integrate_saturated; int use_saturated; |