|
Bsoft
2.1.0
Bernard's software package
|
Functions for CTF (contrast transfer function) processing. More...
Go to the source code of this file.
Functions | |
| Bimage * | img_ctf_calculate (CTFparam cp, int action, double wiener, Vector3< long > size, Vector3< double > sam, double lores=0, double hires=0) |
| Calculates a CTF complex image. More... | |
| Bimage * | img_wave_aberration (CTFparam cp, Vector3< long > size, Vector3< double > sam) |
| Calculates a wave aberration function. More... | |
| int | img_ctf_apply (Bimage *p, CTFparam em_ctf, int action, double wiener, double lores, double hires) |
| Applies or corrects for the contrast transfer function (CTF). More... | |
| int | img_ctf_apply (Bimage *p, CTFparam em_ctf, int action, double wiener, double lores, double hires, fft_plan planf_2D, fft_plan planb_2D) |
| int | img_ttf_apply (Bimage *p, CTFparam ctf, int action, double wiener, Vector3< long > tile_size, double tilt, double axis, double res_lo, double res_hi) |
| Applies or corrects for the tilted contrast transfer function (TTF). More... | |
| int | img_ctf_apply_to_proj (Bimage *proj, CTFparam em_ctf, double defocus, double res_lo, double res_hi, fft_plan planf_2D, fft_plan planb_2D) |
| Applies a CTF to a projection image. More... | |
| int | project_ctf_prepare (Bproject *project, int action, double lores, double hires, Vector3< long > tile_size, double def_start, double def_end, double def_inc, Bstring &path, Bstring &newname, int flags) |
| Calculates power spectra and optionally fits CTF curves. More... | |
| int | project_ctf (Bproject *project, int action, double lores, double hires, Vector3< long > tile_size, double wiener, DataType datatype, Bstring &partpath, Bstring &newname, int flags) |
| Calculates or fits CTF curves to multiple power spectra. More... | |
| JSvalue | project_defocus_range (Bproject *project) |
| Determines the minimum and maximum defocus values. More... | |
| int | project_ctf_average (Bproject *project, Bstring &psname) |
| Calculates or fits CTF curves to multiple power spectra. More... | |
| Bimage * | project_powerspectrum_average (Bproject *project, double deftarget) |
| Averages multiple power spectra based on defocus estimates. More... | |
| int | project_merge_CTF_parameters (Bproject *project, Bproject *ctfproject) |
| Puts CTF parameters from one project into another. More... | |
| int | project_CTF_to_part (Bproject *project) |
| Transfers CTF parameters from micrographs to particles. More... | |
| int | project_set_defocus (Bproject *project, double def_avg, double def_dev, double ast_angle) |
| Sets the defocus values of all the micrographs. More... | |
| int | project_set_astigmatism (Bproject *project, double def_dev, double ast_angle) |
| Sets the defocus deviation and astigmatism angle of all the micrographs. More... | |
| int | project_update_ctf (Bproject *project, JSvalue &jsctf) |
| Sets the acceleration voltage of all the micrographs. More... | |
| int | project_set_volts (Bproject *project, double volts) |
| Sets the acceleration voltage of all the micrographs. More... | |
| int | project_set_Cs (Bproject *project, double Cs) |
| Sets the spherical aberation constant of all the micrographs. More... | |
| int | project_set_amp_shift (Bproject *project, double amp_shift) |
| Sets the amplitude contribution of all the micrographs. More... | |
| int | project_set_focal_length (Bproject *project, double focal_length) |
| Sets the focal length of all the micrographs. More... | |
| int | project_set_aperture (Bproject *project, double aperture) |
| Sets the objective aperture of all the micrographs. More... | |
| int | project_set_slit_width (Bproject *project, double slit) |
| Sets the energy filter slit width of all the micrographs. More... | |
| int | project_set_alpha (Bproject *project, double alpha) |
| Sets the beam source size/divergence angle of all the micrographs. More... | |
| int | project_set_envelope_type (Bproject *project, int type) |
| Sets the envelope type of all the micrographs. More... | |
| int | project_set_envelope (Bproject *project, int type, double *coeff) |
| Sets the envelope equations of all the micrographs. More... | |
| int | project_set_coherence_envelope (Bproject *project) |
| Replaces envelope equations with those based on partial coherence in all micrographs. More... | |
| int | project_set_baseline_type (Bproject *project, int type) |
| Sets the baseline type of all the micrographs. More... | |
| int | project_set_baseline (Bproject *project, int type, double *coeff) |
| Sets the baseline equations of all the micrographs. More... | |
| int | project_update_first_zero (Bproject *project) |
| Updates the first zero from the defocus average for all the micrographs. More... | |
| int | project_plot_ctf (Bproject *project, Bstring &filename) |
| Plots the CTF curves. More... | |
Functions for CTF (contrast transfer function) processing.
Definition in file mg_ctf.h.
| int img_ctf_apply | ( | Bimage * | p, |
| CTFparam | em_ctf, | ||
| int | action, | ||
| double | wiener, | ||
| double | lores, | ||
| double | hires | ||
| ) |
Applies or corrects for the contrast transfer function (CTF).
| *p | image (modified). |
| *em_ctf | CTF parameter structure. |
| action | action to be taken. |
| wiener | Wiener factor (fraction). |
| lores | low resolution limit. |
| hires | high resolution limit. |
The actions for this funtion are: 1 flip phase (multiply by the sign of the CTF) 2 apply a CTF (multiply with the CTF) 3 correct for the CTF: ctf/(ctf^2 + wiener_factor) 4 correct for the CTF: env*ctf/((env*ctf)^2 + noise^2) 5 correct for the CTF with baseline: ctf/(ctf^2*noise^2 + wiener_factor) 6 correct for the CTF with baseline: 1/(ctf*noise + sign*wiener_factor)
Definition at line 237 of file mg_ctf.cpp.
| int img_ctf_apply | ( | Bimage * | p, |
| CTFparam | em_ctf, | ||
| int | action, | ||
| double | wiener, | ||
| double | lores, | ||
| double | hires, | ||
| fft_plan | planf_2D, | ||
| fft_plan | planb_2D | ||
| ) |
Definition at line 276 of file mg_ctf.cpp.
| int img_ctf_apply_to_proj | ( | Bimage * | proj, |
| CTFparam | em_ctf, | ||
| double | defocus, | ||
| double | res_lo, | ||
| double | res_hi, | ||
| fft_plan | planf_2D, | ||
| fft_plan | planb_2D | ||
| ) |
Applies a CTF to a projection image.
| *proj | projection image. |
| em_ctf | CTF parameters. |
| defocus | defocus. |
| res_lo | low resolution limit (angstrom). |
| res_hi | high resolution limit (angstrom). |
| planf_2D | 2D forward fourier transform plan. |
| planb_2D | 2D backward fourier transform plan. |
Definition at line 354 of file mg_ctf.cpp.
| Bimage* img_ctf_calculate | ( | CTFparam | cp, |
| int | action, | ||
| double | wiener, | ||
| Vector3< long > | size, | ||
| Vector3< double > | sam, | ||
| double | lores, | ||
| double | hires | ||
| ) |
Calculates a CTF complex image.
| cp | CTF parameters. |
| action | type of CTF calculated (1-8). |
| wiener | Wiener factor (fraction). |
| size | new image size. |
| sam | new image pixel size. |
| lores | low resolution limit. |
| hires | high resolution limit. |
Functions:
angle = atan(y/x)
s2 = x*x + y*y
defocus_average = (defocus_max + defocus_min)/2
defocus_deviation = (defocus_max - defocus_min)/2
defocus = defocus_average + defocus_deviation*cos(2*(angle - astigmatism_angle))
phase = 0.5*PI*lambda*lambda*lambda*Cs*s2*s2 - PI*lambda*defocus*s2 - amp_shift;
CTF = sin(phase)
Note: Defocus is positive for underfocus and negative for overfocus.
Definition at line 45 of file mg_ctf.cpp.
| int img_ttf_apply | ( | Bimage * | p, |
| CTFparam | ctf, | ||
| int | action, | ||
| double | wiener, | ||
| Vector3< long > | tile_size, | ||
| double | tilt, | ||
| double | axis, | ||
| double | res_lo, | ||
| double | res_hi | ||
| ) |
Applies or corrects for the tilted contrast transfer function (TTF).
| *p | image (modified). |
| ctf | CTF parameter structure. |
| action | action to be taken. |
| wiener | Wiener factor (fraction). |
| tile_size | tile size for tilted CTF operations. |
| tilt | tilt angle (radians). |
| axis | tilt axis angle (radians). |
| res_lo | high resolution limit. |
| res_hi | low resolution limit. |
The actions for this funtion are: 1 flip phase (multiply by the sign of the CTF) 2 apply a CTF (multiply with the CTF) 3 correct for the CTF: ctf/(ctf^2 + wiener_factor) 4 correct for the CTF: env*ctf/((env*ctf)^2 + noise^2) 5 correct for the CTF with baseline: ctf/(ctf^2*noise^2 + wiener_factor) 6 correct for the CTF with baseline: 1/(ctf*noise + sign*wiener_factor)
Definition at line 388 of file mg_ctf.cpp.
Calculates a wave aberration function.
| cp | CTF parameters. |
| size | new image size. |
| sam | new image pixel size. |
Functions:
angle = atan(y/x)
s2 = x*x + y*y
defocus_average = (defocus_max + defocus_min)/2
defocus_deviation = (defocus_max - defocus_min)/2
defocus = defocus_average + defocus_deviation*cos(2*(angle - astigmatism_angle))
phase = 0.5*PI*lambda*lambda*lambda*Cs*s2*s2 - PI*lambda*defocus*s2;
Note: Defocus is positive for underfocus and negative for overfocus.
Definition at line 174 of file mg_ctf.cpp.
| int project_ctf | ( | Bproject * | project, |
| int | action, | ||
| double | lores, | ||
| double | hires, | ||
| Vector3< long > | tile_size, | ||
| double | wiener, | ||
| DataType | datatype, | ||
| Bstring & | partpath, | ||
| Bstring & | newname, | ||
| int | flags | ||
| ) |
Calculates or fits CTF curves to multiple power spectra.
| *project | project parameter structure. |
| action | CTF processing action. |
| lores | low resolution limit for CTF operations. |
| hires | high resolution limit for CTF operations. |
| tile_size | tile size for tilted CTF operations. |
| wiener | Wiener factor. |
| datatype | corrected particle file data type. |
| &partpath | corrected particle file path. |
| &newname | new file name for output. |
| flags | 1=use mg or rec, 2=filter, 4=background, 8=astigmatism, 16=use frmaes |
The default is to use the particle file. If the particle file is not specified, the micrograph is used. The selection can also be done with the use_mg flag.
Definition at line 1119 of file mg_ctf.cpp.
Calculates or fits CTF curves to multiple power spectra.
| *project | project parameter structure. |
| &psname | postscript file name for output. |
The default is to use the particle file. If the particle file is not specified, the micrograph is used. The selection can also be done with the use_mg flag.
Definition at line 1259 of file mg_ctf.cpp.
| int project_ctf_prepare | ( | Bproject * | project, |
| int | action, | ||
| double | lores, | ||
| double | hires, | ||
| Vector3< long > | tile_size, | ||
| double | def_start, | ||
| double | def_end, | ||
| double | def_inc, | ||
| Bstring & | path, | ||
| Bstring & | newname, | ||
| int | flags | ||
| ) |
Calculates power spectra and optionally fits CTF curves.
| *project | project parameter structure. |
| action | CTF processing action. |
| lores | low resolution limit for CTF operations. |
| hires | high resolution limit for CTF operations. |
| tile_size | tile size for power spectrum generation. |
| def_start | defocus search start (default 1e3). |
| def_end | defocus search end (default 2e5). |
| def_inc | defocus search increment (default 1e3). |
| &path | new power spectrum directory for output. |
| &newname | new file name for output. |
| flags | 1=use mg or rec, 2=filter, 4=background, 8=astigmatism, 16=frames |
The default is to use the particle file. If the particle file is not specified, the micrograph is used.
Definition at line 719 of file mg_ctf.cpp.
| int project_CTF_to_part | ( | Bproject * | project | ) |
Transfers CTF parameters from micrographs to particles.
| *project | project parameter structure with all parameters. |
Definition at line 1422 of file mg_ctf.cpp.
Determines the minimum and maximum defocus values.
| *project | project parameter structure. |
Definition at line 1211 of file mg_ctf.cpp.
Puts CTF parameters from one project into another.
| *project | project parameter structure with all parameters. |
| *ctfproject | project parameter structure with CTF parameters. |
Definition at line 1383 of file mg_ctf.cpp.
Plots the CTF curves.
| *project | project parameter structure. |
| &filename | Postscript file name. |
Definition at line 1967 of file mg_ctf.cpp.
Averages multiple power spectra based on defocus estimates.
| *project | project parameter structure. |
| deftarget | target defocus (angstrom). |
Definition at line 1332 of file mg_ctf.cpp.
| int project_set_alpha | ( | Bproject * | project, |
| double | alpha | ||
| ) |
Sets the beam source size/divergence angle of all the micrographs.
| *project | project parameter structure. |
| alpha | beam source size/divergence angle (radians). |
Definition at line 1752 of file mg_ctf.cpp.
| int project_set_amp_shift | ( | Bproject * | project, |
| double | amp_shift | ||
| ) |
Sets the amplitude contribution of all the micrographs.
| *project | project parameter structure. |
| amp_shift | amplitude contribution phase shift. |
Definition at line 1638 of file mg_ctf.cpp.
| int project_set_aperture | ( | Bproject * | project, |
| double | aperture | ||
| ) |
Sets the objective aperture of all the micrographs.
| *project | project parameter structure. |
| aperture | objective aperture in angstrom. |
Definition at line 1695 of file mg_ctf.cpp.
| int project_set_astigmatism | ( | Bproject * | project, |
| double | def_dev, | ||
| double | ast_angle | ||
| ) |
Sets the defocus deviation and astigmatism angle of all the micrographs.
| *project | project parameter structure. |
| def_dev | defocus deviation. |
| ast_angle | astigmatism angle. |
Definition at line 1514 of file mg_ctf.cpp.
| int project_set_baseline | ( | Bproject * | project, |
| int | type, | ||
| double * | coeff | ||
| ) |
Sets the baseline equations of all the micrographs.
| *project | project parameter structure. |
| type | baseline type. |
| *coeff | 5 baseline coefficients. |
Definition at line 1902 of file mg_ctf.cpp.
| int project_set_baseline_type | ( | Bproject * | project, |
| int | type | ||
| ) |
Sets the baseline type of all the micrographs.
| *project | project parameter structure. |
| type | baseline type. |
Definition at line 1872 of file mg_ctf.cpp.
| int project_set_coherence_envelope | ( | Bproject * | project | ) |
Replaces envelope equations with those based on partial coherence in all micrographs.
| *project | project parameter structure. |
Partial coherence envelope:
env = amp*exp(-(pi*alpha*defocus*s)^2)
The amplitude, defocus and alpha values are taken from the fields
in each micrograph. The defocus must already be determined.
Definition at line 1844 of file mg_ctf.cpp.
| int project_set_Cs | ( | Bproject * | project, |
| double | Cs | ||
| ) |
Sets the spherical aberation constant of all the micrographs.
| *project | project parameter structure. |
| Cs | spherical aberation constant in angstrom. |
Definition at line 1609 of file mg_ctf.cpp.
| int project_set_defocus | ( | Bproject * | project, |
| double | def_avg, | ||
| double | def_dev, | ||
| double | ast_angle | ||
| ) |
Sets the defocus values of all the micrographs.
| *project | project parameter structure. |
| def_avg | defocus average. |
| def_dev | defocus deviation. |
| ast_angle | astigmatism angle. |
Definition at line 1463 of file mg_ctf.cpp.
| int project_set_envelope | ( | Bproject * | project, |
| int | type, | ||
| double * | coeff | ||
| ) |
Sets the envelope equations of all the micrographs.
| *project | project parameter structure. |
| type | envelope type. |
| *coeff | 5 envelope coefficients. |
Definition at line 1809 of file mg_ctf.cpp.
| int project_set_envelope_type | ( | Bproject * | project, |
| int | type | ||
| ) |
Sets the envelope type of all the micrographs.
| *project | project parameter structure. |
| type | envelope type. |
Definition at line 1780 of file mg_ctf.cpp.
| int project_set_focal_length | ( | Bproject * | project, |
| double | focal_length | ||
| ) |
Sets the focal length of all the micrographs.
| *project | project parameter structure. |
| focal_length | focal length in angstrom. |
Definition at line 1666 of file mg_ctf.cpp.
| int project_set_slit_width | ( | Bproject * | project, |
| double | slit | ||
| ) |
Sets the energy filter slit width of all the micrographs.
| *project | project parameter structure. |
| slit | slit width in eV. |
Definition at line 1724 of file mg_ctf.cpp.
| int project_set_volts | ( | Bproject * | project, |
| double | volts | ||
| ) |
Sets the acceleration voltage of all the micrographs.
| *project | project parameter structure. |
| volts | acceleration voltage. |
Definition at line 1579 of file mg_ctf.cpp.
Sets the acceleration voltage of all the micrographs.
| *project | project parameter structure. |
| jsctf | JSON parameters to be updated. |
Definition at line 1548 of file mg_ctf.cpp.
| int project_update_first_zero | ( | Bproject * | project | ) |
Updates the first zero from the defocus average for all the micrographs.
| *project | project parameter structure. |
Definition at line 1932 of file mg_ctf.cpp.