Difference between revisions of "ctfInfo(API)"

From EosPedia
Jump to: navigation, search
(constant)
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
== constant ==
 
== constant ==
 +
=== Mode ===
 +
==== Mask data ====
 
  #define ctfInfoModeWithAmplitudeContrast    0x0f
 
  #define ctfInfoModeWithAmplitudeContrast    0x0f
 
  #define ctfInfoModeWithMTF                  0x10
 
  #define ctfInfoModeWithMTF                  0x10
Line 7: Line 9:
 
  #define ctfInfoModeWithEnergySpread        0x40
 
  #define ctfInfoModeWithEnergySpread        0x40
 
  #define ctfInfoModeAbsoluteValue            0x100  
 
  #define ctfInfoModeAbsoluteValue            0x100  
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>Value</th>
 +
<th>Part of  Mask</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithAmplitudeContrast</td>
 +
<td>0x0f</td>
 +
<td>Correction Mode</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithMTF</td>
 +
<td>0x10</td>
 +
<td>Multiply [[MTF]] flag</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithIlluminationAngle</td>
 +
<td>0x20</td>
 +
<td>Illumination Angle flag</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithEnergySpread</td>
 +
<td>0x40</td>
 +
<td>Energy Spread flag</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeAbsoluteValue</td>
 +
<td>0x100</td>
 +
<td>Absolute Value flag</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
  
 +
==== Define mode value ====
 +
===== Contrast mode =====
 +
For ctfInfo->mode (It supports to the value that is masked at ctfInfoModeWithAmplitudeContrast.)
 
  typedef enum ctfInfoMode {
 
  typedef enum ctfInfoMode {
 
  ctfInfoModePhaseCTFOnly  = 0,
 
  ctfInfoModePhaseCTFOnly  = 0,
 
  ctfInfoModePhaseAndAmpCTF = 1  
 
  ctfInfoModePhaseAndAmpCTF = 1  
 
  } ctfInfoMode;
 
  } ctfInfoMode;
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>Variable</th>
 +
<th>Value</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModePhaseCTFOnly</td>
 +
<td>0</td>
 +
<td>only Phase contrast</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModePhaseAndAmpCTF</td>
 +
<td>1</td>
 +
<td>+ Intensity contrast</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
  
 +
===== Envelope's Mode =====
 +
For ctfInfo->MTFMode
 
  typedef enum ctfInfoMTFMode {
 
  typedef enum ctfInfoMTFMode {
 
  ctfInfoMTFModeSingleExp = 0,
 
  ctfInfoMTFModeSingleExp = 0,
Line 21: Line 83:
 
  ctfInfoMTFModePolynomial = 5
 
  ctfInfoMTFModePolynomial = 5
 
  } ctfInfoMTFMode;
 
  } ctfInfoMTFMode;
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>Variable</th>
 +
<th>Value</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeSingleExp</td>
 +
<td>0</td>
 +
<td>Exponential</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeSingleLorentzian</td>
 +
<td>1</td>
 +
<td>Lorenz Function</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeBoth</td>
 +
<td>2</td>
 +
<td>Exponential x Lorenz Function</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeLinear</td>
 +
<td>3</td>
 +
<td>Linear</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeBothSum</td>
 +
<td>4</td>
 +
<td>Exponential + Lorenz Function</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModePolynomial</td>
 +
<td>5</td>
 +
<td>Polynomial</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
  
 
== struct ==
 
== struct ==
 +
Use for molecular envelope.
 
  typedef struct moleculrEnvelope {
 
  typedef struct moleculrEnvelope {
 
  char* filename;  
 
  char* filename;  
Line 31: Line 134:
 
  } molecularEnvelope;
 
  } molecularEnvelope;
  
 +
