aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/hdf5-file.c7
-rw-r--r--src/dw-hdfsee.c23
-rw-r--r--src/dw-hdfsee.h2
3 files changed, 18 insertions, 14 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 0c1ea92a..3a08884a 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -1405,8 +1405,15 @@ int hdf5_read(struct hdfile *f, struct image *image, const char *element,
}
image->data = buf;
+ if ( image->det != NULL ) {
+ ERROR("WARNING: hdf5_read() called with geometry structure.\n");
+ }
+ image->det = simple_geometry(image);
+
if ( satcorr ) debodge_saturation(f, image);
+ unpack_panels(image, image->det);
+
if ( image->beam != NULL ) {
fill_in_beam_parameters(image->beam, f, NULL, image);
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 974471f1..5580c635 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -1533,7 +1533,7 @@ static gint displaywindow_set_calibmode(GtkWidget *d, DisplayWindow *dw)
w = gtk_ui_manager_get_widget(dw->ui,
"/ui/displaywindow/tools/calibmode");
- if ( dw->image->det == dw->simple_geom ) {
+ if ( dw->simple ) {
gtk_check_menu_item_set_state(GTK_CHECK_MENU_ITEM(w), 0);
return 0;
}
@@ -2290,15 +2290,16 @@ static gint displaywindow_newhdf(GtkMenuItem *item, struct newhdf *nh)
a = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(nh->widget));
if ( !a ) return 0;
+ /* hdf5_read() will create a new simple geom, so get rid of the old
+ * one */
+ free_detector_geometry(nh->dw->image->det);
+ nh->dw->image->det = NULL;
fail = hdf5_read(nh->dw->hdfile, nh->dw->image, nh->name, 0);
if ( fail ) {
ERROR("Couldn't load image");
return 1;
}
- nh->dw->simple_geom = simple_geometry(nh->dw->image);
- nh->dw->image->det = nh->dw->simple_geom;
-
do_filters(nh->dw);
displaywindow_update(nh->dw);
return 0;
@@ -2754,7 +2755,7 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
dw->boostint = 1;
dw->motion_callback = 0;
dw->numbers_window = NULL;
- dw->simple_geom = NULL;
+ dw->simple = 0;
dw->image = NULL;
dw->show_rings = show_rings;
dw->show_peaks = 0;
@@ -2863,6 +2864,7 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
} else {
check = hdf5_read(dw->hdfile, dw->image, element, 0);
+ dw->simple = 1;
}
if ( check ) {
ERROR("Couldn't load file\n");
@@ -2873,11 +2875,6 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
dw->image->filename = strdup(filename);
- if ( dw->image->det == NULL ) {
- dw->simple_geom = simple_geometry(dw->image);
- dw->image->det = dw->simple_geom;
- }
-
/* Filters need geometry */
do_filters(dw);
@@ -2924,11 +2921,11 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
w = gtk_ui_manager_get_widget(dw->ui,
"/ui/displaywindow/view/images");
- if ( dw->image->det != dw->simple_geom ) {
+ if ( !dw->simple ) {
gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE);
}
- if ( dw->image->det == dw->simple_geom || dw->multi_event == 0) {
+ if ( dw->simple || dw->multi_event == 0) {
set_events_menu_sensitivity(dw, FALSE);
}
@@ -2952,7 +2949,7 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
g_signal_connect(GTK_OBJECT(dw->drawingarea), "key-press-event",
G_CALLBACK(displaywindow_keypress), dw);
- if ( dw->image->det == dw->simple_geom ) {
+ if ( dw->simple ) {
displaywindow_update_menus(dw, element);
}
diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h
index db6a81ce..85c82ac7 100644
--- a/src/dw-hdfsee.h
+++ b/src/dw-hdfsee.h
@@ -99,7 +99,7 @@ typedef struct {
int not_ready_yet;
- struct detector *simple_geom;
+ int simple;
struct hdfile *hdfile;
struct image *image;