aboutsummaryrefslogtreecommitdiff
path: root/src/control.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-26 17:13:46 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-09-26 17:13:46 +0000
commitb419ab4428ff4fa0d58354abe6f2a953b9e236ee (patch)
treed9c6115485bdba34900717f6f2e7a66aaf487aa8 /src/control.c
parent4930a9088b8a13195a7038e9606e1a857fd6883f (diff)
Beginnings of a new initial basis choice (needs fixing)
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@131 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/control.c')
-rw-r--r--src/control.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/control.c b/src/control.c
index ac3de0b..97ad34c 100644
--- a/src/control.c
+++ b/src/control.c
@@ -25,6 +25,7 @@ int control_add_image(ControlContext *ctx, uint16_t *image, int width, int heigh
ctx->images[ctx->n_images].fmode = ctx->fmode;
ctx->images[ctx->n_images].x_centre = ctx->x_centre;
ctx->images[ctx->n_images].y_centre = ctx->y_centre;
+ ctx->images[ctx->n_images].slop = 0.0;
if ( ctx->fmode == FORMULATION_PIXELSIZE ) {
ctx->images[ctx->n_images].pixel_size = ctx->pixel_size;
@@ -56,3 +57,49 @@ ControlContext *control_ctx_new() {
}
+/* Return the minimum (most negative) tilt angle used */
+double control_min_tilt(ControlContext *ctx) {
+
+ int i;
+ double min = 360;
+
+ for ( i=0; i<ctx->n_images; i++ ) {
+ if ( ctx->images[i].tilt < min ) min = ctx->images[i].tilt;
+ }
+
+ return min;
+
+}
+
+/* Return the maximum (most negative) tilt angle used */
+double control_max_tilt(ControlContext *ctx) {
+
+ int i;
+ double max = -360;
+
+ for ( i=0; i<ctx->n_images; i++ ) {
+ if ( ctx->images[i].tilt > max ) max = ctx->images[i].tilt;
+ }
+
+ return max;
+
+}
+
+/* Return a reference to the image record with tilt closest to the given value */
+ImageRecord *control_image_nearest_tilt(ControlContext *ctx, double tilt) {
+
+ int i;
+ double dev = 360;
+ ImageRecord *im = NULL;
+
+ for ( i=0; i<ctx->n_images; i++ ) {
+ if ( ctx->images[i].tilt - tilt < dev ) {
+ dev = ctx->images[i].tilt - tilt;
+ im = &ctx->images[i];
+ }
+ }
+
+ return im;
+
+}
+