diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-03 00:05:51 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-03 00:05:51 +0000 |
commit | 7fce8715762390de88450c777f2fba474bf6bf12 (patch) | |
tree | 83fa16fcb5997bb4de4cf785d880a73e482ff3d3 /src/refine.c | |
parent | cf7a9b848cfa0ec4b649f54100b6ff92e5553232 (diff) |
UI revamp
Bump version number to 1.0.7
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@217 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/refine.c')
-rw-r--r-- | src/refine.c | 108 |
1 files changed, 17 insertions, 91 deletions
diff --git a/src/refine.c b/src/refine.c index 8b6c716..25c4243 100644 --- a/src/refine.c +++ b/src/refine.c @@ -52,9 +52,6 @@ static ImageFeature *refine_fit_image(Basis *cell, ImageRecord *image, Reflectio double day = 0.0, dby = 0.0, dcy = 0.0; double dlx = 0.0, dly = 0.0, dlz = 0.0; - if ( !image->rflist ) { - image->rflist = reproject_get_reflections(image, cell_lattice); - } flist = image->features; M = gsl_matrix_alloc(3, 3); @@ -199,7 +196,7 @@ static int refine_sequence_sweep(ControlContext *ctx, double *fit, double *warp) int series_dev_n = 0; /* Ensure that ctx->cell_lattice is set up */ - reproject_lattice_changed(ctx); + reproject_cell_to_lattice(ctx); for ( i=0; i<ctx->images->n_images; i++ ) { @@ -210,8 +207,9 @@ static int refine_sequence_sweep(ControlContext *ctx, double *fit, double *warp) image = &ctx->images->images[i]; /* Fit this image and update ctx->cell_lattice, index the selected pattern */ + if ( !image->rflist ) image->rflist = reproject_get_reflections(image, ctx->cell_lattice); refine_fit_image(ctx->cell, image, ctx->cell_lattice); - reproject_lattice_changed(ctx); + reproject_cell_to_lattice(ctx); image->rflist = reproject_get_reflections(image, ctx->cell_lattice); n = 0; @@ -247,7 +245,7 @@ static int refine_sequence_sweep(ControlContext *ctx, double *fit, double *warp) } -static gint refine_dialog_sequence(GtkWidget *widget, ControlContext *ctx) { +void refine_do_stack(ControlContext *ctx) { double omega_offs; GtkWidget *window_fit; @@ -257,21 +255,16 @@ static gint refine_dialog_sequence(GtkWidget *widget, ControlContext *ctx) { GtkWidget *graph_warp; double *warp_vals; size_t idx; - ImageDisplay *id; fit_vals = malloc(401*sizeof(double)); warp_vals = malloc(401*sizeof(double)); idx = 0; - if ( !ctx->cell ) { + if ( !ctx->cell_lattice ) { displaywindow_error("No reciprocal unit cell has been found.", ctx->dw); - return 0; + return; } - /* Temporarily disable ImageDisplay stuff */ - id = ctx->reproject_id; - ctx->reproject_id = NULL; - for ( omega_offs=-2.0; omega_offs<=2.0; omega_offs+=0.01 ) { double fit, warp; @@ -285,7 +278,6 @@ static gint refine_dialog_sequence(GtkWidget *widget, ControlContext *ctx) { if ( refine_sequence_sweep(ctx, &fit, &warp) ) { printf("RF: Sequencer sweep failed\n"); - return 0; } printf("RF: omega_offs=%f, fit=%f, warp=%f\n", omega_offs, fit, warp); fit_vals[idx] = fit; @@ -298,7 +290,7 @@ static gint refine_dialog_sequence(GtkWidget *widget, ControlContext *ctx) { } - ctx->reproject_id = id; + displaywindow_update(ctx->dw); reproject_lattice_changed(ctx); window_fit = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -317,88 +309,22 @@ static gint refine_dialog_sequence(GtkWidget *widget, ControlContext *ctx) { gtk_container_add(GTK_CONTAINER(window_warp), graph_warp); gtk_widget_show_all(window_warp); - return 0; - } -static gint refine_dialog_fit_image(GtkWidget *step_button, ControlContext *ctx) { +void refine_do_image(ControlContext *ctx) { - if ( (ctx->reproject_id) && (ctx->cell_lattice) ) { - - ImageFeature *fitted; - - fitted = refine_fit_image(ctx->cell, &ctx->images->images[ctx->reproject_cur_image], ctx->cell_lattice); - - ctx->images->images[ctx->reproject_cur_image].rflist = NULL; - reproject_lattice_changed(ctx); - displaywindow_update(ctx->dw); - - if ( fitted ) { - imagedisplay_add_mark(ctx->reproject_id, fitted->x,fitted->y, IMAGEDISPLAY_MARK_CIRCLE_3, fitted->intensity); - } - - } else { - displaywindow_error("Please first open the reprojection window and select the image to fit", ctx->dw); + if ( !ctx->cell_lattice ) { + displaywindow_error("No reciprocal unit cell has been found.", ctx->dw); + return; } - - return 0; - -} - -static gint refine_dialog_response(GtkWidget *refine_window, gint response, ControlContext *ctx) { - - ctx->refine_window = NULL; - gtk_widget_destroy(refine_window); - - return 0; - -} - -void refine_open(ControlContext *ctx) { - - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *table; - GtkWidget *label; - GtkWidget *step_button; - GtkWidget *sequence_button; - - if ( ctx->refine_window ) return; - ctx->refine_window = gtk_dialog_new_with_buttons("Refine Reconstruction", GTK_WINDOW(ctx->dw->window), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); - gtk_window_set_default_size(GTK_WINDOW(ctx->refine_window), 280, -1); + ImageFeature *fitted; - vbox = gtk_vbox_new(FALSE, 0); - hbox = gtk_hbox_new(TRUE, 0); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(ctx->refine_window)->vbox), GTK_WIDGET(hbox), FALSE, TRUE, 7); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(vbox), FALSE, TRUE, 5); + fitted = refine_fit_image(ctx->cell, &ctx->images->images[ctx->dw->cur_image], ctx->cell_lattice); - table = gtk_table_new(5, 1, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 5); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(table), FALSE, TRUE, 0); - - label = gtk_label_new("Steps"); - gtk_label_set_markup(GTK_LABEL(label), "<span weight=\"bold\">Steps</span>"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 1, 2); - step_button = gtk_button_new_with_label("Refine Lattice to Fit Current Pattern"); - gtk_table_attach_defaults(GTK_TABLE(table), step_button, 1, 2, 2, 3); - g_signal_connect(G_OBJECT(step_button), "clicked", G_CALLBACK(refine_dialog_fit_image), ctx); - - label = gtk_label_new("Sequencing"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); - gtk_label_set_markup(GTK_LABEL(label), "<span weight=\"bold\">Sequencing</span>"); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 2, 4, 5); - - sequence_button = gtk_button_new_with_label("Run Sequencer"); - gtk_table_attach_defaults(GTK_TABLE(table), sequence_button, 1, 2, 5, 6); - g_signal_connect(G_OBJECT(sequence_button), "clicked", G_CALLBACK(refine_dialog_sequence), ctx); - - g_signal_connect(G_OBJECT(ctx->refine_window), "response", G_CALLBACK(refine_dialog_response), ctx); - gtk_widget_show_all(ctx->refine_window); - - + ctx->images->images[ctx->dw->cur_image].rflist = NULL; + reproject_lattice_changed(ctx); + displaywindow_update(ctx->dw); + } |