Setting as argument for these API.
 
  typedef struct ctfInfo {
 
  typedef struct ctfInfo {
 
  float kV;      /* kV */
 
  float kV;      /* kV */
Line 122: Line 226:
  
 
== API ==
 
== API ==
  extern void ctfInfoSendByPVM(ctfInfo* info, int tid, long mode);
+
==== Scattering ====
extern void ctfInfoRecieveByPVM(ctfInfo* info, int tid, long mode);
+
Return the value that is added Signal(by ctfSignalFunction) and Noise(by ctfNoiseFunction).
 +
  extern float ctfScatteringFunction(ctfInfo* info, float R, long mode);
 +
 
 +
==== Signal ====
 +
Output the signal.<br>
 +
(use ctfFunction, ctfMolecularEnvelopeFunction, ctfMolecularEnvelopeInElasticFunction, ctfVibrationFunction, ctfMTFFunction)<br>
 +
if info->flagAliasing=true: add Aliasing. (use info->NyquistFrequency)
 
  extern float ctfSignalFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfSignalFunction(ctfInfo* info, float R, long mode);
extern float ctfNoiseFunction(ctfInfo* info, float R, long mode);
+
 
extern float ctfNoise2Function(ctfInfo* info, float R, long mode);
+
Output the signal power about above.
 
  extern float ctfSignalPowerFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfSignalPowerFunction(ctfInfo* info, float R, long mode);
extern float ctfNoisePowerFunction(ctfInfo* info, float R, long mode);
+
 
extern float ctfNoise2PowerFunction(ctfInfo* info, float R, long mode);
+
===== Calculate Molecular Envelope =====
extern float ctfScatteringFunction(ctfInfo* info, float R, long mode);
+
if info->flagMolecEnvTable=true: call lmolecularEnvelopeDataGet, use table data(by info->MolecEnvTable)
 
  extern float ctfMolecularEnvelopeFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfMolecularEnvelopeFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfMolecularEnvelopeInElasticFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfMolecularEnvelopeInElasticFunction(ctfInfo* info, float R, long mode);
 +
 +
==== Noise ====
 +
Output noise that is multiplied White noise(info->WhiteNoise) and [[MTF]](by ctfMTFFunction).<br>
 +
if info->flagAliasing=true: add Aliasing.(use info->NyquistFrequency)
 +
extern float ctfNoiseFunction(ctfInfo* info, float R, long mode);
 +
 +
Output the noise power about above.
 +
extern float ctfNoisePowerFunction(ctfInfo* info, float R, long mode);
 +
 +
Output noise by using White noise of info->WhiteNoise2.
 +
extern float ctfNoise2Function(ctfInfo* info, float R, long mode);
 +
 +
Output the noise power about above.
 +
extern float ctfNoise2PowerFunction(ctfInfo* info, float R, long mode);
 +
 +
==== Calculate Vibration Function ====
 +
Calculate Vibration Function at R.<br>
 +
info->Magnification: RのMagnification
 
  extern float ctfVibrationFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfVibrationFunction(ctfInfo* info, float R, long mode);
 +
if info->flagVibration=true and info->VibrationMode=0: Output Vibration Function: Env = exp(-B*B*R*R/2.0)(Otherwise: output 1)<br>
 +
<br>
 +
 +
==== Calculate [[CTF]] ====
 
  extern float ctfFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfFunction(ctfInfo* info, float R, long mode);
extern float ctfFunctionSampling(float R, float Nyquist, long mode);
+
Calculate [[CTF]] at R<br>
extern void  ctfFunctionPVMStart(ctfInfo* info, float R, int tid, long mode);
+
Wavelength of the electron beam: by wavelengthOfElectron<br>
  extern float ctfFunctionPVMEnd(ctfInfo* info, float R, int tid, long mode);
+
Contrast: set the method by info->mode
extern void  ctfFunctionPVMServer();
+
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>info->mode(Mask at 0x0f)</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>0</td>
 +
<td>only Phase contrast</td>
 +
</tr>
 +
<tr>
 +
<td>1</td>
 +
<td>+ Intensity contrast</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
 +
 
 +
===== Case 2D =====
 +
Calculate R by X and Y. Then call cfFunction with it as argument.
 +
  extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode);
 +
 
 +
==== Calculate Envelope ====
 
  extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode);
 +
