aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYaroslav Gevorkov <yaroslav.gevorkov@desy.de>2018-05-24 10:07:11 +0200
committerThomas White <taw@physics.org>2018-05-24 15:21:18 +0200
commit8f99dad3c42ab08d631b1ac02b195b33944c7240 (patch)
treee3e6c533a4babfde64b87d07ac1a44650c21f4a4 /src
parent3f8db4b1884a95f4f52e744cb1639df80208381e (diff)
Add "peakfinder9"
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c49
-rw-r--r--src/process_image.c13
-rw-r--r--src/process_image.h10
3 files changed, 69 insertions, 3 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 38d83d58..20d9faa1 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -14,6 +14,7 @@
* 2012 Lorenzo Galli
* 2012 Chunhong Yoon
* 2017 Valerio Mariani <valerio.mariani@desy.de>
+ * 2017-2018 Yaroslav Gevorkov <yaroslav.gevorkov@desy.de>
*
* This file is part of CrystFEL.
*
@@ -48,6 +49,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <float.h>
#include "utils.h"
#include "hdf5-file.h"
@@ -84,7 +86,7 @@ static void show_help(const char *s)
" --profile Show timing data for performance monitoring\n"
" --temp-dir=<path> Put the temporary folder under <path>\n"
"\nPeak search options:\n\n"
-" --peaks=<method> Peak search method (zaef,peakfinder8,hdf5,cxi)\n"
+" --peaks=<method> Peak search method (zaef,peakfinder8,peakfinder9,hdf5,cxi)\n"
" Default: zaef\n"
" --peak-radius=<r> Integration radii for peak search\n"
" --min-peaks=<n> Minimum number of peaks for indexing\n"
@@ -98,7 +100,7 @@ static void show_help(const char *s)
" --min-gradient=<n> Minimum squared gradient\n"
" (zaef only) Default: 100,000\n"
" --min-snr=<n> Minimum signal/noise ratio for peaks\n"
-" (zaef,pekafinder8 only) Default: 5\n"
+" (zaef,pekafinder8, pekafinder9 only) Default: 5\n"
" --min-pix-count=<n> Minimum number of pixels per peak\n"
" (peakfinder8 only) Default: 2\n"
" --max-pix-count=<n> Maximum number of pixels per peak\n"
@@ -109,6 +111,15 @@ static void show_help(const char *s)
" (peakfinder8 only) Default: 0\n"
" --max-res=<n> Maximum resolution for peak search (in pixels)\n"
" (peakfinder8 only) Default: 1200\n"
+" --window-radius=<n> (peakFinder9 only) defines the radius in which the "
+" local background is estimated\n"
+" --sig-fac-biggest-pix=<n> (peakFinder9 only) min snr of the biggest pixel in "
+" the peak\n"
+" --sig-fac-peak-pix=<n> (peakFinder9 only) min snr of a peak pixel\n"
+" --min-sig=<n> (peakFinder9 only) minimum standard deviation of "
+" the background\n"
+" --min-peak-over-neighbour=<n> (peakFinder9 only) just for speed. Biggest pixel"
+" in peak must be n higher than this.\n"
" --no-use-saturated Reject saturated peaks\n"
" --no-revalidate Don't re-integrate and check HDF5 peaks\n"
" --no-half-pixel-shift\n"
@@ -212,6 +223,7 @@ static void add_geom_beam_stuff_to_field_list(struct imagefile_field_list *copym
int main(int argc, char *argv[])
{
int c;
+ unsigned int tmp_enum;
char *filename = NULL;
char *outfile = NULL;
FILE *fh;
@@ -260,6 +272,12 @@ int main(int argc, char *argv[])
iargs.min_res = 0;
iargs.max_res = 1200;
iargs.local_bg_radius = 3;
+ iargs.sig_fac_biggest_pix = 7.0; /* peak finder 9 */
+ iargs.sig_fac_peak_pix = 6.0;
+ iargs.sig_fac_whole_peak = 9.0;
+ iargs.min_sig = 11.0;
+ iargs.min_peak_over_neighbour = -INFINITY;
+ iargs.window_radius = 3;
iargs.check_hdf5_snr = 0;
iargs.det = NULL;
iargs.peaks = PEAK_ZAEF;
@@ -405,6 +423,11 @@ int main(int argc, char *argv[])
{"serial-start", 1, NULL, 44},
{"felix-domega", 1, NULL, 45},
{"felix-max-internal-angle", 1, NULL, 46},
+ {"sig-fac-biggest-pix" ,1, NULL, 47},
+ {"sig-fac-peak-pix" ,1, NULL, 48},
+ {"min-sig" ,1, NULL, 49},
+ {"min-peak-over-neighbour" ,1, NULL, 50},
+ {"window-radius" ,1, NULL, 51},
{0, 0, NULL, 0}
};
@@ -504,6 +527,7 @@ int main(int argc, char *argv[])
case 11 :
iargs.min_snr = strtof(optarg, NULL);
+ iargs.sig_fac_whole_peak = iargs.min_snr;
break;
case 13 :
@@ -731,6 +755,25 @@ int main(int argc, char *argv[])
}
break;
+ case 47:
+ iargs.sig_fac_biggest_pix = strtof(optarg, NULL);
+ break;
+
+ case 48:
+ iargs.sig_fac_peak_pix = strtof(optarg, NULL);
+ break;
+
+ case 49:
+ iargs.min_sig = strtof(optarg, NULL);
+ break;
+
+ case 50:
+ iargs.min_peak_over_neighbour = strtof(optarg, NULL);
+ break;
+
+ case 51:
+ iargs.window_radius = atoi(optarg);
+
case 0 :
break;
@@ -789,6 +832,8 @@ int main(int argc, char *argv[])
iargs.peaks = PEAK_HDF5;
} else if ( strcmp(speaks, "cxi") == 0 ) {
iargs.peaks = PEAK_CXI;
+ } else if ( strcmp(speaks, "peakfinder9") == 0 ) {
+ iargs.peaks = PEAK_PEAKFINDER9;
} else {
ERROR("Unrecognised peak detection method '%s'\n", speaks);
return 1;
diff --git a/src/process_image.c b/src/process_image.c
index 4b02e694..be4fa094 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -223,6 +223,19 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
}
break;
+ case PEAK_PEAKFINDER9:
+ if ( search_peaks_peakfinder9(&image,
+ iargs->sig_fac_biggest_pix,
+ iargs->sig_fac_peak_pix,
+ iargs->sig_fac_whole_peak, iargs->min_sig,
+ iargs->min_peak_over_neighbour,
+ iargs->window_radius) )
+ {
+ ERROR("Couldn't get enough memory to perform "
+ "peakFinder9.\n");
+ }
+ break;
+
}
restore_image_data(image.dp, image.det, prefilter);
diff --git a/src/process_image.h b/src/process_image.h
index 6d170a39..2b5bd19e 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -9,6 +9,7 @@
* Authors:
* 2010-2016 Thomas White <taw@physics.org>
* 2014-2017 Valerio Mariani <valerio.mariani@desy.de>
+ * 2017-2018 Yaroslav Gevorkov <yaroslav.gevorkov@desy.de>
*
* This file is part of CrystFEL.
*
@@ -44,7 +45,8 @@ struct index_args;
enum {
- PEAK_PEAKFINDER8,
+ PEAK_PEAKFINDER9,
+ PEAK_PEAKFINDER8,
PEAK_ZAEF,
PEAK_HDF5,
PEAK_CXI,
@@ -83,6 +85,12 @@ struct index_args
int max_pix_count;
int local_bg_radius;
int min_peaks;
+ float sig_fac_biggest_pix;
+ float sig_fac_peak_pix;
+ float sig_fac_whole_peak;
+ float min_sig;
+ float min_peak_over_neighbour;
+ int window_radius;
struct imagefile_field_list *copyme;
int integrate_saturated;
int use_saturated;