Commit fbb24f22 authored by Thomas White's avatar Thomas White
Browse files

indexamajig: Get peak threshold on command line

parent 58149b59
......@@ -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++ ) {
......
......@@ -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;
......
......@@ -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];
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment