aboutsummaryrefslogtreecommitdiff
path: root/src/control.c
blob: 1b4e8266eda1f461072a7cbf9e1a1b5f5f95523d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * control.c
 *
 * Common control structure
 *
 * (c) 2007 Thomas White <taw27@cam.ac.uk>
 *
 *  dtr - Diffraction Tomography Reconstruction
 *
 */

#include <inttypes.h>

#include "control.h"

int control_add_image(ControlContext *ctx, int16_t *image, int width, int height, double tilt) {

	ctx->images[ctx->n_images].tilt = tilt;
	ctx->images[ctx->n_images].omega = ctx->omega;
	ctx->images[ctx->n_images].image = image;
	ctx->images[ctx->n_images].width = width;
	ctx->images[ctx->n_images].height = height;
	ctx->images[ctx->n_images].lambda = ctx->lambda;
	ctx->images[ctx->n_images].fmode = ctx->fmode;
	
	if ( ctx->fmode == FORMULATION_PIXELSIZE ) {
		ctx->images[ctx->n_images].pixel_size = ctx->pixel_size;
		ctx->images[ctx->n_images].camera_len = 0;
		ctx->images[ctx->n_images].resolution = 0;
	} else if ( ctx->fmode == FORMULATION_CLEN ) {
		ctx->images[ctx->n_images].pixel_size = 0;
		ctx->images[ctx->n_images].camera_len = ctx->camera_length;
		ctx->images[ctx->n_images].resolution = ctx->resolution;
	}
	
	ctx->n_images++;
	
	return ctx->n_images - 1;

}