diff options
-rw-r--r-- | src/dw-hdfsee.c | 15 | ||||
-rw-r--r-- | src/dw-hdfsee.h | 1 | ||||
-rw-r--r-- | src/hdfsee.c | 15 |
3 files changed, 25 insertions, 6 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index 5ab5a768..66421798 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -2451,7 +2451,7 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename, const char *peaks, double boost, int binning, int noisefilter, int calibmode, int colscale, - const char *element, + const char *element, const char *event, struct detector *det_geom, struct beam_params *beam, int show_rings, double *ring_radii, @@ -2496,7 +2496,6 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename, dw->calib_mode_show_focus = 1; dw->statusbar = NULL; dw->multi_event = 0; - dw->curr_event = 0; dw->ev_list = NULL; if ( geom_filename != NULL ) { dw->geom_filename = strdup(geom_filename); @@ -2546,9 +2545,15 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename, if ( dw->image->det != NULL ) { if ( dw->multi_event ) { - check = hdf5_read2(dw->hdfile, dw->image, - dw->ev_list->events[dw->curr_event], - 0); + struct event *ev; + if ( event != NULL ) { + dw->curr_event = 0; /* Probably wrong */ + ev = get_event_from_event_string(event); + } else { + dw->curr_event = 0; + ev = dw->ev_list->events[dw->curr_event]; + } + check = hdf5_read2(dw->hdfile, dw->image, ev, 0); } else { check = hdf5_read2(dw->hdfile, dw->image, NULL, 0); } diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h index b7a49462..7d3232d7 100644 --- a/src/dw-hdfsee.h +++ b/src/dw-hdfsee.h @@ -144,6 +144,7 @@ extern DisplayWindow *displaywindow_open(char *filename, char *geom_filename, int binning, int noisefilter, int calibmode, int colscale, const char *element, + const char *event, struct detector *det_geom, struct beam_params *beam, int show_rings, diff --git a/src/hdfsee.c b/src/hdfsee.c index d8799209..56f1e6f1 100644 --- a/src/hdfsee.c +++ b/src/hdfsee.c @@ -78,6 +78,7 @@ static void show_help(const char *s) " HDF5 file. Example: /data/data0.\n" " (Only used when a geometry file is not" " provided. See option -g)" +" --event=<event code> Event to show from multi-event file.\n" " -g, --geometry=<filename> Use geometry from file for display.\n" " (When this option is used, the value of\n" " of the -e parameter is ignored)" @@ -126,6 +127,7 @@ int main(int argc, char *argv[]) int colscale = SCALE_COLOUR; char *cscale = NULL; char *element = NULL; + char *event = NULL; double ring_size = 5.0; char *reslist = NULL; double ring_radii[128]; @@ -151,6 +153,7 @@ int main(int argc, char *argv[]) {"simple-rings", 1, NULL, 'r'}, {"median-filter", 1, NULL, 3}, {"calibration-mode", 0, &config_calibmode, 1}, + {"event", 1, NULL, 5}, {0, 0, NULL, 0} }; @@ -260,6 +263,10 @@ int main(int argc, char *argv[]) } break; + case 5 : + event = strdup(optarg); + break; + case 0 : break; @@ -280,6 +287,12 @@ int main(int argc, char *argv[]) return -1; } + if ( (element != NULL) && (event != NULL) ) { + ERROR("The options --event and --element are " + "mutually exclusive\n"); + return 1; + } + if ( cscale == NULL ) cscale = strdup("colour"); if ( strcmp(cscale, "mono") == 0 ) { colscale = SCALE_MONO; @@ -302,7 +315,7 @@ int main(int argc, char *argv[]) config_noisefilter, config_calibmode, colscale, element, - det_geom, beam, + event, det_geom, beam, config_showrings, ring_radii, n_rings, |