param.h 3.47 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   < BioEM software for Bayesian inference of Electron Microscopy images>
   Copyright (C) 2016 Pilar Cossio, David Rohr, Fabio Baruffa, Markus Rampp, 
        Volker Lindenstruth and Gerhard Hummer.
   Max Planck Institute of Biophysics, Frankfurt, Germany.

   See license statement for terms of distribution.

   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

qon's avatar
qon committed
11
12
13
14
15
16
17
#ifndef BIOEM_PARAM_H
#define BIOEM_PARAM_H

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

20
21
using namespace std;

qon's avatar
qon committed
22
23
24
class bioem_param_device
{
public:
25
// Grids in center assuming equidistance from 0,0
qon's avatar
qon committed
26
27
28
	int maxDisplaceCenter;
	int GridSpaceCenter;
	int NumberPixels;
29
	int NumberFFTPixels1D;
30
	int NtotDist;
31
      
qon's avatar
qon committed
32
33
	myfloat_t Ntotpi;
	myfloat_t volu;
34
	myfloat_t sigmaPriorbctf;
Pilar Cossio's avatar
Pilar Cossio committed
35
36
37
 	myfloat_t sigmaPriordefo;
        myfloat_t Priordefcent;

38
        
39
40
// If to write Probabilities of Angles from Model
	bool writeAngles;
41
        bool writeCC;
Pilar Cossio's avatar
Pilar Cossio committed
42
        bool flipped;
43
        bool debugterm;
Pilar Cossio's avatar
Pilar Cossio committed
44
	int CCdisplace;
45
        bool CCwithBayes;
46
        bool tousepsf;
47

Pilar Cossio's avatar
Pilar Cossio committed
48

qon's avatar
qon committed
49
50
51
52
53
};

class bioem_param
{
public:
54
55
56
	bioem_param();
	~bioem_param();

57

Pilar Cossio's avatar
Pilar Cossio committed
58
59
	int readParameters(const char* fileinput);
	int CalculateGridsParam(const char* fileangles);
60
	int CalculateRefCTF();
61
        int forprintBest(const char* fileinput);
62
	void PrepareFFTs();
Pilar Cossio's avatar
Pilar Cossio committed
63
        bool doaaradius;
64
        bool writeCTF;
65
        bool ignoreCCoff;
66
67
68
	bool nocentermass;
	bool printrotmod;
	bool readquatlist;
Pilar Cossio's avatar
Pilar Cossio committed
69
	bool showrotatemod;
70
71
72
	bool notsqure;
        bool notnormmap;
	bool usepsf;
73
        bool ignorepointsout;
74
	bool ignorePDB;
75
 
76
        myfloat_t elecwavel;
qon's avatar
qon committed
77
78
79

	bioem_param_device param_device;

80
	int FFTMapSize;
81
	int Alignment;
82
83
	mycomplex_t* refCTF;
	myfloat3_t* CtfParam;
84
85
	size_t getRefCtfCount() {return nTotCTFs * FFTMapSize;}
	size_t getCtfParamCount() {return nTotCTFs;}
qon's avatar
qon committed
86

87
	myfloat_t pixelSize;
88
89
90
91
92
// Priors
	myfloat_t priorMod;
	bool yespriorAngles;
        myfloat_t* angprior;

qon's avatar
qon committed
93
// Grid Points in Euler angles, assuming uniform sampling d_alpha=d_gamma (in 2pi) & cos(beta)=-1,1
94
95
	int angleGridPointsAlpha;
	int angleGridPointsBeta;
96

97
98
99
	int GridPointsQuatern;
	bool doquater;

Pilar Cossio's avatar
Pilar Cossio committed
100
	myfloat_t voluang;
101
102
103
104
105
        bool notuniformangles;
        int NotUn_angles;

	bool withnoise;
        myfloat_t stnoise;
Pilar Cossio's avatar
Pilar Cossio committed
106
107
//        std::string inanglef;
//	std::string quatfile;
108

109
	int numberGridPointsDisplaceCenter;
qon's avatar
qon committed
110
// Grid sampling for the convolution kernel
111
112
113
114
115
116
117

//        CTF 
	myfloat_t startBfactor, endBfactor;
	int numberBfactor;
        myfloat_t startDefocus, endDefocus;
        int numberDefocus;
 
118
119
	//ENVELOPE
	myfloat_t startGridEnvelop;
Pilar Cossio's avatar
Pilar Cossio committed
120
	myfloat_t endGridEnvelop;
121
122
123
124
	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
125
	myfloat_t endGridCTF_phase;
126
127
128
	int numberGridPointsCTF_phase;
	myfloat_t gridCTF_phase;
	myfloat_t startGridCTF_amp;
Pilar Cossio's avatar
Pilar Cossio committed
129
	myfloat_t endGridCTF_amp;
130
131
132
	int numberGridPointsCTF_amp;
	myfloat_t gridCTF_amp;
	// Others
David Rohr's avatar
David Rohr committed
133
	myfloat3_t* angles;
134
135
	int nTotGridAngles;
	int nTotCTFs;
136
	int nTotCC;
Pilar Cossio's avatar
Pilar Cossio committed
137
138
	int shiftX,shiftY;
	
139
140
141
	bool printModel;
	int printModelOrientation;
	int printModelConvolution;
142
143
144
145

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

146
147
148
	mycomplex_t** fft_scratch_complex;
	myfloat_t** fft_scratch_real;

149
150
	bool dumpMap, loadMap;

151
152
153
       int ddx,ddy;
       myfloat_t bestnorm,bestoff;

154
155
private:
	void releaseFFTPlans();
qon's avatar
qon committed
156
157
158
};

#endif