aboutsummaryrefslogtreecommitdiff
path: root/src/reproject.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-03 14:01:12 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-03 14:01:12 +0000
commit585ca628920b5eba3f6addddabcec9ca90527f19 (patch)
treea1c4d5735ed59e2af08f238e2d827c822728145f /src/reproject.c
parent80828d43d4959122c549be8e44b26815bdb61519 (diff)
UI and reprojection stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@144 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r--src/reproject.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/reproject.c b/src/reproject.c
index 38f15ff..60ff104 100644
--- a/src/reproject.c
+++ b/src/reproject.c
@@ -15,6 +15,8 @@
#include "control.h"
#include "reflections.h"
#include "utils.h"
+#include "imagedisplay.h"
+#include "displaywindow.h"
#define MAX_IMAGE_REFLECTIONS 8*1024
@@ -23,7 +25,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
ImageReflection *refl;
Reflection *reflection;
int i;
- double smax = 0.5e8;
+ double smax = 0.1e9;
double tilt, omega;
double nx, ny, nz, nxt, nyt, nzt; /* "normal" vector (and calculation intermediates) */
double kx, ky, kz; /* Electron wavevector ("normal" times 1/lambda */
@@ -188,3 +190,54 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
}
+static gint reproject_clicked(GtkWidget *widget, GdkEventButton *event, ControlContext *ctx) {
+
+ ImageReflection *refl;
+ size_t n, j;
+
+ ctx->reproject_cur_image++;
+ if ( ctx->reproject_cur_image == ctx->n_images ) ctx->reproject_cur_image = 0;
+
+ imagedisplay_clear_circles(ctx->reproject_id);
+ reflectionlist_clear_markers(ctx->reflectionlist);
+
+ refl = reproject_get_reflections(ctx->images[ctx->reproject_cur_image], &n, ctx->cell_lattice, ctx);
+ for ( j=0; j<n; j++ ) {
+ imagedisplay_mark_circle(ctx->reproject_id, refl[j].x, refl[j].y);
+ }
+
+ imagedisplay_put_data(ctx->reproject_id, ctx->images[ctx->reproject_cur_image]);
+ displaywindow_update(ctx->dw);
+
+ return 0;
+
+}
+
+void reproject_open(ControlContext *ctx) {
+
+ size_t n, j;
+ ImageReflection *refl;
+
+ if ( !ctx->cell ) {
+ printf("RP: No current cell\n");
+ return;
+ }
+
+ if ( !ctx->images ) {
+ printf("RP: No images!\n");
+ return;
+ }
+
+ ctx->cell_lattice = reflection_list_from_cell(ctx->cell);
+ ctx->reproject_cur_image = 0;
+
+ ctx->reproject_id = imagedisplay_open_with_message(ctx->images[ctx->reproject_cur_image], "Current Image", "Click to change image",
+ IMAGEDISPLAY_SHOW_CENTRE | IMAGEDISPLAY_SHOW_TILT_AXIS, G_CALLBACK(reproject_clicked), ctx);
+
+ refl = reproject_get_reflections(ctx->images[ctx->reproject_cur_image], &n, ctx->cell_lattice, ctx);
+ for ( j=0; j<n; j++ ) {
+ imagedisplay_mark_circle(ctx->reproject_id, refl[j].x, refl[j].y);
+ }
+
+}
+