aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 08:53:21 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-27 08:53:21 +0000
commita7d5360db028fc24547ece8e7a4bc49ecfaa8743 (patch)
tree32709dc2efd00932598812373c0120ed3f26d063 /src
parent96c70acb11075f0b06f43f5b054241ac7048d705 (diff)
Further work on previous stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@133 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src')
-rw-r--r--src/ipr.c36
-rw-r--r--src/reproject.c4
2 files changed, 22 insertions, 18 deletions
diff --git a/src/ipr.c b/src/ipr.c
index 6b2f57f..9324426 100644
--- a/src/ipr.c
+++ b/src/ipr.c
@@ -43,34 +43,38 @@ static Basis *ipr_choose_random_basis(ControlContext *ctx) {
double tilt_max;
double tilt_mid;
ImageRecord *imagerecord;
- double nx, ny;
+ double x_temp, y_temp, z_temp;
double scale;
- ImageReflection refl;
- double x, y, z, twotheta;
+ double x, y, z;
Reflection *centre;
/* Locate the 'plane' in the middle of the "wedge" */
tilt_min = control_min_tilt(ctx);
tilt_max = control_max_tilt(ctx);
tilt_mid = tilt_min + (tilt_max-tilt_min)/2;
- imagerecord = control_image_nearest_tilt(ctx, tilt_min);
+ imagerecord = control_image_nearest_tilt(ctx, tilt_mid);
- /* Find the point in the middle of the "wedge" */
- scale = reflection_largest_g(ctx->reflectionctx);
- nx = imagerecord->x_centre - scale*sin(imagerecord->omega);
- ny = imagerecord->y_centre + scale*cos(imagerecord->omega);
+ /* Apply the last two steps of the mapping transform to get the direction from the origin
+ * towards the middle of the wedge */
+ printf("tilt_mid=%f deg, tilt=%f deg\n", tilt_mid, imagerecord->tilt);
+ x_temp = 0.0;
+ y_temp = cos(imagerecord->tilt);
+ z_temp = -sin(imagerecord->tilt);
+ x = x_temp*cos(-imagerecord->omega) + y_temp*sin(-imagerecord->omega);
+ y = -x_temp*sin(-imagerecord->omega) + y_temp*cos(-imagerecord->omega);
+ z = z_temp;
- /* Find where this point is in 3D space */
- refl.x = nx;
- refl.y = ny;
- refl.parent = imagerecord;
- if ( reflection_map_to_space(&refl, &x, &y, &z, &twotheta) ) return NULL;
+ /* Find the point in the middle of the "wedge" */
+ scale = reflection_largest_g(ctx->reflectionctx)/4;
+ x *= scale;
+ y *= scale;
+ z *= scale;
+ reflection_add(ctx->reflectionctx, x, y, z, 1.0, REFLECTION_VECTOR_MARKER_1);
+ reflection_add(ctx->reflectionctx, x_temp*scale, y_temp*scale, z_temp*scale, 1.0, REFLECTION_VECTOR_MARKER_3);
- /* Find the nearest reflection */
centre = reflection_find_nearest(ctx->reflectionctx, x, y, z);
if ( !centre ) return NULL;
- reflection_add(ctx->reflectionctx, centre->x, centre->y, centre->z, 1.0, REFLECTION_MARKER);
- printf("Nearest %f,%f,%f is %f,%f,%f\n", x, y, z, centre->x, centre->y, centre->z);
+ reflection_add(ctx->reflectionctx, centre->x, centre->y, centre->z, 1.0, REFLECTION_VECTOR_MARKER_2);
basis = malloc(sizeof(Basis));
diff --git a/src/reproject.c b/src/reproject.c
index 0d79900..0971b25 100644
--- a/src/reproject.c
+++ b/src/reproject.c
@@ -48,7 +48,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
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);
+ //reflection_add(ctx->reflectionctx, kx, ky, kz, 1, REFLECTION_VECTOR_MARKER_1);
/* Determine where "up" is
* See above. */
@@ -56,7 +56,7 @@ ImageReflection *reproject_get_reflections(ImageRecord image, size_t *n, Reflect
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;
- reflection_add(ctx->reflectionctx, ux*50e9, uy*50e9, uz*50e9, 1, REFLECTION_VECTOR_MARKER_2);
+ //reflection_add(ctx->reflectionctx, ux*50e9, uy*50e9, uz*50e9, 1, REFLECTION_VECTOR_MARKER_2);
do {