aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-04 10:34:54 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-04 10:34:54 +0000
commite3a59f0de58d873837252d4decdd8f727392fad7 (patch)
treedf9dff6bfd8633065467492a2dc25c216041ce12 /src
parent6c4cc88d5248507a3ce9970e1ed8eca60b60952a (diff)
Tidy-up
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@153 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/dirax.c12
-rw-r--r--src/displaywindow.c15
-rw-r--r--src/displaywindow.h73
-rw-r--r--src/ipr.c92
-rw-r--r--src/ipr.h25
-rw-r--r--src/main.c1
7 files changed, 56 insertions, 164 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0be30fc..eef1fa6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
bin_PROGRAMS = dtr
-dtr_SOURCES = main.c displaywindow.c trackball.c reflections.c readpng.c mrc.c imagedisplay.c utils.c itrans.c qdrp.c ipr.c cache.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-lsq.c itrans-stat.c control.c mapping.c reproject.c prealign.c basis.c \
dirax.c
dtr_LDADD = @LIBS@ @GTK_LIBS@ -lm @GTKGLEXT_LIBS@ -lgsl -lgslcblas -lutil
diff --git a/src/dirax.c b/src/dirax.c
index 79ad808..aadc82d 100644
--- a/src/dirax.c
+++ b/src/dirax.c
@@ -52,6 +52,11 @@ static void dirax_parseline(const char *line, ControlContext *ctx) {
printf("DX: DirAx: %s\n", copy);
free(copy);
+ if ( strstr(line, "reflections from file") ) {
+ displaywindow_error("DirAx can't understand this data.", ctx->dw);
+ return;
+ }
+
/* Is this the first line of a unit cell specification? */
rf = 0; i = 0;
while ( (i<strlen(line)) && ((line[i] == 'R') || (line[i] == 'D') || (line[i] == ' ')) ) {
@@ -361,9 +366,14 @@ void dirax_invoke(ControlContext *ctx) {
}
fprintf(fh, "%f\n", 0.5); /* Lie about the wavelength. DirAx can't handle the truth. */
ref = ctx->reflectionlist->reflections;
+ int i=0;
while ( ref ) {
- fprintf(fh, "%f %f %f %f\n", ref->x/1e10, ref->y/1e10, ref->z/1e10, ref->intensity);
+ fprintf(fh, "%10f %10f %10f %8f\n", ref->x/1e10, ref->y/1e10, ref->z/1e10, ref->intensity);
ref = ref->next;
+ i++;
+ if ( i==14 ) {
+ printf("%10f %10f %10f %8f\n", ref->x/1e10, ref->y/1e10, ref->z/1e10, ref->intensity);
+ }
}
fclose(fh);
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 5d4a8c2..250f790 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -28,18 +28,12 @@
#include "trackball.h"
#include "reflections.h"
#include "main.h"
-#include "ipr.h"
#include "displaywindow.h"
#include "basis.h"
#include "dirax.h"
#include "reproject.h"
#include "cache.h"
-enum {
- DW_ORTHO,
- DW_PERSPECTIVE
-};
-
static void displaywindow_gl_set_ortho(DisplayWindow *dw, GLfloat w, GLfloat h) {
glMatrixMode(GL_PROJECTION);
@@ -181,8 +175,9 @@ static gint displaywindow_gl_motion_notify(GtkWidget *widget, GdkEventMotion *ev
#define DRAW_POINTER \
glBegin(GL_LINES); \
- glVertex3f(50, 0.0, 0.0); \
- glVertex3f(-50, 0.0, 0.0); \
+ glNormal3f(1.0, 0.0, 0.0); \
+ glVertex3f(50.0, 0.0, 0.0); \
+ glVertex3f(-50.0, 0.0, 0.0); \
glEnd(); \
glBegin(GL_TRIANGLE_FAN); \
glNormal3f(1.0, 0.0, 0.0); \
@@ -535,8 +530,8 @@ static void displaywindow_gl_create_list(DisplayWindow *dw) {
* Since the rotation is about +z, this is already anticlockwise
* when looking down z. */
glRotatef(ctx->images[0].omega, 0.0, 0.0, 1.0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black);
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, yellow);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, yellow);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, black);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.0);
DRAW_POINTER
diff --git a/src/displaywindow.h b/src/displaywindow.h
index ab9298b..555cb5b 100644
--- a/src/displaywindow.h
+++ b/src/displaywindow.h
@@ -21,47 +21,52 @@
#include "control.h"
+typedef enum {
+ DW_ORTHO,
+ DW_PERSPECTIVE
+} DisplayWindowView;
+
typedef struct dw_struct {
- ControlContext *ctx;
+ ControlContext *ctx;
- GtkUIManager *ui;
- GtkActionGroup *action_group;
- GtkWidget *window;
- GtkWidget *bigvbox;
- GtkWidget *status_bar;
- int view;
- GtkWidget *drawing_area;
- GtkWidget *savecache_window;
+ GtkUIManager *ui;
+ GtkActionGroup *action_group;
+ GtkWidget *window;
+ GtkWidget *bigvbox;
+ GtkWidget *status_bar;
+ DisplayWindowView view;
+ GtkWidget *drawing_area;
+ GtkWidget *savecache_window;
/* Low-level OpenGL stuff */
- GLuint gl_list_id; /* Display list for "everything else" */
- int gl_use_buffers; /* 0=use vertex arrays only, otherwise use VBOs */
- GLuint gl_ref_vertex_buffer; /* "Measured reflection" stuff */
- GLfloat *gl_ref_vertex_array;
- GLuint gl_ref_normal_buffer;
- GLfloat *gl_ref_normal_array;
- GLsizei gl_ref_num_vertices;
- GLuint gl_marker_vertex_buffer; /* Marker "reflection" stuff */
- GLuint gl_marker_normal_buffer;
- GLfloat *gl_marker_vertex_array;
- GLfloat *gl_marker_normal_array;
- GLsizei gl_marker_num_vertices;
- GLuint gl_gen_vertex_buffer; /* Generated reflection stuff */
- GLuint gl_gen_normal_buffer;
- GLfloat *gl_gen_vertex_array;
- GLfloat *gl_gen_normal_array;
- GLsizei gl_gen_num_vertices;
+ GLuint gl_list_id; /* Display list for "everything else" */
+ int gl_use_buffers; /* 0=use vertex arrays only, otherwise use VBOs */
+ GLuint gl_ref_vertex_buffer; /* "Measured reflection" stuff */
+ GLfloat *gl_ref_vertex_array;
+ GLuint gl_ref_normal_buffer;
+ GLfloat *gl_ref_normal_array;
+ GLsizei gl_ref_num_vertices;
+ GLuint gl_marker_vertex_buffer; /* Marker "reflection" stuff */
+ GLuint gl_marker_normal_buffer;
+ GLfloat *gl_marker_vertex_array;
+ GLfloat *gl_marker_normal_array;
+ GLsizei gl_marker_num_vertices;
+ GLuint gl_gen_vertex_buffer; /* Generated reflection stuff */
+ GLuint gl_gen_normal_buffer;
+ GLfloat *gl_gen_vertex_array;
+ GLfloat *gl_gen_normal_array;
+ GLsizei gl_gen_num_vertices;
/* Display parameters */
- GLfloat distance;
- GLfloat x_pos;
- GLfloat y_pos;
- float view_quat[4];
- int cube;
- int lines;
- float x_start;
- float y_start;
+ GLfloat distance;
+ GLfloat x_pos;
+ GLfloat y_pos;
+ float view_quat[4];
+ int cube;
+ int lines;
+ float x_start;
+ float y_start;
} DisplayWindow;
diff --git a/src/ipr.c b/src/ipr.c
deleted file mode 100644
index 787106a..0000000
--- a/src/ipr.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * ipr.c
- *
- * Iterative Prediction-Refinement Reconstruction
- *
- * (c) 2007 Thomas White <taw27@cam.ac.uk>
- *
- * dtr - Diffraction Tomography Reconstruction
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "control.h"
-#include "reflections.h"
-#include "itrans.h"
-#include "utils.h"
-#include "imagedisplay.h"
-#include "reproject.h"
-#include "ipr.h"
-#include "displaywindow.h"
-#include "basis.h"
-
-static gint ipr_clicked(GtkWidget *widget, GdkEventButton *event, ControlContext *ctx) {
-
- ImageReflection *refl;
- size_t n, j;
-
- ctx->ipr_cur_image++;
- if ( ctx->ipr_cur_image == ctx->n_images ) ctx->ipr_cur_image = 0;
-
- imagedisplay_clear_circles(ctx->ipr_id);
- reflectionlist_clear_markers(ctx->reflectionlist);
-
- refl = reproject_get_reflections(ctx->images[ctx->ipr_cur_image], &n, ctx->ipr_lat, ctx);
- for ( j=0; j<n; j++ ) {
- imagedisplay_mark_circle(ctx->ipr_id, refl[j].x, refl[j].y);
- }
-
- imagedisplay_put_data(ctx->ipr_id, ctx->images[ctx->ipr_cur_image]);
- displaywindow_update(ctx->dw);
-
- return 0;
-
-}
-
-int ipr_refine(ControlContext *ctx) {
-
- Basis *basis;
- int finished;
-
- basis = basis_find(ctx);
- if ( !basis ) {
- printf("IP: Unable to find basis\n");
- return -1;
- }
-
- ctx->ipr_basis = basis;
- ctx->ipr_lat = reflection_list_from_cell(basis);
-
- printf("IP: Performing refinement...\n");
- finished = 0;
- do {
-
- size_t n, j;
- ImageReflection *refl;
-
- /* Select an image */
- ctx->ipr_cur_image = 0;
-
- ctx->ipr_id = imagedisplay_open_with_message(ctx->images[ctx->ipr_cur_image], "Current Image", "Click to change image",
- IMAGEDISPLAY_SHOW_CENTRE | IMAGEDISPLAY_SHOW_TILT_AXIS, G_CALLBACK(ipr_clicked), ctx);
-
- refl = reproject_get_reflections(ctx->images[ctx->ipr_cur_image], &n, ctx->ipr_lat, ctx);
- for ( j=0; j<n; j++ ) {
- imagedisplay_mark_circle(ctx->ipr_id, refl[j].x, refl[j].y);
- }
-
- finished = 1;
-
- } while ( !finished );
-
- return 0;
-
-}
-
diff --git a/src/ipr.h b/src/ipr.h
deleted file mode 100644
index 8fb4862..0000000
--- a/src/ipr.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * ipr.h
- *
- * Iterative prediction-refinement reconstruction
- *
- * (c) 2007 Thomas White <taw27@cam.ac.uk>
- *
- * dtr - Diffraction Tomography Reconstruction
- *
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef IPR_H
-#define IPR_H
-
-#include "control.h"
-
-extern int ipr_refine(ControlContext *ctx);
-
-#endif /* IPR_H */
-
diff --git a/src/main.c b/src/main.c
index 374f3e8..ac30bed 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,7 +28,6 @@
#include "reflections.h"
#include "mrc.h"
#include "qdrp.h"
-#include "ipr.h"
#include "cache.h"
#include "mapping.h"
#include "prealign.h"