Calculate Envelope at R<br>
 +
Wavelength of the electron beam: by wavelengthOfElectron<br>
 +
if info->flagMagnification=1: multiply R and info->Magnification(without 0).
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>info->mode</th>
 +
<th>part of mask</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithMTF</td>
 +
<td>0x10</td>
 +
<td>multiply [[MTF]](by calling ctfMTFFunction)</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithIlluminationAngle</td>
 +
<td>0x20</td>
 +
<td>multiply the value with Illumination Angle(info->Ain)</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoModeWithEnergySpread</td>
 +
<td>0x40</td>
 +
<td>multiply the value with Energy Spread</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
 +
 +
==== Calculate [[MTF]] ====
 
  extern float ctfMTFFunction(ctfInfo* info, float R, long mode);
 
  extern float ctfMTFFunction(ctfInfo* info, float R, long mode);
  extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode);
+
Calculate [[MTF]] at R<br>
 +
info->Magnification: Magnification of R<br>
 +
if info->flagSampling=1: multiply the sampling function (by calling ctfFunctionSampling: info->NyquistFrequency is 2nd argument as Nyquist)
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>Variable</th>
 +
<th>Value</th>
 +
<th>Description</th>
 +
<th>used info's member by [[MTF]]</th>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeSingleExp</td>
 +
<td>0</td>
 +
<td>Exponential</td>
 +
<td>BofMTF</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeSingleLorentzian</td>
 +
<td>1</td>
 +
<td>Lorenz Function</td>
 +
<td>BofMTF2</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeBoth</td>
 +
<td>2</td>
 +
<td>Exponential x Lorenz Function</td>
 +
<td>BofMTF, BofMTF2</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeLinear</td>
 +
<td>3</td>
 +
<td>Linear</td>
 +
<td>BofMTF</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModeBothSum</td>
 +
<td>4</td>
 +
<td>Exponential + Lorenz Function</td>
 +
<td>BofMTF, BofMTF2, WeightOfSecondTermForMTF(Ratio of addition)</td>
 +
</tr>
 +
<tr>
 +
<td>ctfInfoMTFModePolynomial</td>
 +
<td>5</td>
 +
<td>Polynomial</td>
 +
<td>BofMTF, BofMTFd2, BofMTFd3, BofMTFd4, BofMTFd5</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
 +
 
 +
==== Calculate Sampling function ====
 +
Calculate Sampling function at R.
 +
  extern float ctfFunctionSampling(float R, float Nyquist, long mode);
 +
 
 +
==== Get wavelength of the electron beam ====
 
  extern float wavelengthOfElectron(float E);
 
  extern float wavelengthOfElectron(float E);
 +
 +
==== Determination of defocus from Thon ring ====
 
  extern float defocusDeterminationFromThonRing(ctfInfo* info, float R, long n, long mode);
 
  extern float defocusDeterminationFromThonRing(ctfInfo* info, float R, long n, long mode);
extern void ctfWeightForCorrectionUsage(FILE* fpt);
+
Wavelength of the electron beam: by wavelengthOfElectron<br>
extern float ctfWeightForCorrection2D(ctfInfo* info, float X, float Y, long mode);
+
Contrast: set the method by info->mode
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>info->mode(Mask at 0x0f)</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>0</td>
 +
<td>only Phase contrast</td>
 +
</tr>
 +
<tr>
 +
<td>1</td>
 +
<td>+ Intensity contrast</td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
 +
 
 +
====  Calculate weight for CTF Correction ====
 +
Output the weight for CTF Correction.
 
  extern float ctfWeightForCorrection(ctfInfo* info, float R, long mode);
 
  extern float ctfWeightForCorrection(ctfInfo* info, float R, long mode);
 +
<table border="1">
 +
<div align="left">
 +
<tr>
 +
<th>mode</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr>
 +
<td>0</td>
 +
<td>return 1(No Correction)</td>
 +
