From e2b3da0fdbccdab3a311962b83cea7906714f1bd Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 22 Sep 2008 14:25:05 +0100 Subject: Add autogen.sh --- autogen.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..bf85949 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +aclocal +autoconf +#libtoolize +autoheader +automake -a + -- cgit v1.2.3 From 615148ba07a651bae1e5b5abbe9db44cccf3664d Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 22 Sep 2008 15:12:26 +0100 Subject: .gitignore files --- .gitignore | 9 +++++++++ src/.gitignore | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 .gitignore create mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97650f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.h +config.log +config.status +configure +stamp-h1 diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..136096e --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,5 @@ +*.o +.deps +refinetest2d +refinetest3d +dtr -- cgit v1.2.3 From 220cb7bfd5510d076bbdf0375a2817f767c06362 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 22 Sep 2008 17:17:58 +0100 Subject: Remove 'random_plusminus()' --- src/refinetest3d.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/refinetest3d.c b/src/refinetest3d.c index 5d08e9e..090bee5 100644 --- a/src/refinetest3d.c +++ b/src/refinetest3d.c @@ -27,13 +27,6 @@ #include "displaywindow.h" #include "mrc.h" -/* Return a random number x, -max < x < +max */ -static double random_plusminus(double max) { - - return max; - -} - static int check_cell(Basis *cell, Basis *cell_real) { int fail; @@ -161,7 +154,6 @@ int main(int argc, char *argv[]) { ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9; ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9; ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9; - ctx->cell->a.x += random_plusminus(0.1e9); ctx->cell_lattice = reflection_list_from_cell(ctx->cell); ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); -- cgit v1.2.3 From 5f87e12f084748c6f0d6da091d9a3de7fa937ab5 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 22 Sep 2008 15:25:09 +0100 Subject: Comments and boilerplate in control.h --- src/control.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/control.h b/src/control.h index 4b97970..5dcbc89 100644 --- a/src/control.h +++ b/src/control.h @@ -3,7 +3,7 @@ * * Common control structure * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * @@ -76,7 +76,7 @@ typedef struct cctx_struct { struct imagelist_struct *images; /* "Output" */ - struct reflectionlist_struct *reflectionlist; /* Measured reflections (and stuff added to get displayed with them) */ + struct reflectionlist_struct *reflectionlist; /* Measured reflections */ struct dw_struct *dw; struct basis_struct *cell; /* Current estimate of the reciprocal unit cell */ struct reflectionlist_struct *cell_lattice; /* Reflections calculated from 'cell' */ -- cgit v1.2.3 From 2416ecc5cd0da4a2b32fded18cec1adf0752fceb Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 22 Sep 2008 15:24:19 +0100 Subject: Fix refinetest2d messages which referred to refinetest3d --- src/refinetest2d.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/refinetest2d.c b/src/refinetest2d.c index cdc0c8d..1c30348 100644 --- a/src/refinetest2d.c +++ b/src/refinetest2d.c @@ -44,47 +44,47 @@ static int check_cell(Basis *cell, Basis *cell_real) { fail = 0; if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", + fprintf(stderr, "refinetest2d: ax not determined correctly (got %8f, should be %8f)\n", cell->a.x/1e9, cell_real->a.x/1e9); fail = 1; } if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", + fprintf(stderr, "refinetest2d: ay not determined correctly (got %8f, should be %8f)\n", cell->a.y/1e9, cell_real->a.y/1e9); fail = 1; } // if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) { -// fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", +// fprintf(stderr, "refinetest2d: az not determined correctly (got %8f, should be %8f)\n", // cell->a.z/1e9, cell_real->a.z/1e9); // fail = 1; // } if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", + fprintf(stderr, "refinetest2d: bx not determined correctly (got %8f, should be %8f)\n", cell->b.x/1e9, cell_real->b.x/1e9); fail = 1; } if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", + fprintf(stderr, "refinetest2d: by not determined correctly (got %8f, should be %8f)\n", cell->b.y/1e9, cell_real->b.y/1e9); fail = 1; } // if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) { -// fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", +// fprintf(stderr, "refinetest2d: bz not determined correctly (got %8f, should be %8f)\n", // cell->b.z/1e9, cell_real->b.z/1e9); // fail = 1; // } // if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { -// fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", +// fprintf(stderr, "refinetest2d: cx not determined correctly (got %8f, should be %8f)\n", // cell->c.x/1e9, cell_real->c.x/1e9); // fail = 1; // } // if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) { -// fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", +// fprintf(stderr, "refinetest2d: cy not determined correctly (got %8f, should be %8f)\n", // cell->c.y/1e9, cell_real->c.y/1e9); // fail = 1; // } // if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { -// fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", +// fprintf(stderr, "refinetest2d: cz not determined correctly (got %8f, should be %8f)\n", // cell->c.z/1e9, cell_real->c.z/1e9); // fail = 1; // } -- cgit v1.2.3 From 870fffcb7b62a718037371f74e2d3fb8bfc3a6b2 Mon Sep 17 00:00:00 2001 From: Tom White Date: Tue, 23 Sep 2008 18:23:33 +0100 Subject: Make refinetest3d ignore bz and cy --- src/refinetest3d.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/refinetest3d.c b/src/refinetest3d.c index 090bee5..ea5cf92 100644 --- a/src/refinetest3d.c +++ b/src/refinetest3d.c @@ -79,13 +79,6 @@ static int check_cell(Basis *cell, Basis *cell_real) { } else { printf("by is OK.\n"); } - if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", - cell->b.z/1e9, cell_real->b.z/1e9); - fail = 1; - } else { - printf("bz is OK.\n"); - } if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", cell->c.x/1e9, cell_real->c.x/1e9); @@ -93,13 +86,6 @@ static int check_cell(Basis *cell, Basis *cell_real) { } else { printf("cx is OK.\n"); } - if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", - cell->c.y/1e9, cell_real->c.y/1e9); - fail = 1; - } else { - printf("cy is OK.\n"); - } if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", cell->c.z/1e9, cell_real->c.z/1e9); @@ -108,6 +94,8 @@ static int check_cell(Basis *cell, Basis *cell_real) { printf("cz is OK.\n"); } + printf("bz and cy not checked in this test.\n"); + return fail; } -- cgit v1.2.3 From cc8ff7aaf3c3cb7d7af7718f800170d20b410c85 Mon Sep 17 00:00:00 2001 From: Tom White Date: Tue, 23 Sep 2008 18:36:15 +0100 Subject: Split 3D refinement test into two separate tests --- Makefile.am | 2 +- src/.gitignore | 3 +- src/Makefile.am | 9 ++- src/refinetest3d.c | 179 ------------------------------------------------ src/refinetest3d1.c | 179 ++++++++++++++++++++++++++++++++++++++++++++++++ src/refinetest3d2.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 379 insertions(+), 184 deletions(-) delete mode 100644 src/refinetest3d.c create mode 100644 src/refinetest3d1.c create mode 100644 src/refinetest3d2.c diff --git a/Makefile.am b/Makefile.am index 3bd800e..2ff295e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,5 +3,5 @@ EXTRA_DIST = configure src/displaywindow.h src/trackball.h src/reflections.h src src/itrans-zaefferer.h src/itrans-stat.h src/mapping.h src/reproject.h src/prealign.h \ src/dirax.h src/image.h src/refine.h src/gtk-valuegraph.h src/intensities.h src/glbits.h src/gtk-valuegraph.h SUBDIRS = src data -TESTS = src/refinetest2d src/refinetest3d +TESTS = src/refinetest2d src/refinetest3d1 src/refinetest3d2 diff --git a/src/.gitignore b/src/.gitignore index 136096e..14a1da8 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,5 +1,6 @@ *.o .deps refinetest2d -refinetest3d +refinetest3d1 +refinetest3d2 dtr diff --git a/src/Makefile.am b/src/Makefile.am index 117b738..52986fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = dtr refinetest2d refinetest3d +bin_PROGRAMS = dtr refinetest2d refinetest3d1 refinetest3d2 dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c cache.c \ itrans-threshold.c itrans-zaefferer.c itrans-stat.c control.c mapping.c reproject.c prealign.c basis.c \ @@ -8,8 +8,11 @@ dtr_LDADD = @LIBS@ @GTK_LIBS@ -lm @GTKGLEXT_LIBS@ -lgsl -lgslcblas -lutil refinetest2d_SOURCES = refinetest2d.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c refinetest2d_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil -refinetest3d_SOURCES = refinetest3d.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c -refinetest3d_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil +refinetest3d1_SOURCES = refinetest3d1.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c +refinetest3d1_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil + +refinetest3d2_SOURCES = refinetest3d2.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c +refinetest3d2_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil AM_CFLAGS = -Wall -g @CFLAGS@ @GTK_CFLAGS@ @GTKGLEXT_CFLAGS@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I/usr/include/GL diff --git a/src/refinetest3d.c b/src/refinetest3d.c deleted file mode 100644 index ea5cf92..0000000 --- a/src/refinetest3d.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * refinetest3d.c - * - * Unit test for refinement procedure in 3D - * - * (c) 2007-2008 Thomas White - * - * dtr - Diffraction Tomography Reconstruction - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "basis.h" -#include "reflections.h" -#include "image.h" -#include "reproject.h" -#include "refine.h" -#include "utils.h" -#include "mapping.h" -#include "control.h" -#include "displaywindow.h" -#include "mrc.h" - -static int check_cell(Basis *cell, Basis *cell_real) { - - int fail; - - printf(" Refinement Actual\n"); - printf("---------------------------\n"); - printf("ax %+8f %+8f\n", cell->a.x/1e9, cell_real->a.x/1e9); - printf("ay %+8f %+8f\n", cell->a.y/1e9, cell_real->a.y/1e9); - printf("az %+8f %+8f\n", cell->a.z/1e9, cell_real->a.z/1e9); - printf("bx %+8f %+8f\n", cell->b.x/1e9, cell_real->b.x/1e9); - printf("by %+8f %+8f\n", cell->b.y/1e9, cell_real->b.y/1e9); - printf("bz %+8f %+8f\n", cell->b.z/1e9, cell_real->b.z/1e9); - printf("cx %+8f %+8f\n", cell->c.x/1e9, cell_real->c.x/1e9); - printf("cy %+8f %+8f\n", cell->c.y/1e9, cell_real->c.y/1e9); - printf("cz %+8f %+8f\n", cell->c.z/1e9, cell_real->c.z/1e9); - - fail = 0; - if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", - cell->a.x/1e9, cell_real->a.x/1e9); - fail = 1; - } else { - printf("ax is OK.\n"); - } - if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", - cell->a.y/1e9, cell_real->a.y/1e9); - fail = 1; - } else { - printf("ay is OK.\n"); - } - if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", - cell->a.z/1e9, cell_real->a.z/1e9); - fail = 1; - } else { - printf("az is OK.\n"); - } - if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", - cell->b.x/1e9, cell_real->b.x/1e9); - fail = 1; - } else { - printf("bx is OK.\n"); - } - if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", - cell->b.y/1e9, cell_real->b.y/1e9); - fail = 1; - } else { - printf("by is OK.\n"); - } - if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", - cell->c.x/1e9, cell_real->c.x/1e9); - fail = 1; - } else { - printf("cx is OK.\n"); - } - if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { - fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", - cell->c.z/1e9, cell_real->c.z/1e9); - fail = 1; - } else { - printf("cz is OK.\n"); - } - - printf("bz and cy not checked in this test.\n"); - - return fail; - -} - -int main(int argc, char *argv[]) { - - ControlContext *ctx; - ReflectionList *reflections_real; - Basis *cell_real; - int fail; - - ctx = control_ctx_new(); - ctx->omega = deg2rad(0.0); - ctx->lambda = lambda(300.0e3); /* 300 keV */ - ctx->fmode = FORMULATION_PIXELSIZE; - ctx->x_centre = 256; - ctx->y_centre = 256; - ctx->pixel_size = 5e7; - image_add(ctx->images, NULL, 512, 512, deg2rad(00.0), ctx); - ctx->images->images[0].features = image_feature_list_new(); - image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); - ctx->images->images[1].features = image_feature_list_new(); - //ctx->omega = deg2rad(90.0); - //image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); - //ctx->images->images[2].features = image_feature_list_new(); - - /* Fudge to avoid horrifying pointer-related death */ - ctx->dw = malloc(sizeof(DisplayWindow)); - ctx->dw->cur_image = 0; - - /* The "true" cell */ - cell_real = malloc(sizeof(Basis)); - cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; - cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; - cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; - /* The "real" reflections */ - reflections_real = reflection_list_from_cell(cell_real); - ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); - ctx->images->images[1].features = reproject_get_reflections(&ctx->images->images[1], reflections_real); - //ctx->images->images[2].features = reproject_get_reflections(&ctx->images->images[2], reflections_real); - - /* The "model" cell to be refined */ - ctx->cell = malloc(sizeof(Basis)); - ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9; - ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9; - ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9; - ctx->cell_lattice = reflection_list_from_cell(ctx->cell); - ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); - reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); - ctx->images->images[1].rflist = reproject_get_reflections(&ctx->images->images[1], ctx->cell_lattice); - reproject_partner_features(ctx->images->images[1].rflist, &ctx->images->images[1]); - //ctx->images->images[2].rflist = reproject_get_reflections(&ctx->images->images[2], ctx->cell_lattice); - //reproject_partner_features(ctx->images->images[2].rflist, &ctx->images->images[2]); - - refine_do_cell(ctx); - image_feature_list_free(ctx->images->images[0].rflist); - image_feature_list_free(ctx->images->images[1].rflist); - //image_feature_list_free(ctx->images->images[2].rflist); - - fail = check_cell(ctx->cell, cell_real); - - free(ctx); - - if ( fail ) return 1; - - printf("\n3D refinement test OK.\n"); - - return 0; - -} - -/* Dummy function stubs */ -#include "gtk-valuegraph.h" -void displaywindow_update_imagestack(DisplayWindow *dw) { }; -void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; -void displaywindow_update(DisplayWindow *dw) { }; -void displaywindow_error(const char *msg, DisplayWindow *dw) { }; -guint gtk_value_graph_get_type() { return 0; }; -GtkWidget *gtk_value_graph_new() { return NULL; }; -void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; - diff --git a/src/refinetest3d1.c b/src/refinetest3d1.c new file mode 100644 index 0000000..cd8cc84 --- /dev/null +++ b/src/refinetest3d1.c @@ -0,0 +1,179 @@ +/* + * refinetest3d1.c + * + * Unit test for refinement procedure in 3D + * + * (c) 2007-2008 Thomas White + * + * dtr - Diffraction Tomography Reconstruction + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "basis.h" +#include "reflections.h" +#include "image.h" +#include "reproject.h" +#include "refine.h" +#include "utils.h" +#include "mapping.h" +#include "control.h" +#include "displaywindow.h" +#include "mrc.h" + +static int check_cell(Basis *cell, Basis *cell_real) { + + int fail; + + printf(" Refinement Actual\n"); + printf("---------------------------\n"); + printf("ax %+8f %+8f\n", cell->a.x/1e9, cell_real->a.x/1e9); + printf("ay %+8f %+8f\n", cell->a.y/1e9, cell_real->a.y/1e9); + printf("az %+8f %+8f\n", cell->a.z/1e9, cell_real->a.z/1e9); + printf("bx %+8f %+8f\n", cell->b.x/1e9, cell_real->b.x/1e9); + printf("by %+8f %+8f\n", cell->b.y/1e9, cell_real->b.y/1e9); + printf("bz %+8f %+8f\n", cell->b.z/1e9, cell_real->b.z/1e9); + printf("cx %+8f %+8f\n", cell->c.x/1e9, cell_real->c.x/1e9); + printf("cy %+8f %+8f\n", cell->c.y/1e9, cell_real->c.y/1e9); + printf("cz %+8f %+8f\n", cell->c.z/1e9, cell_real->c.z/1e9); + + fail = 0; + if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", + cell->a.x/1e9, cell_real->a.x/1e9); + fail = 1; + } else { + printf("ax is OK.\n"); + } + if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", + cell->a.y/1e9, cell_real->a.y/1e9); + fail = 1; + } else { + printf("ay is OK.\n"); + } + if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", + cell->a.z/1e9, cell_real->a.z/1e9); + fail = 1; + } else { + printf("az is OK.\n"); + } + if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", + cell->b.x/1e9, cell_real->b.x/1e9); + fail = 1; + } else { + printf("bx is OK.\n"); + } + if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", + cell->b.y/1e9, cell_real->b.y/1e9); + fail = 1; + } else { + printf("by is OK.\n"); + } + if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", + cell->c.x/1e9, cell_real->c.x/1e9); + fail = 1; + } else { + printf("cx is OK.\n"); + } + if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", + cell->c.z/1e9, cell_real->c.z/1e9); + fail = 1; + } else { + printf("cz is OK.\n"); + } + + printf("bz and cy not checked in this test.\n"); + + return fail; + +} + +int main(int argc, char *argv[]) { + + ControlContext *ctx; + ReflectionList *reflections_real; + Basis *cell_real; + int fail; + + ctx = control_ctx_new(); + ctx->omega = deg2rad(0.0); + ctx->lambda = lambda(300.0e3); /* 300 keV */ + ctx->fmode = FORMULATION_PIXELSIZE; + ctx->x_centre = 256; + ctx->y_centre = 256; + ctx->pixel_size = 5e7; + image_add(ctx->images, NULL, 512, 512, deg2rad(00.0), ctx); + ctx->images->images[0].features = image_feature_list_new(); + image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); + ctx->images->images[1].features = image_feature_list_new(); + //ctx->omega = deg2rad(90.0); + //image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); + //ctx->images->images[2].features = image_feature_list_new(); + + /* Fudge to avoid horrifying pointer-related death */ + ctx->dw = malloc(sizeof(DisplayWindow)); + ctx->dw->cur_image = 0; + + /* The "true" cell */ + cell_real = malloc(sizeof(Basis)); + cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; + cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; + cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; + /* The "real" reflections */ + reflections_real = reflection_list_from_cell(cell_real); + ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); + ctx->images->images[1].features = reproject_get_reflections(&ctx->images->images[1], reflections_real); + //ctx->images->images[2].features = reproject_get_reflections(&ctx->images->images[2], reflections_real); + + /* The "model" cell to be refined */ + ctx->cell = malloc(sizeof(Basis)); + ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9; + ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9; + ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9; + ctx->cell_lattice = reflection_list_from_cell(ctx->cell); + ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); + ctx->images->images[1].rflist = reproject_get_reflections(&ctx->images->images[1], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[1].rflist, &ctx->images->images[1]); + //ctx->images->images[2].rflist = reproject_get_reflections(&ctx->images->images[2], ctx->cell_lattice); + //reproject_partner_features(ctx->images->images[2].rflist, &ctx->images->images[2]); + + refine_do_cell(ctx); + image_feature_list_free(ctx->images->images[0].rflist); + image_feature_list_free(ctx->images->images[1].rflist); + //image_feature_list_free(ctx->images->images[2].rflist); + + fail = check_cell(ctx->cell, cell_real); + + free(ctx); + + if ( fail ) return 1; + + printf("\n3D refinement test OK.\n"); + + return 0; + +} + +/* Dummy function stubs */ +#include "gtk-valuegraph.h" +void displaywindow_update_imagestack(DisplayWindow *dw) { }; +void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; +void displaywindow_update(DisplayWindow *dw) { }; +void displaywindow_error(const char *msg, DisplayWindow *dw) { }; +guint gtk_value_graph_get_type() { return 0; }; +GtkWidget *gtk_value_graph_new() { return NULL; }; +void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; + diff --git a/src/refinetest3d2.c b/src/refinetest3d2.c new file mode 100644 index 0000000..38ea72e --- /dev/null +++ b/src/refinetest3d2.c @@ -0,0 +1,191 @@ +/* + * refinetest3d2.c + * + * Unit test for refinement procedure in 3D + * + * (c) 2007-2008 Thomas White + * + * dtr - Diffraction Tomography Reconstruction + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "basis.h" +#include "reflections.h" +#include "image.h" +#include "reproject.h" +#include "refine.h" +#include "utils.h" +#include "mapping.h" +#include "control.h" +#include "displaywindow.h" +#include "mrc.h" + +static int check_cell(Basis *cell, Basis *cell_real) { + + int fail; + + printf(" Refinement Actual\n"); + printf("---------------------------\n"); + printf("ax %+8f %+8f\n", cell->a.x/1e9, cell_real->a.x/1e9); + printf("ay %+8f %+8f\n", cell->a.y/1e9, cell_real->a.y/1e9); + printf("az %+8f %+8f\n", cell->a.z/1e9, cell_real->a.z/1e9); + printf("bx %+8f %+8f\n", cell->b.x/1e9, cell_real->b.x/1e9); + printf("by %+8f %+8f\n", cell->b.y/1e9, cell_real->b.y/1e9); + printf("bz %+8f %+8f\n", cell->b.z/1e9, cell_real->b.z/1e9); + printf("cx %+8f %+8f\n", cell->c.x/1e9, cell_real->c.x/1e9); + printf("cy %+8f %+8f\n", cell->c.y/1e9, cell_real->c.y/1e9); + printf("cz %+8f %+8f\n", cell->c.z/1e9, cell_real->c.z/1e9); + + fail = 0; + if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", + cell->a.x/1e9, cell_real->a.x/1e9); + fail = 1; + } else { + printf("ax is OK.\n"); + } + if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", + cell->a.y/1e9, cell_real->a.y/1e9); + fail = 1; + } else { + printf("ay is OK.\n"); + } + if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", + cell->a.z/1e9, cell_real->a.z/1e9); + fail = 1; + } else { + printf("az is OK.\n"); + } + if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", + cell->b.x/1e9, cell_real->b.x/1e9); + fail = 1; + } else { + printf("bx is OK.\n"); + } + if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", + cell->b.y/1e9, cell_real->b.y/1e9); + fail = 1; + } else { + printf("by is OK.\n"); + } + if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", + cell->b.z/1e9, cell_real->b.z/1e9); + fail = 1; + } else { + printf("bz is OK.\n"); + } + if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", + cell->c.x/1e9, cell_real->c.x/1e9); + fail = 1; + } else { + printf("cx is OK.\n"); + } + if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", + cell->c.y/1e9, cell_real->c.y/1e9); + fail = 1; + } else { + printf("cx is OK.\n"); + } + if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", + cell->c.z/1e9, cell_real->c.z/1e9); + fail = 1; + } else { + printf("cz is OK.\n"); + } + + return fail; + +} + +int main(int argc, char *argv[]) { + + ControlContext *ctx; + ReflectionList *reflections_real; + Basis *cell_real; + int fail; + + ctx = control_ctx_new(); + ctx->omega = deg2rad(0.0); + ctx->lambda = lambda(300.0e3); /* 300 keV */ + ctx->fmode = FORMULATION_PIXELSIZE; + ctx->x_centre = 256; + ctx->y_centre = 256; + ctx->pixel_size = 5e7; + image_add(ctx->images, NULL, 512, 512, deg2rad(00.0), ctx); + ctx->images->images[0].features = image_feature_list_new(); + image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); + ctx->images->images[1].features = image_feature_list_new(); + ctx->omega = deg2rad(90.0); + image_add(ctx->images, NULL, 512, 512, deg2rad(90.0), ctx); + ctx->images->images[2].features = image_feature_list_new(); + + /* Fudge to avoid horrifying pointer-related death */ + ctx->dw = malloc(sizeof(DisplayWindow)); + ctx->dw->cur_image = 0; + + /* The "true" cell */ + cell_real = malloc(sizeof(Basis)); + cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; + cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; + cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; + /* The "real" reflections */ + reflections_real = reflection_list_from_cell(cell_real); + ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); + ctx->images->images[1].features = reproject_get_reflections(&ctx->images->images[1], reflections_real); + ctx->images->images[2].features = reproject_get_reflections(&ctx->images->images[2], reflections_real); + + /* The "model" cell to be refined */ + ctx->cell = malloc(sizeof(Basis)); + ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9; + ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9; + ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9; + ctx->cell_lattice = reflection_list_from_cell(ctx->cell); + ctx->images->images[0].rflist = reproject_get_reflections(&ctx->images->images[0], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[0].rflist, &ctx->images->images[0]); + ctx->images->images[1].rflist = reproject_get_reflections(&ctx->images->images[1], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[1].rflist, &ctx->images->images[1]); + ctx->images->images[2].rflist = reproject_get_reflections(&ctx->images->images[2], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[2].rflist, &ctx->images->images[2]); + + refine_do_cell(ctx); + image_feature_list_free(ctx->images->images[0].rflist); + image_feature_list_free(ctx->images->images[1].rflist); + image_feature_list_free(ctx->images->images[2].rflist); + + fail = check_cell(ctx->cell, cell_real); + + free(ctx); + + if ( fail ) return 1; + + printf("\n3D refinement test OK.\n"); + + return 0; + +} + +/* Dummy function stubs */ +#include "gtk-valuegraph.h" +void displaywindow_update_imagestack(DisplayWindow *dw) { }; +void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; +void displaywindow_update(DisplayWindow *dw) { }; +void displaywindow_error(const char *msg, DisplayWindow *dw) { }; +guint gtk_value_graph_get_type() { return 0; }; +GtkWidget *gtk_value_graph_new() { return NULL; }; +void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; + -- cgit v1.2.3 From f7f3a0630918d7759b4b83d4d516741c3b3dbba1 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 19:13:57 +0100 Subject: Add a new refinement test --- Makefile.am | 2 +- src/.gitignore | 1 + src/Makefile.am | 5 +- src/refinetest3d3.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 src/refinetest3d3.c diff --git a/Makefile.am b/Makefile.am index 2ff295e..7ecf791 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,5 +3,5 @@ EXTRA_DIST = configure src/displaywindow.h src/trackball.h src/reflections.h src src/itrans-zaefferer.h src/itrans-stat.h src/mapping.h src/reproject.h src/prealign.h \ src/dirax.h src/image.h src/refine.h src/gtk-valuegraph.h src/intensities.h src/glbits.h src/gtk-valuegraph.h SUBDIRS = src data -TESTS = src/refinetest2d src/refinetest3d1 src/refinetest3d2 +TESTS = src/refinetest2d src/refinetest3d1 src/refinetest3d2 src/refinetest3d3 diff --git a/src/.gitignore b/src/.gitignore index 14a1da8..1fbde8f 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -3,4 +3,5 @@ refinetest2d refinetest3d1 refinetest3d2 +refinetest3d3 dtr diff --git a/src/Makefile.am b/src/Makefile.am index 52986fc..ef32492 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = dtr refinetest2d refinetest3d1 refinetest3d2 +bin_PROGRAMS = dtr refinetest2d refinetest3d1 refinetest3d2 refinetest3d3 dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c cache.c \ itrans-threshold.c itrans-zaefferer.c itrans-stat.c control.c mapping.c reproject.c prealign.c basis.c \ @@ -14,6 +14,9 @@ refinetest3d1_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil refinetest3d2_SOURCES = refinetest3d2.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c refinetest3d2_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil +refinetest3d3_SOURCES = refinetest3d3.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c +refinetest3d3_LDADD = @LIBS@ @GTK_LIBS@ -lm -lgsl -lgslcblas -lutil + AM_CFLAGS = -Wall -g @CFLAGS@ @GTK_CFLAGS@ @GTKGLEXT_CFLAGS@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I/usr/include/GL diff --git a/src/refinetest3d3.c b/src/refinetest3d3.c new file mode 100644 index 0000000..ffb72a5 --- /dev/null +++ b/src/refinetest3d3.c @@ -0,0 +1,187 @@ +/* + * refinetest3d3.c + * + * Unit test for refinement procedure in 3D + * + * (c) 2007-2008 Thomas White + * + * dtr - Diffraction Tomography Reconstruction + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "basis.h" +#include "reflections.h" +#include "image.h" +#include "reproject.h" +#include "refine.h" +#include "utils.h" +#include "mapping.h" +#include "control.h" +#include "displaywindow.h" +#include "mrc.h" + +static int check_cell(Basis *cell, Basis *cell_real) { + + int fail; + + printf(" Refinement Actual\n"); + printf("---------------------------\n"); + printf("ax %+8f %+8f\n", cell->a.x/1e9, cell_real->a.x/1e9); + printf("ay %+8f %+8f\n", cell->a.y/1e9, cell_real->a.y/1e9); + printf("az %+8f %+8f\n", cell->a.z/1e9, cell_real->a.z/1e9); + printf("bx %+8f %+8f\n", cell->b.x/1e9, cell_real->b.x/1e9); + printf("by %+8f %+8f\n", cell->b.y/1e9, cell_real->b.y/1e9); + printf("bz %+8f %+8f\n", cell->b.z/1e9, cell_real->b.z/1e9); + printf("cx %+8f %+8f\n", cell->c.x/1e9, cell_real->c.x/1e9); + printf("cy %+8f %+8f\n", cell->c.y/1e9, cell_real->c.y/1e9); + printf("cz %+8f %+8f\n", cell->c.z/1e9, cell_real->c.z/1e9); + + fail = 0; + if ( fabs(cell->a.x - cell_real->a.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ax not determined correctly (got %8f, should be %8f)\n", + cell->a.x/1e9, cell_real->a.x/1e9); + fail = 1; + } else { + printf("ax is OK.\n"); + } + if ( fabs(cell->a.y - cell_real->a.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: ay not determined correctly (got %8f, should be %8f)\n", + cell->a.y/1e9, cell_real->a.y/1e9); + fail = 1; + } else { + printf("ay is OK.\n"); + } + if ( fabs(cell->a.z - cell_real->a.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: az not determined correctly (got %8f, should be %8f)\n", + cell->a.z/1e9, cell_real->a.z/1e9); + fail = 1; + } else { + printf("az is OK.\n"); + } + if ( fabs(cell->b.x - cell_real->b.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: bx not determined correctly (got %8f, should be %8f)\n", + cell->b.x/1e9, cell_real->b.x/1e9); + fail = 1; + } else { + printf("bx is OK.\n"); + } + if ( fabs(cell->b.y - cell_real->b.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: by not determined correctly (got %8f, should be %8f)\n", + cell->b.y/1e9, cell_real->b.y/1e9); + fail = 1; + } else { + printf("by is OK.\n"); + } + if ( fabs(cell->b.z - cell_real->b.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: bz not determined correctly (got %8f, should be %8f)\n", + cell->b.z/1e9, cell_real->b.z/1e9); + fail = 1; + } else { + printf("bz is OK.\n"); + } + if ( fabs(cell->c.x - cell_real->c.x) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cx not determined correctly (got %8f, should be %8f)\n", + cell->c.x/1e9, cell_real->c.x/1e9); + fail = 1; + } else { + printf("cx is OK.\n"); + } + if ( fabs(cell->c.y - cell_real->c.y) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cy not determined correctly (got %8f, should be %8f)\n", + cell->c.y/1e9, cell_real->c.y/1e9); + fail = 1; + } else { + printf("cx is OK.\n"); + } + if ( fabs(cell->c.z - cell_real->c.z) > 0.01e9 ) { + fprintf(stderr, "refinetest3d: cz not determined correctly (got %8f, should be %8f)\n", + cell->c.z/1e9, cell_real->c.z/1e9); + fail = 1; + } else { + printf("cz is OK.\n"); + } + + return fail; + +} + +int main(int argc, char *argv[]) { + + ControlContext *ctx; + ReflectionList *reflections_real; + Basis *cell_real; + int fail; + int i; + + ctx = control_ctx_new(); + ctx->omega = deg2rad(45.0); + ctx->lambda = lambda(300.0e3); /* 300 keV */ + ctx->fmode = FORMULATION_PIXELSIZE; + ctx->x_centre = 256; + ctx->y_centre = 256; + ctx->pixel_size = 5e7; + for ( i=0; i<90; i++ ) { + image_add(ctx->images, NULL, 512, 512, deg2rad(i), ctx); + ctx->images->images[i].features = image_feature_list_new(); + } + + /* Fudge to avoid horrifying pointer-related death */ + ctx->dw = malloc(sizeof(DisplayWindow)); + ctx->dw->cur_image = 0; + + /* The "true" cell */ + cell_real = malloc(sizeof(Basis)); + cell_real->a.x = 5.0e9; cell_real->a.y = 0.0e9; cell_real->a.z = 0.0e9; + cell_real->b.x = 0.0e9; cell_real->b.y = 5.0e9; cell_real->b.z = 0.0e9; + cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; + /* The "real" reflections */ + reflections_real = reflection_list_from_cell(cell_real); + ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); + ctx->images->images[1].features = reproject_get_reflections(&ctx->images->images[1], reflections_real); + ctx->images->images[2].features = reproject_get_reflections(&ctx->images->images[2], reflections_real); + + /* The "model" cell to be refined */ + ctx->cell = malloc(sizeof(Basis)); + ctx->cell->a.x = 5.0e9; ctx->cell->a.y = 0.1e9; ctx->cell->a.z = 0.1e9; + ctx->cell->b.x = 0.1e9; ctx->cell->b.y = 5.0e9; ctx->cell->b.z = 0.1e9; + ctx->cell->c.x = 0.1e9; ctx->cell->c.y = 0.1e9; ctx->cell->c.z = 5.0e9; + ctx->cell_lattice = reflection_list_from_cell(ctx->cell); + for ( i=0; iimages->n_images; i++ ) { + ctx->images->images[i].rflist = reproject_get_reflections(&ctx->images->images[i], ctx->cell_lattice); + reproject_partner_features(ctx->images->images[i].rflist, &ctx->images->images[i]); + } + + refine_do_cell(ctx); + for ( i=0; iimages->n_images; i++ ) { + image_feature_list_free(ctx->images->images[i].rflist); + } + + fail = check_cell(ctx->cell, cell_real); + + free(ctx); + + if ( fail ) return 1; + + printf("\n3D refinement test OK.\n"); + + return 0; + +} + +/* Dummy function stubs */ +#include "gtk-valuegraph.h" +void displaywindow_update_imagestack(DisplayWindow *dw) { }; +void displaywindow_enable_cell_functions(DisplayWindow *dw, gboolean g) { }; +void displaywindow_update(DisplayWindow *dw) { }; +void displaywindow_error(const char *msg, DisplayWindow *dw) { }; +guint gtk_value_graph_get_type() { return 0; }; +GtkWidget *gtk_value_graph_new() { return NULL; }; +void gtk_value_graph_set_data(GtkValueGraph *vg, double *data, unsigned int n) { }; + -- cgit v1.2.3 From b56b3759a14ab4e5e6074e8b711d61c313b4a73c Mon Sep 17 00:00:00 2001 From: Tom White Date: Fri, 26 Sep 2008 17:49:44 +0100 Subject: Makefile tidy-up --- Makefile.am | 9 +++++---- src/Makefile.am | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7ecf791..e59af98 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ -EXTRA_DIST = configure src/displaywindow.h src/trackball.h src/reflections.h src/control.h src/readpng.h src/mrc.h src/imagedisplay.h src/main.h \ - data/displaywindow.ui src/utils.h src/itrans.h src/qdrp.h src/cache.h src/itrans-threshold.h src/basis.h \ - src/itrans-zaefferer.h src/itrans-stat.h src/mapping.h src/reproject.h src/prealign.h \ - src/dirax.h src/image.h src/refine.h src/gtk-valuegraph.h src/intensities.h src/glbits.h src/gtk-valuegraph.h +EXTRA_DIST = configure src/displaywindow.h src/trackball.h src/reflections.h src/control.h src/readpng.h src/mrc.h \ + src/imagedisplay.h src/main.h data/displaywindow.ui src/utils.h src/itrans.h src/qdrp.h src/cache.h \ + src/itrans-threshold.h src/basis.h src/itrans-zaefferer.h src/itrans-stat.h src/mapping.h \ + src/reproject.h src/prealign.h src/dirax.h src/image.h src/refine.h src/gtk-valuegraph.h \ + src/intensities.h src/glbits.h src/gtk-valuegraph.h SUBDIRS = src data TESTS = src/refinetest2d src/refinetest3d1 src/refinetest3d2 src/refinetest3d3 diff --git a/src/Makefile.am b/src/Makefile.am index ef32492..d6e39c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ bin_PROGRAMS = dtr refinetest2d refinetest3d1 refinetest3d2 refinetest3d3 -dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c cache.c \ - itrans-threshold.c itrans-zaefferer.c itrans-stat.c control.c mapping.c reproject.c prealign.c basis.c \ - dirax.c image.c refine.c gtk-valuegraph.c intensities.c glbits.c +dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c \ + cache.c itrans-threshold.c itrans-zaefferer.c itrans-stat.c control.c mapping.c reproject.c prealign.c \ + basis.c dirax.c image.c refine.c gtk-valuegraph.c intensities.c glbits.c dtr_LDADD = @LIBS@ @GTK_LIBS@ -lm @GTKGLEXT_LIBS@ -lgsl -lgslcblas -lutil refinetest2d_SOURCES = refinetest2d.c reflections.c basis.c utils.c reproject.c image.c refine.c mapping.c control.c -- cgit v1.2.3 From 8a1c26e6fab9970ed79b4817bcf5fd5962197872 Mon Sep 17 00:00:00 2001 From: Tom White Date: Fri, 26 Sep 2008 17:53:55 +0100 Subject: Process ALL images in refinetest3d3 --- src/refinetest3d3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/refinetest3d3.c b/src/refinetest3d3.c index ffb72a5..de8a792 100644 --- a/src/refinetest3d3.c +++ b/src/refinetest3d3.c @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) { ctx->x_centre = 256; ctx->y_centre = 256; ctx->pixel_size = 5e7; - for ( i=0; i<90; i++ ) { + for ( i=0; i<=90; i++ ) { image_add(ctx->images, NULL, 512, 512, deg2rad(i), ctx); ctx->images->images[i].features = image_feature_list_new(); } @@ -143,9 +143,9 @@ int main(int argc, char *argv[]) { cell_real->c.x = 0.0e9; cell_real->c.y = 0.0e9; cell_real->c.z = 5.0e9; /* The "real" reflections */ reflections_real = reflection_list_from_cell(cell_real); - ctx->images->images[0].features = reproject_get_reflections(&ctx->images->images[0], reflections_real); - ctx->images->images[1].features = reproject_get_reflections(&ctx->images->images[1], reflections_real); - ctx->images->images[2].features = reproject_get_reflections(&ctx->images->images[2], reflections_real); + for ( i=0; i<=90; i++ ) { + ctx->images->images[i].features = reproject_get_reflections(&ctx->images->images[i], reflections_real); + } /* The "model" cell to be refined */ ctx->cell = malloc(sizeof(Basis)); -- cgit v1.2.3 From 28ddc73c6bf8cb6d25e871b070cd7d93599b5c06 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 12:06:21 +0100 Subject: Line wrapping in src/displaywindow.c --- src/displaywindow.c | 125 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 52 deletions(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index a038c8c..0049747 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -132,13 +132,14 @@ static void displaywindow_about(GtkWidget *widget, DisplayWindow *dw) { gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), PACKAGE_VERSION); gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), "(c) 2006-2007 Thomas White and contributors"); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window), "Diffraction Tomography Reconstruction"); - gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), "(c) 2006-2007 Thomas White \n" - "Virtual trackball (c) Copyright 1993, 1994, Silicon Graphics, Inc.\n" - "See Credits for a full list of contributors\n" - "\n" - "Research funded by:\n" - "FEI Electron Optics B.V.\n" - "The Engineering and Physical Sciences Research Council"); + gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), + "(c) 2006-2007 Thomas White \n" + "Virtual trackball (c) Copyright 1993, 1994, Silicon Graphics, Inc.\n" + "See Credits for a full list of contributors\n" + "\n" + "Research funded by:\n" + "FEI Electron Optics B.V.\n" + "The Engineering and Physical Sciences Research Council"); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(window), "http://www-hrem.msm.cam.ac.uk/"); gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(window), authors); @@ -223,7 +224,8 @@ static gint displaywindow_savecache(GtkWidget *widget, DisplayWindow *dw) { GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); - g_signal_connect(G_OBJECT(dw->savecache_window), "response", G_CALLBACK(displaywindow_savecache_response), dw->ctx); + g_signal_connect(G_OBJECT(dw->savecache_window), "response", G_CALLBACK(displaywindow_savecache_response), + dw->ctx); gtk_widget_show_all(dw->savecache_window); return 0; @@ -272,7 +274,8 @@ static gint displaywindow_setaxis(GtkWidget *widget, DisplayWindow *dw) { GtkWidget *label; dw->tiltaxis_window = gtk_dialog_new_with_buttons("Set Tilt Axis Position", GTK_WINDOW(dw->window), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CLOSE, GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); vbox = gtk_vbox_new(FALSE, 0); hbox = gtk_hbox_new(TRUE, 0); @@ -378,37 +381,45 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { GtkActionEntry entries[] = { - { "FileAction", NULL, "_File", NULL, NULL, NULL }, - { "SaveCacheAction", "filesave", "Save Image Analysis to _Cache", NULL, NULL, G_CALLBACK(displaywindow_savecache) }, - { "SaveHKLAction", GTK_STOCK_SAVE, "Save Reflections", NULL, NULL, G_CALLBACK(displaywindow_savehkl) }, - { "CloseAction", GTK_STOCK_QUIT, "_Quit", NULL, NULL, G_CALLBACK(displaywindow_close) }, - - { "ViewAction", NULL, "_View", NULL, NULL, NULL }, - - { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, - { "DirAxAction", "dtr-dirax", "Start _DirAx", "D", NULL, G_CALLBACK(displaywindow_dirax) }, - { "DirAxReRunAction", NULL, "Run another DirAx cycle", NULL, NULL, G_CALLBACK(displaywindow_dirax_rerun) }, - { "StopDirAxAction", NULL, "Stop DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax_stop) }, - { "RefineStepAction", "dtr-refine", "Refine Unit Cell", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, - { "RefineSeqAction", "dtr-refineall", "Run Refinement Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, - { "SetAxisAction", "dtr-tiltaxis", "Set Tilt Axis Position...", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, - { "IncrAxisAction", NULL, "Increase Tilt Axis Position", "Up", NULL, G_CALLBACK(displaywindow_incraxis) }, - { "DecrAxisAction", NULL, "Decrease Tilt Axis Position", "Down", NULL, G_CALLBACK(displaywindow_decraxis) }, - { "ExtractIntensitiesAction", "dtr-quantify", "Quantify Reflection Intensities", NULL, NULL, G_CALLBACK(displaywindow_extract) }, - - { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, - { "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) }, - - { "ButtonDirAxAction", "dtr-dirax", "Run _DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax) }, - { "ButtonTiltAxisAction", "dtr-tiltaxis", "Tilt Axis", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, - { "ButtonRefineStepAction", "dtr-refine", "Refine", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, - { "ButtonRefineSeqAction", "dtr-refineall", "Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, - { "ButtonFirstImageAction", GTK_STOCK_GOTO_FIRST, "First Image", NULL, NULL, G_CALLBACK(displaywindow_image_first) }, - { "ButtonPrevImageAction", GTK_STOCK_GO_BACK, "Previous Image", NULL, NULL, G_CALLBACK(displaywindow_image_prev) }, - { "ButtonNextImageAction", GTK_STOCK_GO_FORWARD, "Next Image", NULL, NULL, G_CALLBACK(displaywindow_image_next) }, - { "ButtonLastImageAction", GTK_STOCK_GOTO_LAST, "Last Image", NULL, NULL, G_CALLBACK(displaywindow_image_last) }, - { "ButtonExtractIntensitiesAction", "dtr-quantify", "Quantify", NULL, NULL, G_CALLBACK(displaywindow_extract) }, - + { "FileAction", NULL, "_File", NULL, NULL, NULL }, + { "SaveCacheAction", "filesave", "Save Image Analysis to _Cache", + NULL, NULL, G_CALLBACK(displaywindow_savecache) }, + { "SaveHKLAction", GTK_STOCK_SAVE, "Save Reflections", NULL, NULL, G_CALLBACK(displaywindow_savehkl) }, + { "CloseAction", GTK_STOCK_QUIT, "_Quit", NULL, NULL, G_CALLBACK(displaywindow_close) }, + + { "ViewAction", NULL, "_View", NULL, NULL, NULL }, + + { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, + { "DirAxAction", "dtr-dirax", "Start _DirAx", "D", NULL, G_CALLBACK(displaywindow_dirax) }, + { "DirAxReRunAction", NULL, "Run another DirAx cycle", NULL, NULL, G_CALLBACK(displaywindow_dirax_rerun) }, + { "StopDirAxAction", NULL, "Stop DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax_stop) }, + { "RefineStepAction", "dtr-refine", "Refine Unit Cell", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, + { "RefineSeqAction", "dtr-refineall", "Run Refinement Sequence", + NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, + { "SetAxisAction", "dtr-tiltaxis", "Set Tilt Axis Position...", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, + { "IncrAxisAction", NULL, "Increase Tilt Axis Position", "Up", NULL, G_CALLBACK(displaywindow_incraxis) }, + { "DecrAxisAction", NULL, "Decrease Tilt Axis Position", + "Down", NULL, G_CALLBACK(displaywindow_decraxis) }, + { "ExtractIntensitiesAction", "dtr-quantify", "Quantify Reflection Intensities", + NULL, NULL, G_CALLBACK(displaywindow_extract) }, + + { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, + { "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) }, + + { "ButtonDirAxAction", "dtr-dirax", "Run _DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax) }, + { "ButtonTiltAxisAction", "dtr-tiltaxis", "Tilt Axis", NULL, NULL, G_CALLBACK(displaywindow_setaxis) }, + { "ButtonRefineStepAction", "dtr-refine", "Refine", NULL, NULL, G_CALLBACK(displaywindow_refinestep) }, + { "ButtonRefineSeqAction", "dtr-refineall", "Sequence", NULL, NULL, G_CALLBACK(displaywindow_refinestack) }, + { "ButtonFirstImageAction", GTK_STOCK_GOTO_FIRST, "First Image", + NULL, NULL, G_CALLBACK(displaywindow_image_first) }, + { "ButtonPrevImageAction", GTK_STOCK_GO_BACK, "Previous Image", + NULL, NULL, G_CALLBACK(displaywindow_image_prev) }, + { "ButtonNextImageAction", GTK_STOCK_GO_FORWARD, "Next Image", + NULL, NULL, G_CALLBACK(displaywindow_image_next) }, + { "ButtonLastImageAction", GTK_STOCK_GOTO_LAST, "Last Image", + NULL, NULL, G_CALLBACK(displaywindow_image_last) }, + { "ButtonExtractIntensitiesAction", "dtr-quantify", "Quantify", NULL, NULL, G_CALLBACK(displaywindow_extract) }, + }; guint n_entries = G_N_ELEMENTS(entries); @@ -425,9 +436,12 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { guint n_radios2 = G_N_ELEMENTS(radios2); GtkToggleActionEntry toggles[] = { - { "CubeAction", NULL, "Show 100 nm^-1 _Cube", NULL, NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, - { "LinesAction", NULL, "Show Indexing Lines", NULL, NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, - { "BackgroundAction", NULL, "Show Coloured Background", NULL, NULL, G_CALLBACK(displaywindow_changebackground), dw->background }, + { "CubeAction", NULL, "Show 100 nm^-1 _Cube", + NULL, NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, + { "LinesAction", NULL, "Show Indexing Lines", + NULL, NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, + { "BackgroundAction", NULL, "Show Coloured Background", + NULL, NULL, G_CALLBACK(displaywindow_changebackground), dw->background }, }; guint n_toggles = G_N_ELEMENTS(toggles); @@ -435,8 +449,10 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { dw->action_group = gtk_action_group_new("dtrdisplaywindow"); gtk_action_group_add_actions(dw->action_group, entries, n_entries, dw); - gtk_action_group_add_radio_actions(dw->action_group, radios, n_radios, -1, G_CALLBACK(displaywindow_changeview), dw); - gtk_action_group_add_radio_actions(dw->action_group, radios2, n_radios2, -1, G_CALLBACK(displaywindow_changemode), dw); + gtk_action_group_add_radio_actions(dw->action_group, radios, n_radios, + -1, G_CALLBACK(displaywindow_changeview), dw); + gtk_action_group_add_radio_actions(dw->action_group, radios2, n_radios2, + -1, G_CALLBACK(displaywindow_changemode), dw); gtk_action_group_add_toggle_actions(dw->action_group, toggles, n_toggles, dw); dw->ui = gtk_ui_manager_new(); @@ -497,9 +513,10 @@ void displaywindow_update_imagestack(DisplayWindow *dw) { /* Now connect partners */ for ( j=0; jrflist->n_features; j++ ) { if ( image->rflist->features[j].partner ) { - imagedisplay_add_line(dw->stack, image->rflist->features[j].x, image->rflist->features[j].y, - image->rflist->features[j].partner->x, image->rflist->features[j].partner->y, - IMAGEDISPLAY_MARK_LINE_1); + imagedisplay_add_line(dw->stack, + image->rflist->features[j].x, image->rflist->features[j].y, + image->rflist->features[j].partner->x, image->rflist->features[j].partner->y, + IMAGEDISPLAY_MARK_LINE_1); } } } @@ -598,12 +615,15 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_widget_set_size_request(dw->drawing_area, 640, 640); gtk_widget_set_gl_capability(dw->drawing_area, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->drawing_area, gtk_label_new("Reconstruction")); - gtk_widget_add_events(dw->drawing_area, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_VISIBILITY_NOTIFY_MASK); + gtk_widget_add_events(dw->drawing_area, + GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_VISIBILITY_NOTIFY_MASK); g_signal_connect(GTK_OBJECT(dw->drawing_area), "configure_event", G_CALLBACK(glbits_configure), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "realize", G_CALLBACK(glbits_realise), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "expose_event", G_CALLBACK(glbits_expose), dw); - g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", G_CALLBACK(displaywindow_gl_button_press), dw); - g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", G_CALLBACK(displaywindow_gl_motion_notify), dw); + g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", + G_CALLBACK(displaywindow_gl_button_press), dw); + g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", + G_CALLBACK(displaywindow_gl_motion_notify), dw); g_signal_connect(GTK_OBJECT(dw->drawing_area), "destroy", G_CALLBACK(displaywindow_gl_destroyed), dw); if ( ctx->images->n_images > 0 ) { @@ -612,7 +632,8 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dw->stack->vbox, gtk_label_new("Image Stack")); displaywindow_update_imagestack(dw); } else { - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new("No Images to Display"), gtk_label_new("Image Stack")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), gtk_label_new("No Images to Display"), + gtk_label_new("Image Stack")); } displaywindow_enable_cell_functions(dw, FALSE); -- cgit v1.2.3 From 43db8bfe56fa2a1f942ad38183eaf6079c20b4a5 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 12:40:01 +0100 Subject: Line wrapping and copyright in mapping.c --- src/mapping.c | 5 +++-- src/mapping.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mapping.c b/src/mapping.c index c9872f9..54a7235 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -3,7 +3,7 @@ * * 3D Mapping * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * @@ -146,7 +146,8 @@ void mapping_map_features(ControlContext *ctx) { double nx, ny, nz, twotheta; - if ( !mapping_map_to_space(&ctx->images->images[i].features->features[j], &nx, &ny, &nz, &twotheta) ) { + if ( !mapping_map_to_space(&ctx->images->images[i].features->features[j], + &nx, &ny, &nz, &twotheta) ) { reflection_add(ctx->reflectionlist, nx, ny, nz, ctx->images->images[i].features->features[j].intensity, REFLECTION_NORMAL); } diff --git a/src/mapping.h b/src/mapping.h index 8b23550..6724499 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -3,7 +3,7 @@ * * 3D Mapping * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * @@ -19,7 +19,8 @@ #include "reflections.h" #include "control.h" -extern void mapping_rotate(double x, double y, double z, double *ddx, double *ddy, double *ddz, double omega, double tilt); +extern void mapping_rotate(double x, double y, double z, double *ddx, double *ddy, double *ddz, + double omega, double tilt); extern int mapping_map_to_space(ImageFeature *refl, double *ddx, double *ddy, double *ddz, double *twotheta); extern int mapping_scale(ImageFeature *refl, double *ddx, double *ddy); -- cgit v1.2.3 From d200349cad19fa80947b441711cc36685a974aa2 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 15:08:19 +0100 Subject: Line wrapping in src/imagedisplay.{c,h} --- src/imagedisplay.c | 34 ++++++++++++++++++++++------------ src/imagedisplay.h | 18 +++++++++++++----- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/imagedisplay.c b/src/imagedisplay.c index 00b7285..4ca46a5 100644 --- a/src/imagedisplay.c +++ b/src/imagedisplay.c @@ -3,7 +3,7 @@ * * Show raw and processed images * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * @@ -181,7 +181,8 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even yoffs = ((double)imagedisplay->drawingarea_height - imagedisplay->view_height) / 2; scale = (double)imagedisplay->view_width/imagedisplay->imagerecord.width; - gdk_draw_pixbuf(drawingarea->window, drawingarea->style->bg_gc[GTK_WIDGET_STATE(drawingarea)], imagedisplay->pixbuf_scaled, + gdk_draw_pixbuf(drawingarea->window, drawingarea->style->bg_gc[GTK_WIDGET_STATE(drawingarea)], + imagedisplay->pixbuf_scaled, 0, 0, xoffs, yoffs, imagedisplay->view_width, imagedisplay->view_height, GDK_RGB_DITHER_NONE, 0, 0); @@ -245,8 +246,9 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even default : gc = imagedisplay->gc_marks_1; break; } - if ( (cur->type == IMAGEDISPLAY_MARK_CIRCLE_1) || (cur->type == IMAGEDISPLAY_MARK_CIRCLE_2) - || (cur->type == IMAGEDISPLAY_MARK_CIRCLE_3) ) { + if ( (cur->type == IMAGEDISPLAY_MARK_CIRCLE_1) + || (cur->type == IMAGEDISPLAY_MARK_CIRCLE_2) + || (cur->type == IMAGEDISPLAY_MARK_CIRCLE_3) ) { double r; @@ -351,10 +353,14 @@ ImageDisplay *imagedisplay_new_nowindow(ImageRecord imagerecord, ImageDisplayFla G_CALLBACK(imagedisplay->mouse_click_func), callback_data); } - g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "realize", G_CALLBACK(imagedisplay_realize), imagedisplay); - g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "destroy", G_CALLBACK(imagedisplay_destroyed), imagedisplay); - g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "configure_event", G_CALLBACK(imagedisplay_configure_event), imagedisplay); - g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "expose-event", G_CALLBACK(imagedisplay_redraw), imagedisplay); + g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "realize", + G_CALLBACK(imagedisplay_realize), imagedisplay); + g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "destroy", + G_CALLBACK(imagedisplay_destroyed), imagedisplay); + g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "configure_event", + G_CALLBACK(imagedisplay_configure_event), imagedisplay); + g_signal_connect(GTK_OBJECT(imagedisplay->drawingarea), "expose-event", + G_CALLBACK(imagedisplay_redraw), imagedisplay); return imagedisplay; @@ -362,7 +368,8 @@ ImageDisplay *imagedisplay_new_nowindow(ImageRecord imagerecord, ImageDisplayFla /* Display an image */ ImageDisplay *imagedisplay_open_with_message(ImageRecord imagerecord, const char *title, const char *message, - ImageDisplayFlags flags, GCallback mouse_click_func, gpointer callback_data) { + ImageDisplayFlags flags, GCallback mouse_click_func, + gpointer callback_data) { ImageDisplay *imagedisplay; GdkGeometry geom; @@ -375,7 +382,8 @@ ImageDisplay *imagedisplay_open_with_message(ImageRecord imagerecord, const char gtk_window_set_title(GTK_WINDOW(imagedisplay->window), imagedisplay->title); geom.min_width = 128; geom.min_height = 128; - gtk_window_set_geometry_hints(GTK_WINDOW(imagedisplay->window), GTK_WIDGET(imagedisplay->drawingarea), &geom, GDK_HINT_MIN_SIZE); + gtk_window_set_geometry_hints(GTK_WINDOW(imagedisplay->window), GTK_WIDGET(imagedisplay->drawingarea), + &geom, GDK_HINT_MIN_SIZE); gtk_window_set_default_size(GTK_WINDOW(imagedisplay->window), 512, 512); @@ -411,7 +419,8 @@ void imagedisplay_add_mark(ImageDisplay *imagedisplay, double x, double y, Image } -void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, double x2, double y2, ImageDisplayMarkType type) { +void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, + double x2, double y2, ImageDisplayMarkType type) { ImageDisplayMark *new; @@ -436,6 +445,7 @@ void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, dou void imagedisplay_force_redraw(ImageDisplay *imagedisplay) { imagedisplay_rescale(imagedisplay, imagedisplay->drawingarea_width, imagedisplay->drawingarea_height); - gtk_widget_queue_draw_area(imagedisplay->drawingarea, 0, 0, imagedisplay->drawingarea_width, imagedisplay->drawingarea_height); + gtk_widget_queue_draw_area(imagedisplay->drawingarea, 0, 0, imagedisplay->drawingarea_width, + imagedisplay->drawingarea_height); } diff --git a/src/imagedisplay.h b/src/imagedisplay.h index 325ea96..e20e4eb 100644 --- a/src/imagedisplay.h +++ b/src/imagedisplay.h @@ -3,7 +3,7 @@ * * Show raw and processed images * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * @@ -80,12 +80,20 @@ typedef struct imagedisplay_struct { } ImageDisplay; extern ImageDisplay *imagedisplay_open(ImageRecord image, const char *title, ImageDisplayFlags flags); + extern ImageDisplay *imagedisplay_open_with_message(ImageRecord image, const char *title, const char *message, - ImageDisplayFlags flags, GCallback mouse_click_func, gpointer callback_data); + ImageDisplayFlags flags, GCallback mouse_click_func, + gpointer callback_data); + extern ImageDisplay *imagedisplay_new_nowindow(ImageRecord imagerecord, ImageDisplayFlags flags, const char *message, - GCallback mouse_click_func, gpointer callback_data); -extern void imagedisplay_add_mark(ImageDisplay *imagedisplay, double x, double y, ImageDisplayMarkType type, double weight); -extern void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, double x2, double y2, ImageDisplayMarkType type); + GCallback mouse_click_func, gpointer callback_data); + +extern void imagedisplay_add_mark(ImageDisplay *imagedisplay, double x, double y, ImageDisplayMarkType type, + double weight); + +extern void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, + double x2, double y2, ImageDisplayMarkType type); + extern void imagedisplay_force_redraw(ImageDisplay *imagedisplay); extern void imagedisplay_put_data(ImageDisplay *imagedisplay, ImageRecord imagerecord); extern void imagedisplay_close(ImageDisplay *imagedisplay); -- cgit v1.2.3 From f6a8e7ef02e6f449c2c3aa6186bf10d81c127dd3 Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 18:23:46 +0100 Subject: Add a scale bar to the diffraction patterns --- src/imagedisplay.c | 31 +++++++++++++++++++++++++++++++ src/mapping.c | 14 ++++++++++++++ src/mapping.h | 2 ++ 3 files changed, 47 insertions(+) diff --git a/src/imagedisplay.c b/src/imagedisplay.c index 4ca46a5..b6de26a 100644 --- a/src/imagedisplay.c +++ b/src/imagedisplay.c @@ -23,6 +23,7 @@ #include "imagedisplay.h" #include "utils.h" +#include "mapping.h" /* Free pixbuf data when reference count drops to zero */ static void imagedisplay_free_data(guchar *image_eightbit, ImageDisplay *imagedisplay) { @@ -167,6 +168,33 @@ void imagedisplay_close(ImageDisplay *imagedisplay) { } } +static void imagedisplay_add_scalebar(ImageDisplay *imagedisplay, GtkWidget *drawingarea, + double scale, double xoffs, double yoffs) { + + PangoLayout *layout; + double sb; + PangoRectangle rect; + int bwidth, bheight; + int view_height = imagedisplay->view_height; + + sb = mapping_scale_bar_length(&imagedisplay->imagerecord); + layout = gtk_widget_create_pango_layout(drawingarea, "1 nm^-1"); + pango_layout_get_pixel_extents(layout, &rect, NULL); + + bwidth = (sb*scale)+20; + bheight = rect.height+30; + if ( rect.width > bwidth ) bwidth = rect.width+20; + gdk_draw_rectangle(drawingarea->window, drawingarea->style->bg_gc[GTK_WIDGET_STATE(drawingarea)], TRUE, + xoffs+20, yoffs+view_height-20-bheight, + bwidth, bheight); + gdk_draw_line(drawingarea->window, drawingarea->style->fg_gc[GTK_WIDGET_STATE(drawingarea)], + xoffs+30, yoffs+view_height-30, + xoffs+30+(scale*sb), yoffs+view_height-30); + gdk_draw_layout(drawingarea->window, drawingarea->style->fg_gc[GTK_WIDGET_STATE(drawingarea)], + xoffs+30, yoffs+view_height-20-bheight+10, layout); + +} + #define imagedisplay_draw_line(gc,x1,y1,x2,y2) (gdk_draw_line(drawingarea->window,gc, \ xoffs+(x1), yoffs+imagedisplay->view_height-1-(y1), \ xoffs+(x2), yoffs+imagedisplay->view_height-1-(y2))) @@ -202,6 +230,9 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even * tan(imagedisplay->imagerecord.omega)) * scale); } + /* Add scale bar */ + imagedisplay_add_scalebar(imagedisplay, drawingarea, scale, xoffs, yoffs); + /* NB This calls the function above, which sorts out stuff */ if ( imagedisplay->flags & IMAGEDISPLAY_SHOW_CENTRE ) { imagedisplay_draw_line(imagedisplay->gc_centre, diff --git a/src/mapping.c b/src/mapping.c index 54a7235..4897450 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -128,6 +128,20 @@ int mapping_scale(ImageFeature *refl, double *ddx, double *ddy) { } +/* Return the length of a 1 nm^-1 scale bar in the given image (in pixels) + * Result only strictly valid at the centre of the image */ +double mapping_scale_bar_length(ImageRecord *image) { + + switch ( image->fmode ) { + case FORMULATION_PIXELSIZE : return 1.0e9/image->pixel_size; + case FORMULATION_CLEN : return image->camera_len*image->lambda; + default : fprintf(stderr, "Unrecognised formulation mode in mapping_scale_bar_length.\n"); + } + + return 0.0; + +} + void mapping_map_features(ControlContext *ctx) { int i; diff --git a/src/mapping.h b/src/mapping.h index 6724499..82d2f04 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -18,11 +18,13 @@ #include "reflections.h" #include "control.h" +#include "image.h" extern void mapping_rotate(double x, double y, double z, double *ddx, double *ddy, double *ddz, double omega, double tilt); extern int mapping_map_to_space(ImageFeature *refl, double *ddx, double *ddy, double *ddz, double *twotheta); extern int mapping_scale(ImageFeature *refl, double *ddx, double *ddy); +extern double mapping_scale_bar_length(ImageRecord *image); extern void mapping_adjust_axis(ControlContext *ctx, double offset); extern void mapping_map_features(ControlContext *ctx); -- cgit v1.2.3 From e65956563da586d740ec11f8504b357a6b517ead Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 19:04:21 +0100 Subject: Force glbits to redraw when switching tabs in the DisplayWindow (works around tab switching issues) --- src/displaywindow.c | 9 +++++++++ src/displaywindow.h | 1 + src/glbits.c | 1 + 3 files changed, 11 insertions(+) diff --git a/src/displaywindow.c b/src/displaywindow.c index 0049747..58a5ed2 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -552,6 +552,12 @@ void displaywindow_update_imagestack(DisplayWindow *dw) { } +static void displaywindow_switch_page(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, DisplayWindow *dw) { + if ( dw->realised && (page_num == 0) ) { + glbits_expose(dw->drawing_area, NULL, dw); + } +} + DisplayWindow *displaywindow_open(ControlContext *ctx) { const char *filename; @@ -586,6 +592,7 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { dw->lines = FALSE; dw->background = TRUE; dw->cur_image = 0; + dw->realised = 0; dw->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(dw->window), title); @@ -636,6 +643,8 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_label_new("Image Stack")); } + g_signal_connect(GTK_OBJECT(notebook), "switch-page", G_CALLBACK(displaywindow_switch_page), dw); + displaywindow_enable_cell_functions(dw, FALSE); displaywindow_update_dirax(ctx, dw); d = gtk_ui_manager_get_widget(dw->ui, "/ui/displaywindow/file/savehkl"); diff --git a/src/displaywindow.h b/src/displaywindow.h index d0173f4..be93570 100644 --- a/src/displaywindow.h +++ b/src/displaywindow.h @@ -68,6 +68,7 @@ typedef struct dw_struct { GLuint gl_vshader_lightpp; GLuint gl_fshader_lightpp; GLuint gl_program_lightpp; + int realised; /* Display parameters */ DisplayWindowView view; diff --git a/src/glbits.c b/src/glbits.c index d32fc0c..3641579 100644 --- a/src/glbits.c +++ b/src/glbits.c @@ -934,6 +934,7 @@ gint glbits_realise(GtkWidget *widget, DisplayWindow *dw) { glbits_set_ortho(dw, w, h); glbits_first_prepare(dw); + dw->realised = 1; gdk_gl_drawable_gl_end(gldrawable); -- cgit v1.2.3 From c4712b41f5923f819e48ca7c886e8019e58f078e Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 19:08:02 +0100 Subject: Change background colour (Old green colours were making me feel ill) --- src/glbits.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glbits.c b/src/glbits.c index 3641579..ba03adf 100644 --- a/src/glbits.c +++ b/src/glbits.c @@ -676,8 +676,8 @@ gint glbits_expose(GtkWidget *widget, GdkEventExpose *event, DisplayWindow *dw) GLfloat w = dw->drawing_area->allocation.width; GLfloat h = dw->drawing_area->allocation.height; GLfloat aspect = w/h; - GLfloat bg_top[] = { 0.6, 0.9, 0.8, 1.0 }; - GLfloat bg_bot[] = { 0.3, 0.7, 0.5, 1.0 }; + GLfloat bg_top[] = { 0.0, 0.3, 1.0, 1.0 }; + GLfloat bg_bot[] = { 0.0, 0.7, 1.0, 1.0 }; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); -- cgit v1.2.3 From e035a3536a77f464e0b2e9bd10b05f588adf970d Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 19:09:34 +0100 Subject: Update 'About' window copyright dates --- src/displaywindow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index 58a5ed2..775b8fe 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -130,10 +130,10 @@ static void displaywindow_about(GtkWidget *widget, DisplayWindow *dw) { gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(window), PACKAGE_NAME); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window), PACKAGE_VERSION); - gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), "(c) 2006-2007 Thomas White and contributors"); + gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(window), "(c) 2006-2008 Thomas White and contributors"); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window), "Diffraction Tomography Reconstruction"); gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(window), - "(c) 2006-2007 Thomas White \n" + "(c) 2006-2008 Thomas White \n" "Virtual trackball (c) Copyright 1993, 1994, Silicon Graphics, Inc.\n" "See Credits for a full list of contributors\n" "\n" -- cgit v1.2.3 From da939b3df7315ec68220049addce9a06af2dbfbf Mon Sep 17 00:00:00 2001 From: Tom White Date: Mon, 29 Sep 2008 20:42:07 +0100 Subject: Fatter scale bar --- src/imagedisplay.c | 7 ++++++- src/imagedisplay.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/imagedisplay.c b/src/imagedisplay.c index b6de26a..42026d2 100644 --- a/src/imagedisplay.c +++ b/src/imagedisplay.c @@ -187,7 +187,7 @@ static void imagedisplay_add_scalebar(ImageDisplay *imagedisplay, GtkWidget *dra gdk_draw_rectangle(drawingarea->window, drawingarea->style->bg_gc[GTK_WIDGET_STATE(drawingarea)], TRUE, xoffs+20, yoffs+view_height-20-bheight, bwidth, bheight); - gdk_draw_line(drawingarea->window, drawingarea->style->fg_gc[GTK_WIDGET_STATE(drawingarea)], + gdk_draw_line(drawingarea->window, imagedisplay->gc_scalebar, xoffs+30, yoffs+view_height-30, xoffs+30+(scale*sb), yoffs+view_height-30); gdk_draw_layout(drawingarea->window, drawingarea->style->fg_gc[GTK_WIDGET_STATE(drawingarea)], @@ -340,6 +340,11 @@ static gint imagedisplay_realize(GtkWidget *widget, ImageDisplay *imagedisplay) gdk_color_parse("#00ddff", &colour); gdk_gc_set_rgb_fg_color(imagedisplay->gc_marks_3, &colour); + imagedisplay->gc_scalebar = gdk_gc_new(imagedisplay->drawingarea->window); + gdk_color_parse("#000000", &colour); + gdk_gc_set_rgb_fg_color(imagedisplay->gc_scalebar, &colour); + gdk_gc_set_line_attributes(imagedisplay->gc_scalebar, 5, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); + imagedisplay->realised = TRUE; return 0; diff --git a/src/imagedisplay.h b/src/imagedisplay.h index e20e4eb..3462a83 100644 --- a/src/imagedisplay.h +++ b/src/imagedisplay.h @@ -70,6 +70,7 @@ typedef struct imagedisplay_struct { GdkGC *gc_marks_1; GdkGC *gc_marks_2; GdkGC *gc_marks_3; + GdkGC *gc_scalebar; gboolean realised; unsigned int drawingarea_width; -- cgit v1.2.3 From 7e1bc829b97a61b5b644cdefa68eac045976bc62 Mon Sep 17 00:00:00 2001 From: Tom White Date: Tue, 30 Sep 2008 15:28:07 +0100 Subject: Tarmac over more redraw problems Redraw was still broken (see aa283fe34) when bringing the window to the top of the stack at the same time as focussing the 3D display tab. This adds a further extra redraw to fix it. --- src/displaywindow.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index 775b8fe..2f17498 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -554,7 +554,10 @@ void displaywindow_update_imagestack(DisplayWindow *dw) { static void displaywindow_switch_page(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, DisplayWindow *dw) { if ( dw->realised && (page_num == 0) ) { - glbits_expose(dw->drawing_area, NULL, dw); + int i; + for ( i=0; i<2; i++ ) { + glbits_expose(dw->drawing_area, NULL, dw); + } } } -- cgit v1.2.3 From e391b09d1287a3860eeaa9de7375e50e6eb87923 Mon Sep 17 00:00:00 2001 From: Tom White Date: Tue, 30 Sep 2008 17:33:13 +0100 Subject: Remove the pointless status bar --- src/displaywindow.c | 4 ---- src/displaywindow.h | 1 - 2 files changed, 5 deletions(-) diff --git a/src/displaywindow.c b/src/displaywindow.c index 2f17498..fe97f73 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -604,10 +604,6 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) { gtk_container_add(GTK_CONTAINER(dw->window), dw->bigvbox); displaywindow_addmenubar(dw); - dw->status_bar = gtk_statusbar_new(); - gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(dw->status_bar), FALSE); - gtk_box_pack_end(GTK_BOX(dw->bigvbox), dw->status_bar, FALSE, FALSE, 0); - g_signal_connect(GTK_OBJECT(dw->window), "destroy", G_CALLBACK(displaywindow_closedown), dw); notebook = gtk_notebook_new(); diff --git a/src/displaywindow.h b/src/displaywindow.h index be93570..3eee51d 100644 --- a/src/displaywindow.h +++ b/src/displaywindow.h @@ -39,7 +39,6 @@ typedef struct dw_struct { GtkActionGroup *action_group; GtkWidget *window; GtkWidget *bigvbox; - GtkWidget *status_bar; GtkWidget *drawing_area; GtkWidget *savecache_window; -- cgit v1.2.3 From b5220723413ca8088ba6e21b6c5fecb589d18949 Mon Sep 17 00:00:00 2001 From: Tom White Date: Wed, 1 Oct 2008 11:42:19 +0100 Subject: Display modulus of deviation Conflicts: src/refine.c --- src/refine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/refine.c b/src/refine.c index 431d526..3a61170 100644 --- a/src/refine.c +++ b/src/refine.c @@ -402,7 +402,8 @@ double refine_do_cell(ControlContext *ctx) { mapping_rotate(dx, dy, 0.0, &dlx, &dly, &dlz, image->omega, image->tilt); rf->partner->x = old_x; rf->partner->y = old_y; - printf("=> %+10.5f %+10.5f %+10.5f nm^-1\n", dlx/DISPFACTOR, dly/DISPFACTOR, dlz/DISPFACTOR); + double mod = sqrt(dx*dx + dy*dy)/DISPFACTOR; + printf("=> %+10.5f %+10.5f %+10.5f nm^-1 (length %10.5f nm^1)\n", dlx/DISPFACTOR, dly/DISPFACTOR, dlz/DISPFACTOR, mod); d[f].dx = dlx; d[f].dy = dly; -- cgit v1.2.3 From 8310cde840be611931c24a0fb3e1b9861eecb676 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 1 Oct 2008 18:51:25 +0100 Subject: Update copyright date in src/displaywindow.h (cherry picked from commit 6f0d677b94371a834a695b97cdab19eb2e6adb43) --- src/displaywindow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displaywindow.h b/src/displaywindow.h index 3eee51d..052e7d3 100644 --- a/src/displaywindow.h +++ b/src/displaywindow.h @@ -3,7 +3,7 @@ * * The display window * - * (c) 2007 Thomas White + * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * -- cgit v1.2.3