OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/eos/base
[eos/hostdependX86LINUX64.git] / include / ctfInfo.h
1 #ifndef CTF_INFO_H
2 #define CTF_INFO_H
3 #include <stdio.h>
4
5 /* constant begin */
6 #define ctfInfoModeWithAmplitudeContrast    0x0f
7 #define ctfInfoModeWithMTF                  0x10
8 #define ctfInfoModeWithIlluminationAngle    0x20
9 #define ctfInfoModeWithEnergySpread         0x40
10 #define ctfInfoModeAbsoluteValue            0x100 
11
12 typedef enum ctfInfoMode {
13         ctfInfoModePhaseCTFOnly   = 0,
14         ctfInfoModePhaseAndAmpCTF = 1 
15 } ctfInfoMode;
16
17 typedef enum ctfInfoMTFMode {
18         ctfInfoMTFModeSingleExp = 0,
19         ctfInfoMTFModeSingleLorentzian = 1,
20         ctfInfoMTFModeBoth      = 2,
21         ctfInfoMTFModeLinear    = 3, 
22         ctfInfoMTFModeBothSum   = 4,
23         ctfInfoMTFModePolynomial = 5
24 } ctfInfoMTFMode;
25 /* constant end */
26
27 /* struct begin */
28 typedef struct moleculrEnvelope {
29         char* filename; 
30         int   nR;
31         float* R;
32         float* Envelope;
33         int    mode;    
34 } molecularEnvelope;
35
36 typedef struct ctfInfo {
37         float kV;      /* kV */
38         float defocus; /* A : Underfocus is plus, while overfocus is minus*/
39         float Cc;      /* mm */
40         float dE; 
41         float Cs;      /* mm */
42         float Ain;     /* mrad : Illumination Angle */
43         long  flagWin; /* Windowing */ 
44         float CutLow;  /* Windowing: CutLow  A-1 */
45         float CutHigh; /* Windowing: CutHigh A-1 */
46
47         float I0;      /* Intensity */
48         float Isignal; /* Intensity of signal */
49
50         float ratioOfAmpToPhase; /* The ratio of amp to phase */
51
52         float Inoise;  /* Intensity of noise : Isignal*/
53         long  flagWhiteNoise;
54         float WhiteNoise;  /* Affected by MTF(R) */
55
56         long  flagWhiteNoiseRaising;    
57         float WhiteNoiseRaising; /* WhiteNoise Raising depending upon R */
58
59         float Inoise2; /* Intensity of noise */
60         long  flagWhiteNoise2;
61         float WhiteNoise2; /* Not Affected by MTF(R)*/
62
63         int   flagAstigmatism;
64         float defocus2D[2];      /* A : Normally [0]: Max [1]: Min */
65         float defocus0axis;      /* radian : angle of the defocus2D[0]-axis */
66
67         long mode;
68         
69         long  flagMagnification;        
70         float Magnification;
71
72         /* MTF(R): Modulation Transfer Function */ 
73         ctfInfoMTFMode MTFMode;
74         float BofMTF;  /* Exponential: exp(-B R)   */
75         float BofMTF2; /* Lorentzian : 1/(B*B+R*R) */   
76         float WeightOfSecondTermForMTF; /* 0 <-> 1 */
77         /*for PolynomialExpNoise*//*d = degree*/
78         float BofMTFd2;
79         float BofMTFd3;
80         float BofMTFd4;
81         float BofMTFd5;
82         float BofMTFd6;
83
84         /* Molecular Envelope: Scattering Factor */
85         /* For Gaussian */
86         float MolecEnv;                   /* A : */
87         /* For Table */
88         long  flagMolecEnvTable;
89         molecularEnvelope MolecEnvTable;
90         /* For Lorentzian */
91         float flagElastic;
92         float Elastic;
93         float ElasticShift;
94         float ElasticWidth;
95         float ElasticRing;
96         float ElasticRingPosition;
97         float ElasticRingWidth;
98
99         /* Stage Vibration */
100         long  flagVibration;
101         long  VibrationMode;
102         float BofVibration;
103
104         /* Aliasing and Sampling */
105         long flagAliasing;
106         float NyquistFrequency;
107         long flagSampling; 
108
109         /* Inelastic Signal */
110         /* For Gaussian */
111         long flagWithInElastic;
112         float InElasticGaussian;
113         /* For Table */
114         long flagWithInElasticTable;
115         molecularEnvelope InElasticEnvTable;    
116         /* Lorentzian */        
117         long flagInElastic;
118         float InElastic;
119         float InElasticShift;
120         float InElasticWidth;
121         float InElasticRing;
122         float InElasticRingPosition;
123         float InElasticRingWidth;
124 } ctfInfo;
125 /* struct end */
126
127
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131
132 /* prototype begin */
133
134 extern void ctfInfoSendByPVM(ctfInfo* info, int tid, long mode);
135 extern void ctfInfoRecieveByPVM(ctfInfo* info, int tid, long mode);
136 extern float ctfSignalFunction(ctfInfo* info, float R, long mode);
137 extern float ctfNoiseFunction(ctfInfo* info, float R, long mode);
138 extern float ctfNoise2Function(ctfInfo* info, float R, long mode);
139 extern float ctfSignalPowerFunction(ctfInfo* info, float R, long mode);
140 extern float ctfNoisePowerFunction(ctfInfo* info, float R, long mode);
141 extern float ctfNoise2PowerFunction(ctfInfo* info, float R, long mode);
142 extern float ctfScatteringFunction(ctfInfo* info, float R, long mode);
143 extern float ctfMolecularEnvelopeFunction(ctfInfo* info, float R, long mode);
144 extern float ctfMolecularEnvelopeInElasticFunction(ctfInfo* info, float R, long mode);
145 extern float ctfVibrationFunction(ctfInfo* info, float R, long mode);
146 extern float ctfFunction(ctfInfo* info, float R, long mode);
147 extern float ctfFunctionSampling(float R, float Nyquist, long mode);
148 extern void  ctfFunctionPVMStart(ctfInfo* info, float R, int tid, long mode);
149 extern float ctfFunctionPVMEnd(ctfInfo* info, float R, int tid, long mode);
150 extern void  ctfFunctionPVMServer();
151 extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode);
152 extern float ctfMTFFunction(ctfInfo* info, float R, long mode);
153 extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode);
154 extern float wavelengthOfElectron(float E);
155 extern float defocusDeterminationFromThonRing(ctfInfo* info, float R, long n, long mode);
156 extern void ctfWeightForCorrectionUsage(FILE* fpt);
157 extern float ctfWeightForCorrection2D(ctfInfo* info, float X, float Y, long mode);
158 extern float ctfWeightForCorrection(ctfInfo* info, float R, long mode);
159 extern void lmolecularEnvelopeFileRead(FILE* fpt, molecularEnvelope* mol, int mode);
160 extern void lmolecularEnvelopeFileWrite(FILE* fpt, molecularEnvelope* mol, int mode);
161 extern void lmolecularEnvelopeResampling(molecularEnvelope* dst, molecularEnvelope* src, float dR, float RMax, int mode);
162 extern float lmolecularEnvelopeDataGet(molecularEnvelope* src, float R, int mode);
163 extern void ctfInfoRead(FILE* fpt, ctfInfo* ctf, char* pre, int mode);
164 extern void ctfInfoWrite(FILE* fpt, ctfInfo ctf, char* pre, int mode);
165 /* prototype end */
166
167 #ifdef __cplusplus
168 };
169 #endif
170
171 #endif