</tr>
 +
<tr>
 +
<td>1</td>
 +
<td>ctf/|ctf| (phase flipping)</td>
 +
</tr>
 +
<tr>
 +
<td>2</td>
 +
<td>ctf (phase flipping and ctf-multiplying)</td>
 +
</tr>
 +
<tr>
 +
<td>3</td>
 +
<td>1/ctf    (0.1<|ctf| ) (phase flipping and ctf-divided)</td>
 +
</tr>
 +
<tr>
 +
<td>4</td>
 +
<td>ctf/(SQR(ctf)+SQR(NS))    phase-flipping + Winner Filtering</td>
 +
</tr>
 +
<tr>
 +
<td>5</td>
 +
<td>SQR(ctf) x ctf/|ctf|      phase-flipping + ctf-Weighted</td>
 +
</tr>
 +
<tr>
 +
<td>6</td>
 +
<td>1/|ctf|  (0.1<|ctf|)      No phase-flipping + ctf-divided</td>
 +
</tr>
 +
<tr>
 +
<td>7</td>
 +
<td>|ctf|/(SQR(ctf)+SQR(NS))  No phase flipping + Winner Filtering </td>
 +
</tr>
 +
</div>
 +
</table>
 +
<br>
 +
 +
===== Case 2D =====
 +
Calculate R by X and Y. Then call ctfWeightForCorrection with it as argument.
 +
extern float ctfWeightForCorrection2D(ctfInfo* info, float X, float Y, long mode);
 +
 +
==== Molecular Envelope ====
 +
File Read
 
  extern void lmolecularEnvelopeFileRead(FILE* fpt, molecularEnvelope* mol, int mode);
 
  extern void lmolecularEnvelopeFileRead(FILE* fpt, molecularEnvelope* mol, int mode);
 +
File Write
 
  extern void lmolecularEnvelopeFileWrite(FILE* fpt, molecularEnvelope* mol, int mode);
 
  extern void lmolecularEnvelopeFileWrite(FILE* fpt, molecularEnvelope* mol, int mode);
 +
Resampling
 
  extern void lmolecularEnvelopeResampling(molecularEnvelope* dst, molecularEnvelope* src, float dR, float RMax, int mode);
 
  extern void lmolecularEnvelopeResampling(molecularEnvelope* dst, molecularEnvelope* src, float dR, float RMax, int mode);
 +
Get the Envelope of src at R.
 
  extern float lmolecularEnvelopeDataGet(molecularEnvelope* src, float R, int mode);
 
  extern float lmolecularEnvelopeDataGet(molecularEnvelope* src, float R, int mode);
 +
 +
==== CTFInformation ====
 +
File Read
 
  extern void ctfInfoRead(FILE* fpt, ctfInfo* ctf, char* pre, int mode);
 
  extern void ctfInfoRead(FILE* fpt, ctfInfo* ctf, char* pre, int mode);
 +
File Write
 
  extern void ctfInfoWrite(FILE* fpt, ctfInfo ctf, char* pre, int mode);
 
  extern void ctfInfoWrite(FILE* fpt, ctfInfo ctf, char* pre, int mode);
 +
 +
==== Only when installed PVM ====
 +
extern void ctfInfoSendByPVM(ctfInfo* info, int tid, long mode);
 +
extern void ctfInfoRecieveByPVM(ctfInfo* info, int tid, long mode);
 +
extern void  ctfFunctionPVMStart(ctfInfo* info, float R, int tid, long mode);
 +
extern float ctfFunctionPVMEnd(ctfInfo* info, float R, int tid, long mode);
 +
extern void  ctfFunctionPVMServer();
 +
 +
==== Help ====
 +
extern void ctfWeightForCorrectionUsage(FILE* fpt);

Latest revision as of 08:55, 25 September 2014

DataManip/ctfInfo is API fo CTF Correction.

constant

Mode

Mask data

