6 #define ctfInfoModeWithAmplitudeContrast 0x0f
7 #define ctfInfoModeWithMTF 0x10
8 #define ctfInfoModeWithIlluminationAngle 0x20
9 #define ctfInfoModeWithEnergySpread 0x40
10 #define ctfInfoModeAbsoluteValue 0x100
12 typedef enum ctfInfoMode {
13 ctfInfoModePhaseCTFOnly = 0,
14 ctfInfoModePhaseAndAmpCTF = 1
17 typedef enum ctfInfoMTFMode {
18 ctfInfoMTFModeSingleExp = 0,
19 ctfInfoMTFModeSingleLorentzian = 1,
20 ctfInfoMTFModeBoth = 2,
21 ctfInfoMTFModeLinear = 3,
22 ctfInfoMTFModeBothSum = 4,
23 ctfInfoMTFModePolynomial = 5
28 typedef struct moleculrEnvelope {
36 typedef struct ctfInfo {
38 float defocus; /* A : Underfocus is plus, while overfocus is minus*/
42 float Ain; /* mrad : Illumination Angle */
43 long flagWin; /* Windowing */
44 float CutLow; /* Windowing: CutLow A-1 */
45 float CutHigh; /* Windowing: CutHigh A-1 */
47 float I0; /* Intensity */
48 float Isignal; /* Intensity of signal */
50 float ratioOfAmpToPhase; /* The ratio of amp to phase */
52 float Inoise; /* Intensity of noise : Isignal*/
54 float WhiteNoise; /* Affected by MTF(R) */
56 long flagWhiteNoiseRaising;
57 float WhiteNoiseRaising; /* WhiteNoise Raising depending upon R */
59 float Inoise2; /* Intensity of noise */
61 float WhiteNoise2; /* Not Affected by MTF(R)*/
64 float defocus2D[2]; /* A : Normally [0]: Max [1]: Min */
65 float defocus0axis; /* radian : angle of the defocus2D[0]-axis */
69 long flagMagnification;
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*/
84 /* Molecular Envelope: Scattering Factor */
86 float MolecEnv; /* A : */
88 long flagMolecEnvTable;
89 molecularEnvelope MolecEnvTable;
96 float ElasticRingPosition;
97 float ElasticRingWidth;
104 /* Aliasing and Sampling */
106 float NyquistFrequency;
109 /* Inelastic Signal */
111 long flagWithInElastic;
112 float InElasticGaussian;
114 long flagWithInElasticTable;
115 molecularEnvelope InElasticEnvTable;
119 float InElasticShift;
120 float InElasticWidth;
122 float InElasticRingPosition;
123 float InElasticRingWidth;
132 /* prototype begin */
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);