aboutsummaryrefslogtreecommitdiff
path: root/src/reflections.h
blob: c75343074ec5352d0a08c258d5f362f025941056 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * reflections.h
 *
 * Data structures in 3D space
 *
 * (c) 2007 Thomas White <taw27@cam.ac.uk>
 *
 *  dtr - Diffraction Tomography Reconstruction
 *
 */
 
#ifndef REFLECTION_H
#define REFLECTION_H

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

typedef enum {
	REFLECTION_NORMAL,	/* Measured - expressed as x, y, z position */
	REFLECTION_CENTRAL,	/* The central beam */
	REFLECTION_GENERATED,	/* Generated and intensity-measured - expressed as h, k, l index */
	REFLECTION_MARKER,
	REFLECTION_VECTOR_MARKER_1,
	REFLECTION_VECTOR_MARKER_2,
	REFLECTION_VECTOR_MARKER_3,
	REFLECTION_VECTOR_MARKER_4
} ReflectionType;

typedef struct reflection_struct {

	double		x;
	double		y;
	double		z;
	double 		intensity;

	signed int	h;
	signed int	k;
	signed int	l;

	ReflectionType	type;
	
	/* Stuff used when finding bases */
	int		found;		/* This reflection has been used in the seed-finding process */
	int		lfom;		/* Line FoM for this seed */

	struct reflection_struct *next;	/* MUST BE LAST in order for caching to work */

} Reflection;

typedef struct reflectionlist_struct {

	Reflection *reflections;
	Reflection *last_reflection;
	
	unsigned int n_reflections;
	unsigned int list_capped;
	
} ReflectionList;

extern ReflectionList *reflectionlist_new(void);
extern void reflection_clear(ReflectionList *reflectionlist);
extern void reflection_clear_markers(ReflectionList *reflectionlist);
extern void reflection_free(ReflectionList *reflectionlist);

extern Reflection *reflection_add(ReflectionList *reflectionlist, double x, double y, double z, double intensity, ReflectionType type);

#include "control.h"

extern void reflection_add_from_dp(ControlContext *ctx, double x, double y, ImageRecord *imagerecord, double intensity);
extern void reflection_add_from_reflection(ReflectionList *reflectionlist, Reflection *r);
extern double reflection_largest_g(ReflectionList *reflectionlist);
extern int reflection_map_to_space(ImageReflection *refl, double *ddx, double *ddy, double *ddz, double *twotheta);
extern Reflection *reflection_find_nearest(ReflectionList *reflectionlist, double x, double y, double z);
extern Reflection *reflection_find_nearest_longer_unknown(ReflectionList *reflectionlist, double x, double y, double z, double min_distance);
extern Reflection *reflection_find_nearest_type(ReflectionList *reflectionlist, double x, double y, double z, ReflectionType type);
extern ReflectionList *reflection_sort_lfom(ReflectionList *in);

#endif	/* REFLECTION_H */