#define ctfInfoModeWithAmplitudeContrast    0x0f
#define ctfInfoModeWithMTF                  0x10
#define ctfInfoModeWithIlluminationAngle    0x20
#define ctfInfoModeWithEnergySpread         0x40
#define ctfInfoModeAbsoluteValue            0x100 
Value Part of Mask Description
ctfInfoModeWithAmplitudeContrast 0x0f Correction Mode
ctfInfoModeWithMTF 0x10 Multiply MTF flag
ctfInfoModeWithIlluminationAngle 0x20 Illumination Angle flag
ctfInfoModeWithEnergySpread 0x40 Energy Spread flag
ctfInfoModeAbsoluteValue 0x100 Absolute Value flag


Define mode value

Contrast mode

For ctfInfo->mode (It supports to the value that is masked at ctfInfoModeWithAmplitudeContrast.)

typedef enum ctfInfoMode {
	ctfInfoModePhaseCTFOnly   = 0,
	ctfInfoModePhaseAndAmpCTF = 1 
} ctfInfoMode;
Variable Value Description
ctfInfoModePhaseCTFOnly 0 only Phase contrast
ctfInfoModePhaseAndAmpCTF 1 + Intensity contrast


Envelope's Mode

For ctfInfo->MTFMode

typedef enum ctfInfoMTFMode {
	ctfInfoMTFModeSingleExp = 0,
	ctfInfoMTFModeSingleLorentzian = 1,
	ctfInfoMTFModeBoth      = 2,
	ctfInfoMTFModeLinear    = 3, 
	ctfInfoMTFModeBothSum   = 4,
	ctfInfoMTFModePolynomial = 5
} ctfInfoMTFMode;
Variable Value Description
ctfInfoMTFModeSingleExp 0 Exponential
ctfInfoMTFModeSingleLorentzian 1 Lorenz Function
ctfInfoMTFModeBoth 2 Exponential x Lorenz Function
ctfInfoMTFModeLinear 3 Linear
ctfInfoMTFModeBothSum 4 Exponential + Lorenz Function
ctfInfoMTFModePolynomial 5 Polynomial


struct

Use for molecular envelope.

typedef struct moleculrEnvelope {
	char* filename; 
	int   nR;
	float* R;
	float* Envelope;
	int    mode;	
} molecularEnvelope;

Setting as argument for these API.

typedef struct ctfInfo {
	float kV;      /* kV */
	float defocus; /* A : Underfocus is plus, while overfocus is minus*/
	float Cc;      /* mm */
	float dE; 
	float Cs;      /* mm */
	float Ain;     /* mrad : Illumination Angle */
	long  flagWin; /* Windowing */ 
	float CutLow;  /* Windowing: CutLow  A-1 */
	float CutHigh; /* Windowing: CutHigh A-1 */

	float I0;      /* Intensity */
	float Isignal; /* Intensity of signal */

	float ratioOfAmpToPhase; /* The ratio of amp to phase */

	float Inoise;  /* Intensity of noise : Isignal*/
	long  flagWhiteNoise;
	float WhiteNoise;  /* Affected by MTF(R) */

	long  flagWhiteNoiseRaising; 	
	float WhiteNoiseRaising; /* WhiteNoise Raising depending upon R */

	float Inoise2; /* Intensity of noise */
	long  flagWhiteNoise2;
	float WhiteNoise2; /* Not Affected by MTF(R)*/

	int   flagAstigmatism;
	float defocus2D[2];      /* A : Normally [0]: Max [1]: Min */
	float defocus0axis;      /* radian : angle of the defocus2D[0]-axis */

	long mode;
	
	long  flagMagnification;	
	float Magnification;

	/* MTF(R): Modulation Transfer Function */ 
	ctfInfoMTFMode MTFMode;
	float BofMTF;  /* Exponential: exp(-B R)   */
	float BofMTF2; /* Lorentzian : 1/(B*B+R*R) */	
	float WeightOfSecondTermForMTF; /* 0 <-> 1 */
	/*for PolynomialExpNoise*//*d = degree*/
	float BofMTFd2;
	float BofMTFd3;
	float BofMTFd4;
	float BofMTFd5;
	float BofMTFd6;

	/* Molecular Envelope: Scattering Factor */
	/* For Gaussian */
	float MolecEnv;                   /* A : */
	/* For Table */
	long  flagMolecEnvTable;
	molecularEnvelope MolecEnvTable;
	/* For Lorentzian */
	float flagElastic;
	float Elastic;
	float ElasticShift;
	float ElasticWidth;
	float ElasticRing;
	float ElasticRingPosition;
	float ElasticRingWidth;

	/* Stage Vibration */
	long  flagVibration;
	long  VibrationMode;
	float BofVibration;

	/* Aliasing and Sampling */
	long flagAliasing;
	float NyquistFrequency;
	long flagSampling; 

	/* Inelastic Signal */
	/* For Gaussian */
	long flagWithInElastic;
	float InElasticGaussian;
	/* For Table */
	long flagWithInElasticTable;
	molecularEnvelope InElasticEnvTable;	
	/* Lorentzian */	
	long flagInElastic;
	float InElastic;
	float InElasticShift;
	float InElasticWidth;
	float InElasticRing;
	float InElasticRingPosition;
	float InElasticRingWidth;
} ctfInfo;

