aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-20 11:43:31 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commit36ba8dcae773eee29aafa767a5bb6a8508ff6324 (patch)
tree7fdfffcb2eb59b54b3509c380b7d39d1158e4ed8
parentb49667bfc9892e6546abfc4ead10cc0a85364957 (diff)
Add half pixel shift checkbox for CXI/HDF5 peaks
-rw-r--r--src/crystfel_gui.c1
-rw-r--r--src/gui_peaksearch.c36
2 files changed, 37 insertions, 0 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 3b762cc5..db2fc1b3 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -627,6 +627,7 @@ int main(int argc, char *argv[])
proj.peak_search_params.pk_inn = 3.0;
proj.peak_search_params.pk_mid = 4.0;
proj.peak_search_params.pk_out = 5.0;
+ proj.peak_search_params.half_pixel_shift = 1;
proj.backend = backend_local;
proj.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
diff --git a/src/gui_peaksearch.c b/src/gui_peaksearch.c
index 1fbafd14..b1204b98 100644
--- a/src/gui_peaksearch.c
+++ b/src/gui_peaksearch.c
@@ -192,6 +192,31 @@ static void peaksearch_max_res_sig(GtkWidget *entry,
}
+static void peaksearch_half_pixel_sig(GtkWidget *checkbox,
+ struct crystfelproject *proj)
+{
+ int val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox));
+ proj->peak_search_params.half_pixel_shift = val;
+ update_peaks(proj);
+}
+
+
+static void add_check_param(GtkWidget *params_box, const char *labeltext,
+ int initial_val, GCallback act_cb,
+ struct crystfelproject *proj)
+{
+ GtkWidget *checkbox;
+
+ checkbox = gtk_check_button_new_with_label(labeltext);
+ gtk_box_pack_start(GTK_BOX(params_box),
+ GTK_WIDGET(checkbox), FALSE, FALSE, 8.0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
+ initial_val);
+ g_signal_connect(G_OBJECT(checkbox), "toggled",
+ G_CALLBACK(act_cb), proj);
+}
+
+
static void add_param(GtkWidget *params_box, const char *labeltext,
float initial_val, GCallback act_cb,
struct crystfelproject *proj)
@@ -277,10 +302,21 @@ static void peaksearch_algo_changed(GtkWidget *combo,
G_CALLBACK(peaksearch_max_res_sig), proj);
} else if ( strcmp(algo_id, "hdf5") == 0 ) {
+
proj->peak_search_params.method = PEAK_HDF5;
+ add_check_param(proj->peak_params, "Half pixel shift",
+ proj->peak_search_params.half_pixel_shift,
+ G_CALLBACK(peaksearch_half_pixel_sig), proj);
+
} else if ( strcmp(algo_id, "cxi") == 0 ) {
+
proj->peak_search_params.method = PEAK_CXI;
+
+ add_check_param(proj->peak_params, "Half pixel shift",
+ proj->peak_search_params.half_pixel_shift,
+ G_CALLBACK(peaksearch_half_pixel_sig), proj);
+
} else {
ERROR("Unrecognised peak search '%s'\n", algo_id);
}