aboutsummaryrefslogtreecommitdiff
path: root/src/mapping.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-28 21:39:35 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-08-28 21:39:35 +0000
commit50a75cc5458ba553f5cdcede6c9699f7a0347377 (patch)
tree993e70c4dc75885a3f207ba79b71a22c4d3aee66 /src/mapping.c
parent85b8978beedd0142560573a92442a5ed907b0ed2 (diff)
Use unsigned types for image storage
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@82 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/mapping.c')
-rw-r--r--src/mapping.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mapping.c b/src/mapping.c
index 24a6470..6d74ddd 100644
--- a/src/mapping.c
+++ b/src/mapping.c
@@ -21,20 +21,20 @@
ReflectionContext *mapping_create(ControlContext *ctx) {
ReflectionContext *rctx;
- ImageDisplay *sum_id;
- int16_t max_val;
- int max_x, max_y;
- int twidth, theight;
- int x, y, i;
- int16_t *image_total;
- double x_centre = 0;
- double y_centre = 0;
+ int i;
/* Create reflection context */
rctx = reflection_init();
if ( !ctx->prealign ) {
+ int max_x, max_y;
+ uint16_t max_val;
+ int twidth, theight;
+ int x, y;
+ uint16_t *image_total;
+ ImageDisplay *sum_id;
+
/* Find centre of image stack
* Determine maximum size of image to accommodate, and allocate memory */
twidth = 0; theight = 0;
@@ -42,8 +42,8 @@ ReflectionContext *mapping_create(ControlContext *ctx) {
if ( ctx->images[i].width > twidth ) twidth = ctx->images[i].width;
if ( ctx->images[i].height > theight ) theight = ctx->images[i].height;
}
- image_total = malloc(twidth * theight * sizeof(int16_t));
- memset(image_total, 0, twidth * theight * sizeof(int16_t));
+ image_total = malloc(twidth * theight * sizeof(uint16_t));
+ memset(image_total, 0, twidth * theight * sizeof(uint16_t));
/* Add the image stack together */
for ( i=0; i<ctx->n_images; i++ ) {
@@ -67,13 +67,17 @@ ReflectionContext *mapping_create(ControlContext *ctx) {
}
}
}
- x_centre = max_x;
- y_centre = max_y;
+
+ /* Record this measurement on all images */
+ for ( i=0; i<ctx->n_images; i++ ) {
+ ctx->images[i].x_centre = max_x;
+ ctx->images[i].y_centre = max_y;
+ }
/* Display */
sum_id = imagedisplay_open(image_total, twidth, theight, "Sum of All Images");
- imagedisplay_mark_point(sum_id, x_centre, y_centre);
- imagedisplay_add_tilt_axis(sum_id, x_centre, y_centre, ctx->omega);
+ imagedisplay_mark_point(sum_id, max_x, max_y);
+ imagedisplay_add_tilt_axis(sum_id, max_x, max_y, ctx->omega);
}
@@ -81,10 +85,6 @@ ReflectionContext *mapping_create(ControlContext *ctx) {
* (let itrans add the reflections to rctx for now) */
ctx->reflectionctx = rctx;
for ( i=0; i<ctx->n_images; i++ ) {
- if ( !ctx->prealign ) {
- ctx->images[i].x_centre = x_centre;
- ctx->images[i].y_centre = y_centre;
- }
itrans_process_image(ctx->images[i], ctx);
}