API

Scattering

Return the value that is added Signal(by ctfSignalFunction) and Noise(by ctfNoiseFunction).

extern float ctfScatteringFunction(ctfInfo* info, float R, long mode);

Signal

Output the signal.
(use ctfFunction, ctfMolecularEnvelopeFunction, ctfMolecularEnvelopeInElasticFunction, ctfVibrationFunction, ctfMTFFunction)
if info->flagAliasing=true: add Aliasing. (use info->NyquistFrequency)

extern float ctfSignalFunction(ctfInfo* info, float R, long mode);

Output the signal power about above.

extern float ctfSignalPowerFunction(ctfInfo* info, float R, long mode);
Calculate Molecular Envelope

if info->flagMolecEnvTable=true: call lmolecularEnvelopeDataGet, use table data(by info->MolecEnvTable)

extern float ctfMolecularEnvelopeFunction(ctfInfo* info, float R, long mode);
extern float ctfMolecularEnvelopeInElasticFunction(ctfInfo* info, float R, long mode);

Noise

Output noise that is multiplied White noise(info->WhiteNoise) and MTF(by ctfMTFFunction).
if info->flagAliasing=true: add Aliasing.(use info->NyquistFrequency)

extern float ctfNoiseFunction(ctfInfo* info, float R, long mode);

Output the noise power about above.

extern float ctfNoisePowerFunction(ctfInfo* info, float R, long mode);

Output noise by using White noise of info->WhiteNoise2.

extern float ctfNoise2Function(ctfInfo* info, float R, long mode);

Output the noise power about above.

extern float ctfNoise2PowerFunction(ctfInfo* info, float R, long mode);

Calculate Vibration Function

Calculate Vibration Function at R.
info->Magnification: RのMagnification

extern float ctfVibrationFunction(ctfInfo* info, float R, long mode);

if info->flagVibration=true and info->VibrationMode=0: Output Vibration Function: Env = exp(-B*B*R*R/2.0)(Otherwise: output 1)

Calculate CTF

extern float ctfFunction(ctfInfo* info, float R, long mode);

Calculate CTF at R
Wavelength of the electron beam: by wavelengthOfElectron
Contrast: set the method by info->mode

info->mode(Mask at 0x0f) Description
0 only Phase contrast
1 + Intensity contrast


Case 2D

Calculate R by X and Y. Then call cfFunction with it as argument.

extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode);

Calculate Envelope

extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode);

Calculate Envelope at R
Wavelength of the electron beam: by wavelengthOfElectron
if info->flagMagnification=1: multiply R and info->Magnification(without 0).

