/Users/bernard/b20/bsoft/include/mg_ctf.h(3)

NAME
/Users/bernard/b20/bsoft/include/mg_ctf.h - Functions for CTF (contrast transfer function) processing.

SYNOPSIS

#include 'mg_processing.h'
#include 'rwimg.h'

  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.
Bimage * img_wave_aberration (CTFparam cp, Vector3< long > size, Vector3< double > sam)
Calculates a wave aberration function.
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).
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).
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.
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, Bstring &label, int flags)
Calculates power spectra and optionally fits CTF curves.
int project_ctf (Bproject *project, int action, double lores, double hires, Vector3< long > tile_size, double wiener, DataType datatype, Bstring &partpath, Bstring &newname, Bstring &label, int flags)
Calculates or fits CTF curves to multiple power spectra.
int project_ctf_average (Bproject *project, Bstring &psname)
Calculates or fits CTF curves to multiple power spectra.
Bimage * project_powerspectrum_average (Bproject *project, double deftarget)
Averages multiple power spectra based on defocus estimates.
int project_merge_CTF_parameters (Bproject *project, Bproject *ctfproject)
Puts CTF parameters from one project into another.
int project_CTF_to_part (Bproject *project)
Transfers CTF parameters from micrographs to particles.
int project_set_defocus (Bproject *project, double def_avg, double def_dev, double ast_angle)
Sets the defocus values of all the micrographs.
int project_set_astigmatism (Bproject *project, double def_dev, double ast_angle)
Sets the defocus deviation and astigmatism angle of all the micrographs.
int project_set_volts (Bproject *project, double volts)
Sets the acceleration voltage of all the micrographs.
int project_set_Cs (Bproject *project, double Cs)
Sets the spherical aberation constant of all the micrographs.
int project_set_amp_shift (Bproject *project, double amp_shift)
Sets the amplitude contribution of all the micrographs.
int project_set_alpha (Bproject *project, double alpha)
Sets the beam source size/divergence angle of all the micrographs.
int project_set_envelope_type (Bproject *project, int type)
Sets the envelope type of all the micrographs.
int project_set_envelope (Bproject *project, int type, double *coeff)
Sets the envelope equations of all the micrographs.
int project_set_coherence_envelope (Bproject *project)
Replaces envelope equations with those based on partial coherence in all micrographs.
int project_set_baseline_type (Bproject *project, int type)
Sets the baseline type of all the micrographs.
int project_set_baseline (Bproject *project, int type, double *coeff)
Sets the baseline equations of all the micrographs.
int project_update_first_zero (Bproject *project)
Updates the first zero from the defocus average for all the micrographs.
int project_plot_ctf (Bproject *project, Bstring &filename)
Plots the CTF curves.

Detailed Description

Functions for CTF (contrast transfer function) processing.

Author:
    Bernard Heymann

Date:
    Created: 19970715

    Modified: 20190209

Definition in file mg_ctf.h.

Function Documentation

  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).

Parameters:
    *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.

Returns:
    int 0, <0 on error.

    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 238 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.

Parameters:
    *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.

Returns:
    int error code.

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.

Parameters:
    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.

Returns:
    Bimage* new CTF function image.

    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).

Parameters:
    *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.

Returns:
    int 0, <0 on error.

    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.

  Bimage* img_wave_aberration (CTFparam cp, Vector3< long > size, Vector3< double > sam)

Calculates a wave aberration function.

Parameters:
    cp CTF parameters.
    size new image size.
    sam new image pixel size.

Returns:
    Bimage* new wave aberration function image.

    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 175 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, Bstring & label, int flags)

Calculates or fits CTF curves to multiple power spectra.

Parameters:
    *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.
    &label output image header label.
    flags 1=use mg or rec, 2=filter, 4=background, 8=astigmatism, 16=use frmaes

Returns:
    int 0, <0 on error.

    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 1121 of file mg_ctf.cpp.

  int project_ctf_average (Bproject * project, Bstring & psname)

Calculates or fits CTF curves to multiple power spectra.

Parameters:
    *project project parameter structure.
    &psname postscript file name for output.

Returns:
    int 0, <0 on error.

    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 1221 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, Bstring & label, int flags)

Calculates power spectra and optionally fits CTF curves.

Parameters:
    *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.
    &label output image header label.
    flags 1=use mg or rec, 2=filter, 4=background, 8=astigmatism, 16=frames

