「ctfInfo(API)」の版間の差分
提供: Eospedia
| 行46: | 行46: | ||
==== モード値の定義 ==== | ==== モード値の定義 ==== | ||
| − | ===== | + | ===== コントラストモード ===== |
| − | ctfInfoModeWithAmplitudeContrastでマスクした値に対応 | + | ctfInfo->modeにて使用(ctfInfoModeWithAmplitudeContrastでマスクした値に対応) |
typedef enum ctfInfoMode { | typedef enum ctfInfoMode { | ||
ctfInfoModePhaseCTFOnly = 0, | ctfInfoModePhaseCTFOnly = 0, | ||
| 行74: | 行74: | ||
===== envelope関数のモード ===== | ===== envelope関数のモード ===== | ||
| + | ctfInfo->MTFModeにて使用 | ||
typedef enum ctfInfoMTFMode { | typedef enum ctfInfoMTFMode { | ||
ctfInfoMTFModeSingleExp = 0, | ctfInfoMTFModeSingleExp = 0, | ||
| 行92: | 行93: | ||
<td>ctfInfoMTFModeSingleExp</td> | <td>ctfInfoMTFModeSingleExp</td> | ||
<td>0</td> | <td>0</td> | ||
| − | <td></td> | + | <td>指数関数</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>ctfInfoMTFModeSingleLorentzian</td> | <td>ctfInfoMTFModeSingleLorentzian</td> | ||
<td>1</td> | <td>1</td> | ||
| − | <td></td> | + | <td>ローレンツ関数</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>ctfInfoMTFModeBoth</td> | <td>ctfInfoMTFModeBoth</td> | ||
<td>2</td> | <td>2</td> | ||
| − | <td></td> | + | <td>指数関数×ローレンツ関数</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>ctfInfoMTFModeLinear</td> | <td>ctfInfoMTFModeLinear</td> | ||
<td>3</td> | <td>3</td> | ||
| − | <td></td> | + | <td>リニア</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>ctfInfoMTFModeBothSum</td> | <td>ctfInfoMTFModeBothSum</td> | ||
<td>4</td> | <td>4</td> | ||
| − | <td></td> | + | <td>指数関数+ローレンツ関数</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>ctfInfoMTFModePolynomial</td> | <td>ctfInfoMTFModePolynomial</td> | ||
<td>5</td> | <td>5</td> | ||
| − | <td></td> | + | <td>多項式</td> |
</tr> | </tr> | ||
</div> | </div> | ||
| 行238: | 行239: | ||
==== [[CTF]]の算出 ==== | ==== [[CTF]]の算出 ==== | ||
extern float ctfFunction(ctfInfo* info, float R, long mode); | extern float ctfFunction(ctfInfo* info, float R, long mode); | ||
| + | 電子線の波長(wavelengthOfElectronより)、コントラスト(info->mode)、envelope(ctfEnvelopFunctionより)から[[CTF]]を算出してRでの値を出力します。 | ||
<table border="1"> | <table border="1"> | ||
<div align="left"> | <div align="left"> | ||
| 行248: | 行250: | ||
<td>ctfInfoModeWithAmplitudeContrast</td> | <td>ctfInfoModeWithAmplitudeContrast</td> | ||
<td>0x0f</td> | <td>0x0f</td> | ||
| − | <td> | + | <td>コントラストモード</td> |
</tr> | </tr> | ||
</div> | </div> | ||
| 行254: | 行256: | ||
<br> | <br> | ||
| − | extern float | + | ===== 2Dの場合 ===== |
| + | ctfFunctionを呼び出して2Dでの[[CTF]]を算出 | ||
| + | extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode); | ||
| + | |||
| + | ===== PVM使用時 ===== | ||
extern void ctfFunctionPVMStart(ctfInfo* info, float R, 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 float ctfFunctionPVMEnd(ctfInfo* info, float R, int tid, long mode); | ||
| 行261: | 行267: | ||
==== Envelope関数の算出 ==== | ==== Envelope関数の算出 ==== | ||
extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode); | extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode); | ||
| + | wavelengthOfElectronにより電子線の波長を取得 | ||
| + | info->flagMagnification=1のとき: info->Magnification(0以外で)をRの倍率として掛ける | ||
<table border="1"> | <table border="1"> | ||
<div align="left"> | <div align="left"> | ||
| 行289: | 行297: | ||
==== [[MTF]]の算出 ==== | ==== [[MTF]]の算出 ==== | ||
extern float ctfMTFFunction(ctfInfo* info, float R, long mode); | extern float ctfMTFFunction(ctfInfo* info, float R, long mode); | ||
| + | info->Magnification: 引数Rの倍率<br> | ||
| + | info->flagSampling=1のとき: 標本化関数を積算(ctfFunctionSamplingを呼び出す: info->NyquistFrequencyを第2引数(ナイキスト)とする) | ||
| + | <table border="1"> | ||
| + | <div align="left"> | ||
| + | <tr> | ||
| + | <th>モード</th> | ||
| + | <th>値</th> | ||
| + | <th>説明</th> | ||
| + | <th>[[MTF]]算出時に使用するinfoのメンバ</th> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModeSingleExp</td> | ||
| + | <td>0</td> | ||
| + | <td>指数関数</td> | ||
| + | <td>BofMTF</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModeSingleLorentzian</td> | ||
| + | <td>1</td> | ||
| + | <td>ローレンツ関数</td> | ||
| + | <td>BofMTF2</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModeBoth</td> | ||
| + | <td>2</td> | ||
| + | <td>指数関数×ローレンツ関数</td> | ||
| + | <td>BofMTF, BofMTF2</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModeLinear</td> | ||
| + | <td>3</td> | ||
| + | <td>リニア</td> | ||
| + | <td>BofMTF</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModeBothSum</td> | ||
| + | <td>4</td> | ||
| + | <td>指数関数+ローレンツ関数</td> | ||
| + | <td>BofMTF, BofMTF2, WeightOfSecondTermForMTF(2つの関数を加える割合)</td> | ||
| + | </tr> | ||
| + | <tr> | ||
| + | <td>ctfInfoMTFModePolynomial</td> | ||
| + | <td>5</td> | ||
| + | <td>多項式</td> | ||
| + | <td>BofMTF, BofMTFd2, BofMTFd3, BofMTFd4, BofMTFd5</td> | ||
| + | </tr> | ||
| + | </div> | ||
| + | </table> | ||
| + | <br> | ||
| − | extern float | + | ==== 標本化関数の算出 ==== |
| + | extern float ctfFunctionSampling(float R, float Nyquist, long mode); | ||
| + | |||
| + | ==== 電子線の波長の取得 ==== | ||
extern float wavelengthOfElectron(float E); | extern float wavelengthOfElectron(float E); | ||
| 行305: | 行365: | ||
<td>ctfInfoModeWithAmplitudeContrast</td> | <td>ctfInfoModeWithAmplitudeContrast</td> | ||
<td>0x0f</td> | <td>0x0f</td> | ||
| − | <td> | + | <td>コントラストモード</td> |
</tr> | </tr> | ||
</div> | </div> | ||
2014年9月25日 (木) 03:02時点における版
DataManip/ctfInfoはCTFの推定及びCTF補正のためのAPI です。
目次
定数
モード選択
マスク用
#define ctfInfoModeWithAmplitudeContrast 0x0f #define ctfInfoModeWithMTF 0x10 #define ctfInfoModeWithIlluminationAngle 0x20 #define ctfInfoModeWithEnergySpread 0x40 #define ctfInfoModeAbsoluteValue 0x100
| モード | マスク部分 | 説明 |
|---|---|---|
| ctfInfoModeWithAmplitudeContrast | 0x0f | コントラスト補正のモード |
| ctfInfoModeWithMTF | 0x10 | MTF積算のフラグ |
| ctfInfoModeWithIlluminationAngle | 0x20 | 照射角度の考慮のフラグ |
| ctfInfoModeWithEnergySpread | 0x40 | エネルギー拡散の考慮のフラグ |
| ctfInfoModeAbsoluteValue | 0x100 | 絶対値のフラグ |
モード値の定義
コントラストモード
ctfInfo->modeにて使用(ctfInfoModeWithAmplitudeContrastでマスクした値に対応)
typedef enum ctfInfoMode {
ctfInfoModePhaseCTFOnly = 0,
ctfInfoModePhaseAndAmpCTF = 1
} ctfInfoMode;
| モード | 値 | 説明 |
|---|---|---|
| ctfInfoModePhaseCTFOnly | 0 | 位相コントラストだけ |
| ctfInfoModePhaseAndAmpCTF | 1 | 強度コントラストを加える |
envelope関数のモード
ctfInfo->MTFModeにて使用
typedef enum ctfInfoMTFMode {
ctfInfoMTFModeSingleExp = 0,
ctfInfoMTFModeSingleLorentzian = 1,
ctfInfoMTFModeBoth = 2,
ctfInfoMTFModeLinear = 3,
ctfInfoMTFModeBothSum = 4,
ctfInfoMTFModePolynomial = 5
} ctfInfoMTFMode;
| モード | 値 | 説明 |
|---|---|---|
| ctfInfoMTFModeSingleExp | 0 | 指数関数 |
| ctfInfoMTFModeSingleLorentzian | 1 | ローレンツ関数 |
| ctfInfoMTFModeBoth | 2 | 指数関数×ローレンツ関数 |
| ctfInfoMTFModeLinear | 3 | リニア |
| ctfInfoMTFModeBothSum | 4 | 指数関数+ローレンツ関数 |
| ctfInfoMTFModePolynomial | 5 | 多項式 |
構造体
typedef struct moleculrEnvelope {
char* filename;
int nR;
float* R;
float* Envelope;
int mode;
} molecularEnvelope;
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
extern void ctfInfoSendByPVM(ctfInfo* info, int tid, long mode); extern void ctfInfoRecieveByPVM(ctfInfo* info, int tid, 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); 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); extern float ctfScatteringFunction(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 ctfVibrationFunction(ctfInfo* info, float R, long mode);
CTFの算出
extern float ctfFunction(ctfInfo* info, float R, long mode);
電子線の波長(wavelengthOfElectronより)、コントラスト(info->mode)、envelope(ctfEnvelopFunctionより)からCTFを算出してRでの値を出力します。
| info->mode | マスク部分 | 説明 |
|---|---|---|
| ctfInfoModeWithAmplitudeContrast | 0x0f | コントラストモード |
2Dの場合
ctfFunctionを呼び出して2DでのCTFを算出
extern float ctfFunction2D(ctfInfo* info, float X, float Y, long mode);
PVM使用時
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();
Envelope関数の算出
extern float ctfEnvelopFunction(ctfInfo* info, float R, long mode);
wavelengthOfElectronにより電子線の波長を取得 info->flagMagnification=1のとき: info->Magnification(0以外で)をRの倍率として掛ける
| info->mode | マスク部分 | 説明 |
|---|---|---|
| ctfInfoModeWithMTF | 0x10 | MTFを積算(ctfMTFFunctionを呼び出す) |
| ctfInfoModeWithIlluminationAngle | 0x20 | 照射角度(info->Ain)を考慮した値を積算 |
| ctfInfoModeWithEnergySpread | 0x40 | エネルギー拡散を考慮した値を積算 |
MTFの算出
extern float ctfMTFFunction(ctfInfo* info, float R, long mode);
info->Magnification: 引数Rの倍率
info->flagSampling=1のとき: 標本化関数を積算(ctfFunctionSamplingを呼び出す: info->NyquistFrequencyを第2引数(ナイキスト)とする)
| モード | 値 | 説明 | MTF算出時に使用するinfoのメンバ |
|---|---|---|---|
| ctfInfoMTFModeSingleExp | 0 | 指数関数 | BofMTF |
| ctfInfoMTFModeSingleLorentzian | 1 | ローレンツ関数 | BofMTF2 |
| ctfInfoMTFModeBoth | 2 | 指数関数×ローレンツ関数 | BofMTF, BofMTF2 |
| ctfInfoMTFModeLinear | 3 | リニア | BofMTF |
| ctfInfoMTFModeBothSum | 4 | 指数関数+ローレンツ関数 | BofMTF, BofMTF2, WeightOfSecondTermForMTF(2つの関数を加える割合) |
| ctfInfoMTFModePolynomial | 5 | 多項式 | BofMTF, BofMTFd2, BofMTFd3, BofMTFd4, BofMTFd5 |
標本化関数の算出
extern float ctfFunctionSampling(float R, float Nyquist, long mode);
電子線の波長の取得
extern float wavelengthOfElectron(float E);
トーンリングからデフォーカスを推定
extern float defocusDeterminationFromThonRing(ctfInfo* info, float R, long n, long mode);
| info->mode | マスク部分 | 説明 |
|---|---|---|
| ctfInfoModeWithAmplitudeContrast | 0x0f | コントラストモード |
extern void ctfWeightForCorrectionUsage(FILE* fpt); extern float ctfWeightForCorrection2D(ctfInfo* info, float X, float Y, long mode); extern float ctfWeightForCorrection(ctfInfo* info, float R, long mode); extern void lmolecularEnvelopeFileRead(FILE* fpt, molecularEnvelope* mol, int mode); extern void lmolecularEnvelopeFileWrite(FILE* fpt, molecularEnvelope* mol, int mode); extern void lmolecularEnvelopeResampling(molecularEnvelope* dst, molecularEnvelope* src, float dR, float RMax, int mode); extern float lmolecularEnvelopeDataGet(molecularEnvelope* src, float R, int mode); extern void ctfInfoRead(FILE* fpt, ctfInfo* ctf, char* pre, int mode); extern void ctfInfoWrite(FILE* fpt, ctfInfo ctf, char* pre, int mode);