aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/calibrate_detector.c3
-rw-r--r--src/indexamajig.c13
-rw-r--r--src/peaks.c4
-rw-r--r--src/peaks.h2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/calibrate_detector.c b/src/calibrate_detector.c
index 0759ff6b..e5945015 100644
--- a/src/calibrate_detector.c
+++ b/src/calibrate_detector.c
@@ -103,7 +103,8 @@ static void sum_peaks(struct image *image, double *sum)
int w = image->width;
const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS;
- search_peaks(image);
+ /* FIXME: Get threshold value from command line */
+ search_peaks(image, 800.0);
for ( i=0; i<image_feature_count(image->features); i++ ) {
diff --git a/src/indexamajig.c b/src/indexamajig.c
index b8d3df88..b118593e 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -61,6 +61,7 @@ struct process_args
int config_sanity;
int config_satcorr;
int config_sa;
+ float threshold;
struct detector *det;
IndexingMethod indm;
IndexingPrivate *ipriv;
@@ -145,6 +146,7 @@ static void show_help(const char *s)
" included in the HDF5 file.\n"
" --no-sa Don't correct for the differing solid angles of\n"
" the pixels.\n"
+" --threshold=<n> Only accept peaks above <n> ADU. Default: 800.\n"
"\n"
"\nOptions for greater performance or verbosity:\n\n"
" --verbose Be verbose about indexing.\n"
@@ -325,7 +327,7 @@ static struct process_result process_image(struct process_args *pargs)
}
/* Perform 'fine' peak search */
- search_peaks(&image);
+ search_peaks(&image, pargs->threshold);
/* Get rid of noise-filtered version at this point
* - it was strictly for the purposes of peak detection. */
@@ -468,6 +470,7 @@ int main(int argc, char *argv[])
int config_sanity = 0;
int config_satcorr = 0;
int config_sa = 1;
+ float threshold = 800.0;
struct detector *det;
char *geometry = NULL;
IndexingMethod indm;
@@ -512,11 +515,12 @@ int main(int argc, char *argv[])
{"check-sanity", 0, &config_sanity, 1},
{"sat-corr", 0, &config_satcorr, 1},
{"no-sa", 0, &config_sa, 0},
+ {"threshold", 1, NULL, 't'},
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hi:wp:j:x:g:",
+ while ((c = getopt_long(argc, argv, "hi:wp:j:x:g:t:",
longopts, NULL)) != -1) {
switch (c) {
@@ -552,6 +556,10 @@ int main(int argc, char *argv[])
geometry = strdup(optarg);
break;
+ case 't' :
+ threshold = strtof(optarg, NULL);
+ break;
+
case 0 :
break;
@@ -707,6 +715,7 @@ int main(int argc, char *argv[])
pargs->indm = indm;
pargs->intensities = intensities;
pargs->gctx = gctx;
+ pargs->threshold = threshold;
pargs->id = i;
pthread_mutex_lock(&pargs->control_mutex);
pargs->done = 0;
diff --git a/src/peaks.c b/src/peaks.c
index 56a79a05..7630f965 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -266,7 +266,7 @@ int integrate_peak(struct image *image, int xp, int yp,
}
-void search_peaks(struct image *image)
+void search_peaks(struct image *image, float threshold)
{
int x, y, width, height;
float *data;
@@ -305,7 +305,7 @@ void search_peaks(struct image *image)
int r;
/* Overall threshold */
- if ( data[x+width*y] < 50 ) continue;
+ if ( data[x+width*y] < threshold ) continue;
/* Get gradients */
dx1 = data[x+width*y] - data[(x+1)+width*y];
diff --git a/src/peaks.h b/src/peaks.h
index f262a54e..c5d1fb57 100644
--- a/src/peaks.h
+++ b/src/peaks.h
@@ -19,7 +19,7 @@
#include <pthread.h>
-extern void search_peaks(struct image *image);
+extern void search_peaks(struct image *image, float threshold);
extern void dump_peaks(struct image *image, pthread_mutex_t *mutex);
extern void output_intensities(struct image *image, UnitCell *cell,
pthread_mutex_t *mutex, int polar, int sa);