info->mode part of mask Description
ctfInfoModeWithMTF 0x10 multiply MTF(by calling ctfMTFFunction)
ctfInfoModeWithIlluminationAngle 0x20 multiply the value with Illumination Angle(info->Ain)
ctfInfoModeWithEnergySpread 0x40 multiply the value with Energy Spread


Calculate MTF

extern float ctfMTFFunction(ctfInfo* info, float R, long mode);

Calculate MTF at R
info->Magnification: Magnification of R
if info->flagSampling=1: multiply the sampling function (by calling ctfFunctionSampling: info->NyquistFrequency is 2nd argument as Nyquist)

Variable Value Description used info's member by MTF
ctfInfoMTFModeSingleExp 0 Exponential BofMTF
ctfInfoMTFModeSingleLorentzian 1 Lorenz Function BofMTF2
ctfInfoMTFModeBoth 2 Exponential x Lorenz Function BofMTF, BofMTF2
ctfInfoMTFModeLinear 3 Linear BofMTF
ctfInfoMTFModeBothSum 4 Exponential + Lorenz Function BofMTF, BofMTF2, WeightOfSecondTermForMTF(Ratio of addition)
ctfInfoMTFModePolynomial 5 Polynomial BofMTF, BofMTFd2, BofMTFd3, BofMTFd4, BofMTFd5


Calculate Sampling function

Calculate Sampling function at R.

extern float ctfFunctionSampling(float R, float Nyquist, long mode);

Get wavelength of the electron beam

extern float wavelengthOfElectron(float E);

Determination of defocus from Thon ring

extern float defocusDeterminationFromThonRing(ctfInfo* info, float R, long n, long mode);

Wavelength of the electron beam: by wavelengthOfElectron
Contrast: set the method by info->mode

info->mode(Mask at 0x0f) Description
0 only Phase contrast
1 + Intensity contrast


Calculate weight for CTF Correction

Output the weight for CTF Correction.
extern float ctfWeightForCorrection(ctfInfo* info, float R, long mode);
mode Description
0 return 1(No Correction)
1 ctf/|ctf| (phase flipping)
2 ctf (phase flipping and ctf-multiplying)
3 1/ctf (0.1<|ctf| ) (phase flipping and ctf-divided)
4 ctf/(SQR(ctf)+SQR(NS)) phase-flipping + Winner Filtering
5 SQR(ctf) x ctf/|ctf| phase-flipping + ctf-Weighted
6 1/|ctf| (0.1<|ctf|) No phase-flipping + ctf-divided
7 |ctf|/(SQR(ctf)+SQR(NS)) No phase flipping + Winner Filtering


Case 2D

Calculate R by X and Y. Then call ctfWeightForCorrection with it as argument.

extern float ctfWeightForCorrection2D(ctfInfo* info, float X, float Y, long mode);

Molecular Envelope

File Read

extern void lmolecularEnvelopeFileRead(FILE* fpt, molecularEnvelope* mol, int mode);

File Write

extern void lmolecularEnvelopeFileWrite(FILE* fpt, molecularEnvelope* mol, int mode);

Resampling

extern void lmolecularEnvelopeResampling(molecularEnvelope* dst, molecularEnvelope* src, float dR, float RMax, int mode);

Get the Envelope of src at R.

extern float lmolecularEnvelopeDataGet(molecularEnvelope* src, float R, int mode);

CTFInformation

File Read

extern void ctfInfoRead(FILE* fpt, ctfInfo* ctf, char* pre, int mode);

File Write

extern void ctfInfoWrite(FILE* fpt, ctfInfo ctf, char* pre, int mode);

Only when installed PVM

extern void ctfInfoSendByPVM(ctfInfo* info, int tid, long mode);
extern void ctfInfoRecieveByPVM(ctfInfo* info, int tid, long mode);
extern void  ctfFunctionPVMStart(ctfInfo* info, float R, int tid, long mode);
extern float ctfFunctionPVMEnd(ctfInfo* info, float R, int tid, long mode);
extern void  ctfFunctionPVMServer();

Help

extern void ctfWeightForCorrectionUsage(FILE* fpt);