aboutsummaryrefslogtreecommitdiff
path: root/src/reflections.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-19 16:25:08 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-19 16:25:08 +0000
commit45864cb5113ec4dde6afe1d23ea53f75402b9ece (patch)
treeb3d4dad81bcfa34037cb067e1356303b32401df1 /src/reflections.c
parent7c4c25f2eda4f0a0780cf2edb087452ceb63f226 (diff)
Refactor image handling code
Remove itrans-lsq git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@158 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reflections.c')
-rw-r--r--src/reflections.c124
1 files changed, 0 insertions, 124 deletions
diff --git a/src/reflections.c b/src/reflections.c
index 0005332..7fcec2f 100644
--- a/src/reflections.c
+++ b/src/reflections.c
@@ -126,94 +126,6 @@ Reflection *reflection_add(ReflectionList *reflectionlist, double x, double y, d
}
-int reflection_map_to_space(ImageReflection *refl, double *ddx, double *ddy, double *ddz, double *twotheta) {
-
- /* "Input" space */
- double d, x, y;
- ImageRecord *imagerecord;
-
- /* Angular description of reflection */
- double theta, psi, k;
-
- /* Reciprocal space */
- double tilt;
- double omega;
-
- double x_temp, y_temp, z_temp;
- double nx, ny, nz;
-
- imagerecord = refl->parent;
- x = refl->x; y = refl->y;
- tilt = 2*M_PI*(imagerecord->tilt/360); /* Convert to Radians */
- omega = 2*M_PI*(imagerecord->omega/360); /* Likewise */
- k = 1/imagerecord->lambda;
-
- /* Calculate an angular description of the reflection */
- if ( imagerecord->fmode == FORMULATION_CLEN ) {
- x /= imagerecord->resolution;
- y /= imagerecord->resolution; /* Convert pixels to metres */
- d = sqrt((x*x) + (y*y));
- theta = atan2(d, imagerecord->camera_len);
- } else if (imagerecord->fmode == FORMULATION_PIXELSIZE ) {
- x *= imagerecord->pixel_size;
- y *= imagerecord->pixel_size; /* Convert pixels to metres^-1 */
- d = sqrt((x*x) + (y*y));
- theta = atan2(d, k);
- } else {
- fprintf(stderr, "Unrecognised formulation mode in reflection_add_from_dp\n");
- return -1;
- }
- psi = atan2(y, x);
-
- x_temp = k*sin(theta)*cos(psi);
- y_temp = k*sin(theta)*sin(psi);
- z_temp = k - k*cos(theta);
-
- /* Apply the rotations...
- First: rotate image clockwise until tilt axis is aligned horizontally. */
- nx = x_temp*cos(omega) + y_temp*sin(omega);
- ny = -x_temp*sin(omega) + y_temp*cos(omega);
- nz = z_temp;
-
- /* Now, tilt about the x-axis ANTICLOCKWISE around +x, i.e. the "wrong" way.
- This is because the crystal is rotated in the experiment, not the Ewald sphere. */
- x_temp = nx; y_temp = ny; z_temp = nz;
- 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);
- ny = -x_temp*sin(-omega) + y_temp*cos(-omega);
- nz = z_temp;
-
- *ddx = nx;
- *ddy = ny;
- *ddz = nz;
- *twotheta = theta; /* Radians. I've used the "wrong" nomenclature above */
-
- return 0;
-
-}
-
-/* x and y in pixels, measured from centre of image */
-void reflection_add_from_dp(ControlContext *ctx, double x, double y, ImageRecord *imagerecord, double intensity) {
-
- double nx, ny, nz, twotheta;
- ImageReflection refl;
-
- refl.parent = imagerecord;
- refl.x = x;
- refl.y = y;
- refl.intensity = intensity;
-
- if ( !reflection_map_to_space(&refl, &nx, &ny, &nz, &twotheta) ) {
- reflection_add(ctx->reflectionlist, nx, ny, nz, intensity, REFLECTION_NORMAL);
- }
-
-}
-
void reflection_add_from_reflection(ReflectionList *reflectionlist, Reflection *r) {
if ( reflectionlist->last_reflection ) {
reflectionlist->last_reflection->next = r;
@@ -315,42 +227,6 @@ Reflection *reflectionlist_find_nearest_type(ReflectionList *reflectionlist, dou
}
-/* This destroys the lfom values in the input list */
-ReflectionList *reflectionlist_sort_lfom(ReflectionList *in) {
-
- ReflectionList *out;
- Reflection *best;
-
- out = reflectionlist_new();
-
- do {
-
- Reflection *reflection;
- int lfom = 0;
-
- reflection = in->reflections;
- best = NULL;
- while ( reflection ) {
- if ( reflection->lfom > lfom ) {
- best = reflection;
- lfom = reflection->lfom;
- }
- reflection = reflection->next;
- };
-
- if ( best ) {
- Reflection *new;
- new = reflection_add(out, best->x, best->y, best->z, best->intensity, best->type);
- new->lfom = best->lfom;
- best->lfom = 0;
- }
-
- } while ( best );
-
- return out;
-
-}
-
/* Generate a list of reflections from a unit cell */
ReflectionList *reflection_list_from_cell(Basis *basis) {