aboutsummaryrefslogtreecommitdiff
path: root/src/reproject.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-30 12:14:32 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-30 12:14:32 +0000
commite9a2b408c139a17e431dfb84384edd62a2ead7e3 (patch)
tree3bac693f8b773553f29456973dd77317378c6e8f /src/reproject.c
parent0126d58f87dae943396f3701d83ccb1686143568 (diff)
Merge the two reflection_add routines for different formulations
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@95 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r--src/reproject.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/reproject.c b/src/reproject.c
index 1deb044..faa9433 100644
--- a/src/reproject.c
+++ b/src/reproject.c
@@ -26,8 +26,8 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
double smax = 0.5e9;
double tilt, omega;
- tilt = 2*M_PI*(image.tilt/360);
- omega = 2*M_PI*(image.omega/360); /* Convert to Radians */
+ tilt = deg2rad(image.tilt);
+ omega = deg2rad(image.omega);
refl = malloc(MAX_IMAGE_REFLECTIONS*sizeof(ImageReflection));
@@ -88,8 +88,6 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
gy = yi - ky;
gz = zi - kz; /* This is the vector from the centre of the sphere to the intersection */
theta = angle_between(-kx, -ky, -kz, gx, gy, gz);
- printf("theta=%f ", theta);
- theta = deg2rad(theta);
cx = nz*gy - ny*gz;
cy = nz*gx - nx*gz;
cz = ny*gx - nx*gy;
@@ -99,10 +97,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
ux = uyt*-sin(omega);
uy = uyt*cos(omega);
uz = uzt;
- psi = angle_between(cx, cy, cz, ux, uy, uz);
- psi -= 90;
- printf("psi=%f\n", psi);
- psi = deg2rad(psi);
+ psi = angle_between(cx, cy, cz, ux, uy, uz) - M_PI_2;
if ( image.fmode == FORMULATION_CLEN ) {
x = image.camera_len*sin(theta)*cos(psi);
@@ -110,8 +105,10 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
x *= image.resolution;
y *= image.resolution;
} else if ( image.fmode == FORMULATION_PIXELSIZE ) {
- x = 0;
- y = 0;
+ x = sin(theta)*cos(psi) / image.lambda;
+ y = sin(theta)*sin(psi) / image.lambda;
+ x /= image.pixel_size;
+ y /= image.pixel_size;
} else {
fprintf(stderr, "Unrecognised formulation mode in reproject_get_reflections()\n");
return NULL;