aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-05 23:51:27 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-05 23:51:27 +0000
commit787209d148adb0d7fd2aecfba641d9232bba6f52 (patch)
treee74b97890b48138fc3df986cfa7e8050033337d3 /src
parente00d6b3da60009117012f1d31dbdd7b4ed129480 (diff)
Debug reprojector (needs debodging)
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@122 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src')
-rw-r--r--src/ipr.c6
-rw-r--r--src/reflections.c2
-rw-r--r--src/reproject.c12
3 files changed, 12 insertions, 8 deletions
diff --git a/src/ipr.c b/src/ipr.c
index 25078dd..79368e1 100644
--- a/src/ipr.c
+++ b/src/ipr.c
@@ -207,9 +207,9 @@ static ReflectionContext *ipr_generate(ControlContext *ctx, Basis *basis) {
}
ordered = reflection_init();
- basis->a.x = 1.842e9; basis->a.y = 0.0; basis->a.z = 0.0;
- basis->b.x = 0.0; basis->b.y = 1.842e9; basis->b.z = 0.0;
- basis->c.x = 0.0; basis->c.y = 0.0; basis->c.z = 1.842e9;
+// basis->a.x = 1.842e9; basis->a.y = 0.0; basis->a.z = 0.0;
+// basis->b.x = 0.0; basis->b.y = 1.842e9; basis->b.z = 0.0;
+// basis->c.x = 0.0; basis->c.y = 0.0; basis->c.z = 1.842e9;
for ( h=-30; h<=30; h++ ) {
for ( k=-30; k<=30; k++ ) {
for ( l=-30; l<=30; l++ ) {
diff --git a/src/reflections.c b/src/reflections.c
index dde8d84..ab626fa 100644
--- a/src/reflections.c
+++ b/src/reflections.c
@@ -177,7 +177,7 @@ void reflection_add_from_dp(ControlContext *ctx, double x, double y, ImageRecord
nx = x_temp;
ny = cos(tilt)*y_temp + sin(tilt)*z_temp;
nz = -sin(tilt)*y_temp + cos(tilt)*z_temp;
-
+
/* Finally, reverse the omega rotation to restore the location of the image in 3D space */
x_temp = nx; y_temp = ny; z_temp = nz;
nx = x_temp*cos(-omega) + y_temp*sin(-omega);
diff --git a/src/reproject.c b/src/reproject.c
index 9a54281..78cced6 100644
--- a/src/reproject.c
+++ b/src/reproject.c
@@ -42,19 +42,21 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
nxt = 0.0; nyt = 0.0; nzt = 1.0;
nx = nxt; ny = cos(tilt)*nyt + sin(tilt)*nzt; nz = -sin(tilt)*nyt + cos(tilt)*nzt;
nxt = nx; nyt = ny; nzt = nz;
- nx = nxt*cos(omega) + nyt*sin(omega); ny = -nxt*sin(omega) + nyt*cos(omega); nz = nzt;
+ nx = nxt*cos(-omega) + nyt*sin(-omega); ny = -nxt*sin(-omega) + nyt*cos(-omega); nz = nzt;
kx = nx / image.lambda;
ky = ny / image.lambda;
kz = nz / image.lambda; /* This is the centre of the Ewald sphere */
reflection_add(ctx->reflectionctx, kx, ky, kz, 1, REFLECTION_VECTOR_MARKER_1);
/* Determine where "up" is */
- uxt = sin(-omega); uyt = cos(-omega); uzt = 0;
+ uxt = 0.0; uyt = 1.0; uzt = 0.0;
ux = uxt; uy = cos(tilt)*uyt + sin(tilt)*uzt; uz = -sin(tilt)*uyt + cos(tilt)*uzt;
uxt = ux; uyt = uy; uzt = uz;
- ux = uxt*cos(omega) + uyt*-sin(omega); uy = -uxt*sin(omega) + uyt*cos(omega); uz = uzt;
+ ux = uxt*cos(-omega) + uyt*-sin(omega); uy = -uxt*sin(omega) + uyt*cos(omega); uz = uzt;
reflection_add(ctx->reflectionctx, ux*50, uy*50, uz*50, 1, REFLECTION_VECTOR_MARKER_2);
+ printf("angle between k and u is %f\n", rad2deg(angle_between(kx, ky, kz, ux, uy, uz)));
+
do {
double xl, yl, zl;
@@ -116,6 +118,8 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
else if ( (psi < M_PI_2) && (disc >= M_PI_2) ) psi = 3*M_PI_2 + psi; /* Case 4 */
psi = M_PI_2 - psi; /* Anticlockwise from "+x" instead of clockwise from "up" */
+ psi += omega;
+
/* Calculate image coordinates from polar representation */
if ( image.fmode == FORMULATION_CLEN ) {
x = image.camera_len*sin(theta)*cos(psi);
@@ -135,7 +139,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
/* Adjust centre */
x += image.x_centre;
y += image.y_centre;
-
+ x = image.width - 1 - x; /* Debodge me */
/* Sanity check */
if ( (x>=0) && (x<image.width) && (y>=0) && (y<image.height) ) {