aboutsummaryrefslogtreecommitdiff
path: root/src/mrc.h
blob: b3f5844e9b798c4fca7be722a416e35108e2eec6 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * mrc.h
 *
 * Read the MRC tomography format
 *
 * (c) 2007 Thomas White <taw27@cam.ac.uk>
 *
 *  dtr - Diffraction Tomography Reconstruction
 *
 */


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

#ifndef MRC_H
#define MRC_H

#include <stdint.h>

#include "control.h"

typedef struct struct_mrcheader {
	
	int32_t		nx;		/*   0 */
	int32_t		ny;		/*   4 */
	int32_t		nz;		/*   8 */
	int32_t		mode;		/*  12 */
	int32_t		nxstart;	/*  16 */
	int32_t		nystart;	/*  20 */
	int32_t		nzstart;	/*  24 */
	int32_t		mx;		/*  28 */
	int32_t		my;		/*  32 */
	int32_t		mz;		/*  36 */
	float		xlen;		/*  40 */
	float		ylen;		/*  44 */
	float		zlen;		/*  48 */
	float		alpha;		/*  52 */
	float		beta;		/*  56 */
	float		gamma;		/*  60 */
	int32_t		mapc;		/*  64 */
	int32_t		mapr;		/*  68 */
	int32_t		maps;		/*  72 */
	float		amin;		/*  76 */
	float		amax;		/*  80 */
	float		amean;		/*  84 */
	uint16_t	ispg;		/*  88 (4 byte word aligned) Space group number */
	uint16_t	nsymbt;		/*  90 (2 byte word aligned) */
	int32_t		next;		/*  92 (back to 4 byte word aligned) */
	uint16_t	dvid;		/*  96 (4 byte word aligned) */
	char		extra[30];	/*  98 (2 byte aligned, this padding puts it back on 4 byte alignment) */
	uint16_t	numintegers;	/* 128 (4) */
	uint16_t	numfloats;	/* 130 (2) */
	uint16_t	sub;		/* 132 (4) */
	uint16_t	zfac;		/* 134 (2) */
	float		min2;		/* 136 (4 byte word aligned) */
	float		max2;		/* 140 */
	float		min3;		/* 144 */
	float		max3;		/* 148 */
	float		min4;		/* 152 */
	float		max4;		/* 156 */
	uint16_t	idtype;		/* 160 */
	uint16_t	lens;		/* 162 */
	uint16_t	nd1;		/* 164 */
	uint16_t	nd2;		/* 166 */
	uint16_t	vd1;		/* 168 */
	uint16_t	vd2;		/* 170 (back to 4 byte alignment - yay!) */
	float		tiltangles[9];	/* 172 (4 byte alignment) */
	float		zorg;		/* 208 (=172+9*4) */
	float		xorg;		/* 212 */
	float		yorg;		/* 216 */
	int32_t		nlabl;		/* 220 */
	char		data[10][80];	/* 224 (4 byte alignment) */
	
} MRCHeader;	/* 1024 bytes total = 224+10*80 */

typedef struct struct_mrcextheader {

	float		a_tilt;
	float		b_tilt;
	float		x_stage;
	float		y_stage;
	float		z_stage;
	float		x_shift;
	float		y_shift;
	float		defocus;
	float		exp_time;
	float		mean_int;
	float		tilt_axis;
	float		pixel_size;
	float		magnification;
	float		mic_type;
	float		gun_type;
	float		d_number;
	float		voltage;
	float		focus_spread;
	float		mtf;
	float		df_start;
	float		focus_step;
	float		dac_setting;
	float		cs;
	float		semi_conv;
	float		info_limit;
	float		num_images;
	float		num_in_series;
	float		coma1;
	float		coma2;
	float		astig21;
	float		astig22;
	float		astig31;
	float		astig32;
	float		cam_type;
	float		cam_pos;
	float		padding[64];	/* Need to guarantee that reading an extended header (of any size)
						will never write beyond the boundary of this structure... */
	
} MRCExtHeader;

extern int mrc_read(ControlContext *ctx);
extern unsigned int mrc_is_mrcfile(const char *filename);

#endif	/* MRC_H */