aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-16 11:31:47 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commit43a5b52f414eb6591ba8533435ae61c0a2fcd7e7 (patch)
tree3f00ccfd0ddae866b0f2967cca4dba5d2d6796f5 /src
parent6ec178c76a4298680f497b3a043ec1198d3a66b2 (diff)
Skeleton indexing and backend stuff
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.c5
-rw-r--r--src/crystfel_gui.h14
-rw-r--r--src/gui_backend_local.c44
-rw-r--r--src/gui_backend_local.h36
-rw-r--r--src/gui_index.c106
-rw-r--r--src/gui_index.h39
6 files changed, 243 insertions, 1 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index cd4ba58d..ab9ce0e2 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -46,6 +46,8 @@
#include "crystfelimageview.h"
#include "crystfel_gui.h"
#include "gui_peaksearch.h"
+#include "gui_index.h"
+#include "gui_backend_local.h"
static void show_help(const char *s)
@@ -525,7 +527,7 @@ static void add_task_buttons(GtkWidget *vbox, struct crystfelproject *proj)
add_button(vbox, "Peak detection", "edit-find",
G_CALLBACK(peaksearch_sig), proj);
add_button(vbox, "Determine unit cell", "document-page-setup",
- G_CALLBACK(NULL), proj);
+ G_CALLBACK(unitcell_sig), proj);
add_button(vbox, "Index and integrate", "system-run",
G_CALLBACK(NULL), proj);
add_button(vbox, "Merge", "applications-science",
@@ -609,6 +611,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.backend = backend_local;
proj.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(proj.window), "CrystFEL");
diff --git a/src/crystfel_gui.h b/src/crystfel_gui.h
index 7706a34a..39d37de0 100644
--- a/src/crystfel_gui.h
+++ b/src/crystfel_gui.h
@@ -29,6 +29,10 @@
#ifndef CRYSTFEL_GUI_H
#define CRYSTFEL_GUI_H
+#include <gtk/gtk.h>
+
+#include <peaks.h>
+
struct peak_params {
enum peak_search_method method;
float threshold; /* zaef, pf8 */
@@ -49,6 +53,12 @@ struct peak_params {
int half_pixel_shift; /* cxi, hdf5 */
};
+struct crystfelproject;
+
+struct crystfel_backend {
+ int (*run_unitcell)(struct crystfelproject *proj);
+};
+
struct crystfelproject {
@@ -80,6 +90,10 @@ struct crystfelproject {
GtkWidget *peak_vbox; /* Box for peak search parameter widgets */
GtkWidget *peak_params; /* Peak search parameter widgets */
struct peak_params original_params;
+
+ GtkWidget *unitcell_combo;
+
+ struct crystfel_backend *backend;
};
#endif
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c
new file mode 100644
index 00000000..4c81c35c
--- /dev/null
+++ b/src/gui_backend_local.c
@@ -0,0 +1,44 @@
+/*
+ * gui_backend_local.c
+ *
+ * GUI backend for running jobs on the local machine
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "crystfel_gui.h"
+
+static int run_unitcell(struct crystfelproject *proj)
+{
+ STATUS("run unit cell!\n");
+ return 0;
+}
+
+
+struct crystfel_backend _backend_local =
+ {
+ .run_unitcell = run_unitcell,
+ };
+
+struct crystfel_backend *backend_local = &_backend_local;
diff --git a/src/gui_backend_local.h b/src/gui_backend_local.h
new file mode 100644
index 00000000..4bb3d0b3
--- /dev/null
+++ b/src/gui_backend_local.h
@@ -0,0 +1,36 @@
+/*
+ * gui_backend_local.h
+ *
+ * GUI backend for running jobs on the local machine
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef GUI_BACKEND_LOCAL_H
+#define GUI_BACKEND_LOCAL_H
+
+#include "crystfel_gui.h"
+
+extern struct crystfel_backend *backend_local;
+
+#endif
diff --git a/src/gui_index.c b/src/gui_index.c
new file mode 100644
index 00000000..629939b8
--- /dev/null
+++ b/src/gui_index.c
@@ -0,0 +1,106 @@
+/*
+ * gui_index.c
+ *
+ * Peak search parts of GUI
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <getopt.h>
+#include <string.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms-compat.h>
+#include <assert.h>
+
+#include <datatemplate.h>
+#include <peaks.h>
+
+#include "crystfel_gui.h"
+#include "crystfelimageview.h"
+
+static void unitcell_response_sig(GtkWidget *dialog, gint resp,
+ struct crystfelproject *proj)
+{
+ gtk_widget_destroy(dialog);
+ if ( resp != GTK_RESPONSE_OK ) return;
+
+ proj->backend->run_unitcell(proj);
+}
+
+
+gint unitcell_sig(GtkWidget *widget, struct crystfelproject *proj)
+{
+ GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *combo;
+
+ dialog = gtk_dialog_new_with_buttons("Determine unit cell",
+ GTK_WINDOW(proj->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ "Cancel", GTK_RESPONSE_CANCEL,
+ "Run", GTK_RESPONSE_OK,
+ NULL);
+
+ g_signal_connect(G_OBJECT(dialog), "response",
+ G_CALLBACK(unitcell_response_sig), proj);
+
+ vbox = gtk_vbox_new(FALSE, 0.0);
+ content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ gtk_container_add(GTK_CONTAINER(content_area), vbox);
+ gtk_container_set_border_width(GTK_CONTAINER(content_area), 8);
+ proj->peak_vbox = vbox;
+
+ hbox = gtk_hbox_new(FALSE, 0.0);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 8.0);
+ label = gtk_label_new("Unit cell determination algorithm");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 2.0);
+ combo = gtk_combo_box_text_new();
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(combo), TRUE, TRUE, 2.0);
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "mosflm",
+ "MOSFLM");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "dirax",
+ "DirAx");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "asdf",
+ "ASDF");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "xds",
+ "xds");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "xgandalf",
+ "XGANDALF");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+ proj->unitcell_combo = combo;
+
+ gtk_widget_show_all(dialog);
+
+ return FALSE;
+}
diff --git a/src/gui_index.h b/src/gui_index.h
new file mode 100644
index 00000000..de228725
--- /dev/null
+++ b/src/gui_index.h
@@ -0,0 +1,39 @@
+/*
+ * gui_index.h
+ *
+ * Indexing parts of GUI
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef GUI_INDEX_H
+#define GUI_INDEX_H
+
+#include <gtk/gtk.h>
+
+#include "crystfel_gui.h"
+
+extern gint unitcell_sig(GtkWidget *widget,
+ struct crystfelproject *proj);
+
+#endif