aboutsummaryrefslogtreecommitdiff
path: root/src/reproject.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-24 17:54:49 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-24 17:54:49 +0000
commit55846b287d574815ccbf31243782f302c403917d (patch)
tree663fff21014f643de48ee831eb74e9462ada81b8 /src/reproject.c
parent74d58e5f81c7b010aa4db3627f119f9df47c10fa (diff)
More reprojection
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@75 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r--src/reproject.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/reproject.c b/src/reproject.c
index c9023af..c6cf2ce 100644
--- a/src/reproject.c
+++ b/src/reproject.c
@@ -54,12 +54,12 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
ny = xt*sin(omega) + yt*cos(omega);
nz = zt;
- /* Next, solve the reprojection equation to calculate the excitation error */
- a = nx*nx + ny*ny + nz*nz;
- b = 2*(xl*nx + yl*ny + zl*nz - nz/image.lambda);
- c = xl*xl + yl*yl + zl*zl - 2*zl/image.lambda;
- s1 = (-b + sqrt(b*b-4*a*c))/(2*a);
- s2 = (-b - sqrt(b*b-4*a*c))/(2*a);
+ /* Next, solve the relrod equation to calculate the excitation error */
+ a = 1.0;
+ b = 2.0*(xl*nx + yl*ny + zl*nz - nz/image.lambda);
+ c = xl*xl + yl*yl + zl*zl - 2.0*zl/image.lambda;
+ s1 = (-b + sqrt(b*b-4.0*a*c))/(2.0*a);
+ s2 = (-b - sqrt(b*b-4.0*a*c))/(2.0*a);
if ( s1 < s2 ) s = s1; else s = s2;
/* Skip this reflection if s is large */
@@ -73,7 +73,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
/* Determine the intersection point */
xddd = xl + s*nx; yddd = yl + s*ny; zddd = zl + s*nz;
-
+ printf("intersection at %f,%f,%f\n", xddd, yddd,zddd);
/* Invert the image->3D mapping to get the image coordinates */
xdd = xddd;
ydd = (yddd/cos(tilt) - zddd*tan(tilt)/cos(tilt))/(1+tan(tilt)*tan(tilt));
@@ -109,12 +109,15 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
refl[i].y = y;
i++;
- if ( i > MAX_IMAGE_REFLECTIONS ) break;
+ if ( i > MAX_IMAGE_REFLECTIONS ) {
+ fprintf(stderr, "Too many reflections\n");
+ break;
+ }
printf("Reflection %i at %i,%i\n", i, refl[i-1].x, refl[i-1].y);
} else {
- fprintf(stderr, "Reflection failed sanity test\n");
+ fprintf(stderr, "Reflection failed sanity test (x=%f, y=%f)\n", x, y);
}
}
@@ -123,6 +126,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
} while ( reflection );
+ printf("Found %i reflections in image\n", i);
*n = i;
return refl;