aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-04 20:09:59 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:17 +0100
commit88143956bd9a15c402d171c28e64943e74c7d011 (patch)
tree9fd04aaf88ea53228fba690682ee72deff57cf3f /src/indexamajig.c
parentac61b031a819b3039b6ed3bf1dd87c6b4b56e0d5 (diff)
indexamajig: Add --image option
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 525fcfc3..1bcfaf0e 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -65,6 +65,7 @@ struct static_index_args
int peaks;
int cellr;
struct beam_params *beam;
+ const char *element;
/* Output stream */
pthread_mutex_t *output_mutex; /* Protects the output stream */
@@ -164,6 +165,9 @@ static void show_help(const char *s)
" --threshold=<n> Only accept peaks above <n> ADU. Default: 800.\n"
" --min-gradient=<n> Minimum gradient for Zaefferer peak search.\n"
" Default: 100,000.\n"
+" -e, --image=<element> Use this image from the HDF5 file.\n"
+" Example: /data/data0."
+" Default: The first one found.\n"
"\n"
"\nOptions for greater performance or verbosity:\n\n"
" --verbose Be verbose about indexing.\n"
@@ -210,11 +214,29 @@ static void process_image(void *pp, int cookie)
pargs->indexable = 0;
hdfile = hdfile_open(filename);
- if ( hdfile == NULL ) {
- return;
- } else if ( hdfile_set_first_image(hdfile, "/") ) {
- ERROR("Couldn't select path\n");
- return;
+ if ( hdfile == NULL ) return;
+
+ if ( pargs->static_args.element != NULL ) {
+
+ int r;
+ r = hdfile_set_image(hdfile, pargs->static_args.element);
+ if ( r ) {
+ ERROR("Couldn't select path '%s'\n",
+ pargs->static_args.element);
+ hdfile_close(hdfile);
+ return;
+ }
+
+ } else {
+
+ int r;
+ r = hdfile_set_first_image(hdfile, "/");
+ if ( r ) {
+ ERROR("Couldn't select first path\n");
+ hdfile_close(hdfile);
+ return;
+ }
+
}
hdf5_read(hdfile, &image, pargs->static_args.config_satcorr,
@@ -402,6 +424,7 @@ int main(int argc, char *argv[])
char prepare_filename[1024];
struct queue_args qargs;
struct beam_params *beam = NULL;
+ char *element = NULL;
double nominal_photon_energy;
/* Long options */
@@ -430,11 +453,12 @@ int main(int argc, char *argv[])
{"no-check-prefix", 0, &config_checkprefix, 0},
{"no-closer-peak", 0, &config_closer, 0},
{"insane", 0, &config_insane, 1},
+ {"image", 1, NULL, 'e'},
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hi:wp:j:x:g:t:o:b:",
+ while ((c = getopt_long(argc, argv, "hi:wp:j:x:g:t:o:b:e:",
longopts, NULL)) != -1) {
switch (c) {
@@ -495,6 +519,10 @@ int main(int argc, char *argv[])
min_gradient = strtof(optarg, NULL);
break;
+ case 'e' :
+ element = strdup(optarg);
+ break;
+
case 0 :
break;
@@ -688,6 +716,7 @@ int main(int argc, char *argv[])
qargs.static_args.output_mutex = &output_mutex;
qargs.static_args.ofh = ofh;
qargs.static_args.beam = beam;
+ qargs.static_args.element = element;
qargs.fh = fh;
qargs.prefix = prefix;
@@ -703,6 +732,7 @@ int main(int argc, char *argv[])
free(prefix);
free(det->panels);
free(det);
+ free(element);
cell_free(cell);
if ( fh != stdin ) fclose(fh);
if ( ofh != stdout ) fclose(ofh);