aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2015-01-26 16:34:46 +0100
committervalerio.mariani@desy.de <vmariani@cfeld-valerio2.desy.de>2015-01-27 14:11:32 +0100
commitf82046030009a17113c4f15d5f89cfee8c8f0ce5 (patch)
treee02a98a6684f3085efadcb0c3de8b472585d5852 /src
parent32aa9fdf2cd23cd2d7f9fc6574ffec59b629a7f3 (diff)
Introduce "rigid group collections"
Diffstat (limited to 'src')
-rw-r--r--src/dw-hdfsee.c37
-rw-r--r--src/dw-hdfsee.h7
-rw-r--r--src/hdfsee.c15
3 files changed, 44 insertions, 15 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index ea15077f..287c7349 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -1208,7 +1208,8 @@ static int save_geometry_file(DisplayWindow *dw)
gtk_dialog_run(GTK_DIALOG(d));
output_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (d));
w = write_detector_geometry(dw->geom_filename, output_filename,
- dw->image->det);
+ dw->image->det, "Manually optimized with "
+ "hdfsee", 0);
if ( w != 0 ) {
ERROR("Error saving geometry!\n");
}
@@ -1261,7 +1262,7 @@ static gint displaywindow_set_calibmode(GtkWidget *d, DisplayWindow *dw)
if ( (dw->calib_mode_curr_rg == NULL)
&& (dw->calib_mode_curr_p == NULL) )
{
- dw->calib_mode_curr_rg = dw->image->det->rigid_groups[0];
+ dw->calib_mode_curr_rg = dw->rg_coll->rigid_groups[0];
dw->calib_mode_curr_p = dw->calib_mode_curr_rg->panels[0];
}
@@ -2118,8 +2119,8 @@ static int curr_rg_pointer_index(DisplayWindow *dw)
{
int r;
- for ( r=0; r<dw->image->det->n_rigid_groups; ++r) {
- if ( dw->image->det->rigid_groups[r] == dw->calib_mode_curr_rg ) {
+ for ( r=0; r<dw->rg_coll->n_rigid_groups; ++r) {
+ if ( dw->rg_coll->rigid_groups[r] == dw->calib_mode_curr_rg ) {
return r;
}
}
@@ -2146,22 +2147,22 @@ static int curr_p_pointer_index(DisplayWindow *dw)
static void select_next_group(DisplayWindow *dw, int num_rg)
{
- if ( dw->calib_mode_curr_rg == dw->image->det->rigid_groups[num_rg-1] ) {
- dw->calib_mode_curr_rg = dw->image->det->rigid_groups[0];
+ if ( dw->calib_mode_curr_rg == dw->rg_coll->rigid_groups[num_rg-1] ) {
+ dw->calib_mode_curr_rg = dw->rg_coll->rigid_groups[0];
} else {
dw->calib_mode_curr_rg =
- dw->image->det->rigid_groups[curr_rg_pointer_index(dw)+1];
+ dw->rg_coll->rigid_groups[curr_rg_pointer_index(dw)+1];
}
}
static void select_prev_group(DisplayWindow *dw, int num_rg)
{
- if ( dw->calib_mode_curr_rg == dw->image->det->rigid_groups[0] ) {
- dw->calib_mode_curr_rg = dw->image->det->rigid_groups[num_rg-1];
+ if ( dw->calib_mode_curr_rg == dw->rg_coll->rigid_groups[0] ) {
+ dw->calib_mode_curr_rg = dw->rg_coll->rigid_groups[num_rg-1];
} else {
dw->calib_mode_curr_rg =
- dw->image->det->rigid_groups[curr_rg_pointer_index(dw)-1];
+ dw->rg_coll->rigid_groups[curr_rg_pointer_index(dw)-1];
}
}
@@ -2471,6 +2472,7 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
const char *element, const char *event,
struct detector *det_geom,
struct beam_params *beam,
+ const char* rgcoll_name,
int show_rings, double *ring_radii,
int n_rings, double ring_size,
int median_filter)
@@ -2643,7 +2645,20 @@ DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE);
}
- ww = gtk_ui_manager_get_widget(dw->ui, "/ui/displaywindow/events");
+ if ( rgcoll_name != NULL ) {
+
+ dw->rg_coll = find_rigid_group_collection_by_name(dw->image->det,
+ rgcoll_name);
+
+ if ( dw->rg_coll == NULL ) {
+ ERROR("Cannot find rigid group collection: %s\n",
+ rgcoll_name);
+ return NULL;
+ }
+ }
+
+ ww = gtk_ui_manager_get_widget(dw->ui,
+ "/ui/displaywindow/events");
if ( dw->image->det == dw->simple_geom || dw->multi_event == 0) {
gtk_widget_set_sensitive(GTK_WIDGET(ww), FALSE);
diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h
index 7d3232d7..39b82250 100644
--- a/src/dw-hdfsee.h
+++ b/src/dw-hdfsee.h
@@ -121,8 +121,9 @@ typedef struct {
int n_rings;
CalibMode calib_mode;
- struct rigid_group *calib_mode_curr_rg;
- struct panel *calib_mode_curr_p;
+ struct rg_collection *rg_coll;
+ struct rigid_group *calib_mode_curr_rg;
+ struct panel *calib_mode_curr_p;
int calib_mode_show_focus;
GtkWidget *statusbar;
@@ -147,7 +148,7 @@ extern DisplayWindow *displaywindow_open(char *filename, char *geom_filename,
const char *event,
struct detector *det_geom,
struct beam_params *beam,
- int show_rings,
+ const char *rgcoll_name, int show_rings,
double *ring_radii, int n_rings,
double ring_size, int median_filter);
diff --git a/src/hdfsee.c b/src/hdfsee.c
index b9394d33..c5557c38 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -82,6 +82,8 @@ static void show_help(const char *s)
" -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)"
+" -m, --beam=<filename> Get beam parameters from <filename>.\n"
+" -o, --rigid-groups=<coll> Use rigid group collection <coll>.\n"
"\n");
}
@@ -128,6 +130,7 @@ int main(int argc, char *argv[])
char *cscale = NULL;
char *element = NULL;
char *event = NULL;
+ char *rgcoll_name = NULL;
double ring_size = 5.0;
char *reslist = NULL;
double ring_radii[128];
@@ -154,6 +157,7 @@ int main(int argc, char *argv[])
{"median-filter", 1, NULL, 3},
{"calibration-mode", 0, &config_calibmode, 1},
{"event", 1, NULL, 5},
+ {"rigid-groups", 1, NULL, 'o'},
{0, 0, NULL, 0}
};
@@ -171,7 +175,7 @@ int main(int argc, char *argv[])
gtk_init(&argc, &argv);
/* Short options */
- while ((c = getopt_long(argc, argv, "hp:b:i:c:e:g:2:r:m:",
+ while ((c = getopt_long(argc, argv, "hp:b:i:c:e:g:2:r:m:o:",
longopts, NULL)) != -1) {
char *test;
@@ -227,6 +231,10 @@ int main(int argc, char *argv[])
beam = &cbeam;
break;
+ case 'o' :
+ rgcoll_name = strdup(optarg);
+ break;
+
case 2 :
ring_size = strtod(optarg, &test);
if ( test == optarg ) {
@@ -292,6 +300,10 @@ int main(int argc, char *argv[])
return 1;
}
+ if (rgcoll_name == NULL) {
+ rgcoll_name = strdup("default");
+ }
+
if ( cscale == NULL ) cscale = strdup("colour");
if ( strcmp(cscale, "mono") == 0 ) {
colscale = SCALE_MONO;
@@ -315,6 +327,7 @@ int main(int argc, char *argv[])
config_calibmode,
colscale, element,
event, det_geom, beam,
+ rgcoll_name,
config_showrings,
ring_radii,
n_rings,