diff options
Diffstat (limited to 'src/reproject.c')
-rw-r--r-- | src/reproject.c | 55 |
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); + } + +} + |