param.h 2.83 KB
Newer Older
qon's avatar
qon committed
1
2
3
4
5
6
7
#ifndef BIOEM_PARAM_H
#define BIOEM_PARAM_H

#include "defs.h"
#include "map.h"
#include <complex>
#include <math.h>
8
#include <fftw3.h>
qon's avatar
qon committed
9

10
11
using namespace std;

qon's avatar
qon committed
12
13
14
class bioem_param_device
{
public:
15
// Grids in center assuming equidistance from 0,0
qon's avatar
qon committed
16
17
18
	int maxDisplaceCenter;
	int GridSpaceCenter;
	int NumberPixels;
19
	int NumberFFTPixels1D;
20
	int NtotDist;
21
      
qon's avatar
qon committed
22
23
	myfloat_t Ntotpi;
	myfloat_t volu;
24
25
// If to write Probabilities of Angles from Model
	bool writeAngles;
26
        bool writeCC;
Pilar Cossio's avatar
Pilar Cossio committed
27
        bool flipped;
28
        bool debugterm;
Pilar Cossio's avatar
Pilar Cossio committed
29
	int CCdisplace;
30
        bool CCwithBayes;
31

Pilar Cossio's avatar
Pilar Cossio committed
32

qon's avatar
qon committed
33
34
35
36
37
};

class bioem_param
{
public:
38
39
40
	bioem_param();
	~bioem_param();

41

Pilar Cossio's avatar
Pilar Cossio committed
42
43
	int readParameters(const char* fileinput);
	int CalculateGridsParam(const char* fileangles);
44
	int CalculateRefCTF();
45
        int forprintBest(const char* fileinput);
46
	void PrepareFFTs();
Pilar Cossio's avatar
Pilar Cossio committed
47
        bool doaaradius;
48
        bool writeCTF;
49
        bool ignoreCCoff;
50
51
52
	bool nocentermass;
	bool printrotmod;
	bool readquatlist;
Pilar Cossio's avatar
Pilar Cossio committed
53
	bool showrotatemod;
54
55
56
57
	bool notsqure;
        bool notnormmap;
	bool usepsf;
 
58
        myfloat_t elecwavel;
qon's avatar
qon committed
59
60
61

	bioem_param_device param_device;

62
	int FFTMapSize;
63
	int Alignment;
64
65
	mycomplex_t* refCTF;
	myfloat3_t* CtfParam;
66
67
	size_t getRefCtfCount() {return nTotCTFs * FFTMapSize;}
	size_t getCtfParamCount() {return nTotCTFs;}
qon's avatar
qon committed
68

69
	myfloat_t pixelSize;
70
71
72
73
74
// Priors
	myfloat_t priorMod;
	bool yespriorAngles;
        myfloat_t* angprior;

qon's avatar
qon committed
75
// Grid Points in Euler angles, assuming uniform sampling d_alpha=d_gamma (in 2pi) & cos(beta)=-1,1
76
77
	int angleGridPointsAlpha;
	int angleGridPointsBeta;
78

79
80
81
	int GridPointsQuatern;
	bool doquater;

Pilar Cossio's avatar
Pilar Cossio committed
82
	myfloat_t voluang;
83
84
85
86
87
        bool notuniformangles;
        int NotUn_angles;

	bool withnoise;
        myfloat_t stnoise;
Pilar Cossio's avatar
Pilar Cossio committed
88
89
//        std::string inanglef;
//	std::string quatfile;
90

91
	int numberGridPointsDisplaceCenter;
qon's avatar
qon committed
92
// Grid sampling for the convolution kernel
93
94
95
96
97
98
99

//        CTF 
	myfloat_t startBfactor, endBfactor;
	int numberBfactor;
        myfloat_t startDefocus, endDefocus;
        int numberDefocus;
 
100
101
	//ENVELOPE
	myfloat_t startGridEnvelop;
Pilar Cossio's avatar
Pilar Cossio committed
102
	myfloat_t endGridEnvelop;
103
104
105
106
	int numberGridPointsEnvelop;
	myfloat_t gridEnvelop;
	//CTF=Amp*cos(phase*x)-sqrt(1-Amp**2)*sin(phase*x)
	myfloat_t startGridCTF_phase;
Pilar Cossio's avatar
Pilar Cossio committed
107
	myfloat_t endGridCTF_phase;
108
109
110
	int numberGridPointsCTF_phase;
	myfloat_t gridCTF_phase;
	myfloat_t startGridCTF_amp;
Pilar Cossio's avatar
Pilar Cossio committed
111
	myfloat_t endGridCTF_amp;
112
113
114
	int numberGridPointsCTF_amp;
	myfloat_t gridCTF_amp;
	// Others
David Rohr's avatar
David Rohr committed
115
	myfloat3_t* angles;
116
117
	int nTotGridAngles;
	int nTotCTFs;
118
	int nTotCC;
Pilar Cossio's avatar
Pilar Cossio committed
119
120
	int shiftX,shiftY;
	
121
122
123
	bool printModel;
	int printModelOrientation;
	int printModelConvolution;
124
125
126
127

	int fft_plans_created;
	myfftw_plan fft_plan_c2c_forward, fft_plan_c2c_backward, fft_plan_r2c_forward, fft_plan_c2r_backward;

128
129
130
	mycomplex_t** fft_scratch_complex;
	myfloat_t** fft_scratch_real;

131
132
	bool dumpMap, loadMap;

133
134
135
       int ddx,ddy;
       myfloat_t bestnorm,bestoff;

136
137
private:
	void releaseFFTPlans();
qon's avatar
qon committed
138
139
140
};

#endif