Returns:
    int 0, <0 on error.

    The default is to use the particle file. If the particle file is not
    specified, the micrograph is used.

Definition at line 717 of file mg_ctf.cpp.

  int project_CTF_to_part (Bproject * project)

Transfers CTF parameters from micrographs to particles.

Parameters:
    *project project parameter structure with all parameters.

Returns:
    int 0.

Definition at line 1384 of file mg_ctf.cpp.

  int project_merge_CTF_parameters (Bproject * project, Bproject * ctfproject)

Puts CTF parameters from one project into another.

Parameters:
    *project project parameter structure with all parameters.
    *ctfproject project parameter structure with CTF parameters.

Returns:
    int 0.

Definition at line 1345 of file mg_ctf.cpp.

  int project_plot_ctf (Bproject * project, Bstring & filename)

Plots the CTF curves.

Parameters:
    *project project parameter structure.
    &filename Postscript file name.

Returns:
    int 0.

Definition at line 1811 of file mg_ctf.cpp.

  Bimage* project_powerspectrum_average (Bproject * project, double deftarget)

Averages multiple power spectra based on defocus estimates.

Parameters:
    *project project parameter structure.
    deftarget target defocus (angstrom).

Returns:
    Bimage* average power spectrum.

Definition at line 1294 of file mg_ctf.cpp.

  int project_set_alpha (Bproject * project, double alpha)

Sets the beam source size/divergence angle of all the micrographs.

Parameters:
    *project project parameter structure.
    alpha beam source size/divergence angle (radians).

Returns:
    int 0.

Definition at line 1596 of file mg_ctf.cpp.

  int project_set_amp_shift (Bproject * project, double amp_shift)

Sets the amplitude contribution of all the micrographs.

Parameters:
    *project project parameter structure.
    amp_shift amplitude contribution phase shift.

Returns:
    int 0.

Definition at line 1568 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.

Parameters:
    *project project parameter structure.
    def_dev defocus deviation.
    ast_angle astigmatism angle.

Returns:
    int 0.

Definition at line 1476 of file mg_ctf.cpp.

  int project_set_baseline (Bproject * project, int type, double * coeff)

Sets the baseline equations of all the micrographs.

Parameters:
    *project project parameter structure.
    type baseline type.
    *coeff 5 baseline coefficients.

Returns:
    int 0.

Definition at line 1746 of file mg_ctf.cpp.

  int project_set_baseline_type (Bproject * project, int type)

Sets the baseline type of all the micrographs.

Parameters:
    *project project parameter structure.
    type baseline type.

Returns:
    int 0.

Definition at line 1716 of file mg_ctf.cpp.

  int project_set_coherence_envelope (Bproject * project)

Replaces envelope equations with those based on partial coherence in all micrographs.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    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 1688 of file mg_ctf.cpp.

  int project_set_Cs (Bproject * project, double Cs)

Sets the spherical aberation constant of all the micrographs.

Parameters:
    *project project parameter structure.
    Cs spherical aberation constant.

Returns:
    int 0.

Definition at line 1540 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.

Parameters:
    *project project parameter structure.
    def_avg defocus average.
    def_dev defocus deviation.
    ast_angle astigmatism angle.

Returns:
    int 0.

Definition at line 1425 of file mg_ctf.cpp.

  int project_set_envelope (Bproject * project, int type, double * coeff)

Sets the envelope equations of all the micrographs.

Parameters:
    *project project parameter structure.
    type envelope type.
    *coeff 5 envelope coefficients.

Returns:
    int 0.

Definition at line 1653 of file mg_ctf.cpp.

  int project_set_envelope_type (Bproject * project, int type)

Sets the envelope type of all the micrographs.

Parameters:
    *project project parameter structure.
    type envelope type.

Returns:
    int 0.

Definition at line 1624 of file mg_ctf.cpp.

  int project_set_volts (Bproject * project, double volts)

Sets the acceleration voltage of all the micrographs.

Parameters:
    *project project parameter structure.
    volts acceleration voltage.

Returns:
    int 0.

Definition at line 1510 of file mg_ctf.cpp.

  int project_update_first_zero (Bproject * project)

Updates the first zero from the defocus average for all the micrographs.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

Definition at line 1776 of file mg_ctf.cpp.

Author

Generated automatically by Doxygen for Bsoft from the source code.