aboutsummaryrefslogtreecommitdiff
path: root/src/itrans.c
blob: d1e43ab32feef4ea85fdaa5317cb6078bd62fabd (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
42
43
44
45
46
47
48
49
50
/*
 * itrans.c
 *
 * Parameterise features in an image for reconstruction
 *
 * (c) 2007 Thomas White <taw27@cam.ac.uk>
 *	    Gordon Ball <gfb21@cam.ac.uk>
 *
 *  dtr - Diffraction Tomography Reconstruction
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdint.h>
#include <gsl/gsl_matrix.h>

#include "control.h"
#include "imagedisplay.h"
#include "reflections.h"
#include "itrans-threshold.h"
#include "itrans-zaefferer.h"
#include "itrans-lsq.h"
#include "itrans-stat.h"

void itrans_process_image(int16_t *image, ControlContext *ctx, double tilt_degrees) {
	
	unsigned int n_reflections;
	ImageDisplay *imagedisplay = NULL;
	
	if ( ctx->first_image ) {
		imagedisplay = imagedisplay_open(image, ctx->width, ctx->height, "Image Display");
		imagedisplay_add_tilt_axis(imagedisplay, ctx, ctx->omega);
	}
	
	switch ( ctx->psmode ) {
		case PEAKSEARCH_THRESHOLD : n_reflections = itrans_peaksearch_threshold(image, ctx, tilt_degrees, imagedisplay); break;
		case PEAKSEARCH_ADAPTIVE_THRESHOLD : n_reflections = itrans_peaksearch_adaptive_threshold(image, ctx, tilt_degrees, imagedisplay); break;
		case PEAKSEARCH_LSQ : n_reflections = itrans_peaksearch_lsq(image, ctx, tilt_degrees, imagedisplay); break;
		case PEAKSEARCH_ZAEFFERER : n_reflections = itrans_peaksearch_zaefferer(image, ctx, tilt_degrees, imagedisplay); break;
		case PEAKSEARCH_STAT : n_reflections = itrans_peaksearch_stat(image, ctx, tilt_degrees, imagedisplay); break;
		default: n_reflections = 0;
	}
	
	ctx->first_image = 0;
	printf(" ..... %i peaks found\n", n_reflections);
	
}