Bsoft 2.1.4
Bernard's software package
mg_refine.cpp File Reference

Reciprocal space refinement of orientation parameters of particle images. More...

#include "mg_processing.h"
#include "mg_refine.h"
#include "rwmg.h"
#include "mg_ctf.h"
#include "rwimg.h"
#include "Complex.h"
#include "Matrix3.h"
#include "linked_list.h"
#include "random_numbers.h"
#include "utilities.h"
#include <sys/stat.h>
#include <fcntl.h>

Functions

long part_refine_orientation (Bparticle *part, Bstring &partfile, Bimage *pref, Bimage *pmask, Bsymmetry sym, int max_iter, double alpha_step, double accuracy, double shift_step, double shift_accuracy, double hi_res, double lo_res, int fom_type, vector< double > weight, double edge_radius, CTFparam *em_ctf, double def_std, double shift_std, double view_std, double max_angle, double max_mag, int flags, FSI_Kernel *kernel, fft_plan planf)
 Refine the orientation and origin of one particle with respect to a reference map. More...
 
double img_refine_monte (Bimage *p, Bimage *pref, double hi_res, double lo_res, int flags, int max_iter, int fom_type, vector< double > &weight, CTFparam *em_ctf, double def_std, double shift_std, double view_std, double max_angle, double max_mag, FSI_Kernel *kernel, long &number)
 Refine the orientation and origin of one particle with respect to a reference map. More...
 
double img_refine_grid (Bimage *p, Bimage *pref, double hi_res, double lo_res, int flags, double alpha_step, double accuracy, double shift_step, double shift_accuracy, double max_mag, int fom_type, vector< double > &weight, CTFparam *em_ctf, double def_std, FSI_Kernel *kernel, long &number)
 Refine the orientation and origin of one particle with respect to a reference map. More...
 
long mg_refine_orientations (Bproject *project, Bstring &reffile, Bstring &maskfile, Bstring &sym_string, int part_select, int max_iter, double alpha_step, double accuracy, double shift_step, double shift_accuracy, int fom_type, vector< double > weight, double hi_res, double lo_res, int kernel_width, int kernel_power, double edge_radius, double def_std, double shift_std, double view_std, double max_angle, double max_mag, int flags)
 Refine the orientation and origin with respect to a reference map. More...
 
long project_refine_orientations (Bproject *project, Bstring &reffile, Bstring &maskfile, Bstring &sym_string, int part_select, int max_iter, double alpha_step, double accuracy, double shift_step, double shift_accuracy, int fom_type, vector< double > weight, double hi_res, double lo_res, int kernel_width, int kernel_power, double edge_radius, double def_std, double shift_std, double view_std, double max_angle, double max_mag, int flags)
 
double img_recip_space_fom (Bimage *p, Bimage *pref, double hi_res, double lo_res, int fom_type, vector< double > &weight, int flags, CTFparam *em_ctf)
 
double img_fit_in_recip_space_monte (Bimage *p, Bimage *pref, double hi_res, double lo_res, int flags, int max_iter, int fom_type, vector< double > &weight, CTFparam *em_ctf, double def_std, double shift_std, FSI_Kernel *kernel, long &number)
 
double img_fit_in_recip_space_grid (Bimage *p, Bimage *pref, double hi_res, double lo_res, int flags, double step, double accuracy, int fom_type, vector< double > &weight, CTFparam *em_ctf, double def_std, FSI_Kernel *kernel, long &number)
 

Variables

int verbose
 

Detailed Description

Reciprocal space refinement of orientation parameters of particle images.

Author
Bernard Heymann
Date
Created: 20070115
Modified: 20220813

Function Documentation

◆ img_fit_in_recip_space_grid()

double img_fit_in_recip_space_grid ( Bimage p,
Bimage pref,
double  hi_res,
double  lo_res,
int  flags,
double  step,
double  accuracy,
int  fom_type,
vector< double > &  weight,
CTFparam em_ctf,
double  def_std,
FSI_Kernel kernel,
long &  number 
)

◆ img_fit_in_recip_space_monte()

double img_fit_in_recip_space_monte ( Bimage p,
Bimage pref,
double  hi_res,
double  lo_res,
int  flags,
int  max_iter,
int  fom_type,
vector< double > &  weight,
CTFparam em_ctf,
double  def_std,
double  shift_std,
FSI_Kernel kernel,
long &  number 
)

◆ img_recip_space_fom()

double img_recip_space_fom ( Bimage p,
Bimage pref,
double  hi_res,
double  lo_res,
int  fom_type,
vector< double > &  weight,
int  flags,
CTFparam em_ctf 
)

◆ img_refine_grid()

double img_refine_grid ( Bimage p,
Bimage pref,
double  hi_res,
double  lo_res,
int  flags,
double  alpha_step,
double  accuracy,
double  shift_step,
double  shift_accuracy,
double  max_mag,
int  fom_type,
vector< double > &  weight,
CTFparam em_ctf,
double  def_std,
FSI_Kernel kernel,
long &  number 
)

Refine the orientation and origin of one particle with respect to a reference map.

Parameters
*pparticle image.
*prefreference map.
hi_reshigh resolution limit (angstrom).
lo_reslow resolution limit (angstrom).
flagsAPPLY_CTF, INVERT.
alpha_stepgrid search angular step size.
accuracygrid search accuracy.
shift_stepgrid shift size.
shift_accuracygrid shift accuracy.
max_magmaximum magnification adjustment.
fom_typetype of resolution measure: 0=FRC, 1=DPR
weight1D reciprocal space weight curve.
*em_ctfCTF parameters (if NULL, not used).
def_stddefocus step size.
*kernelinterpolation kernel.
&numbernumber of comparisons.
Returns
double best figure-of-merit.
The orientation and origin are refined using a grid search
with selection based on the FSC or DPR.
The best result is returned in the orientation parameters of the image structure.
The FOM in the image structure is the first FOM determined, while the best
FOM is returned.

◆ img_refine_monte()

double img_refine_monte ( Bimage p,
Bimage pref,
double  hi_res,
double  lo_res,
int  flags,
int  max_iter,
int  fom_type,
vector< double > &  weight,
CTFparam em_ctf,
double  def_std,
double  shift_std,
double  view_std,
double  max_angle,
double  max_mag,
FSI_Kernel kernel,
long &  number 
)

Refine the orientation and origin of one particle with respect to a reference map.

Parameters
*pparticle image.
*prefreference map.
hi_reshigh resolution limit (angstrom).
lo_reslow resolution limit (angstrom).
flagsAPPLY_CTF, INVERT.
max_itermaximum number of refining iterations.
fom_typetype of resolution measure: 0=FRC, 1=DPR
weight1D reciprocal space weight curve.
*em_ctfCTF parameters (if NULL, not used).
def_stdrandom defocus standard deviation
shift_stdrandom origin shift standard deviation.
view_stdrandom view shift standard deviation.
max_anglemaximum random rotation angle adjustment.
max_magmaximum magnification adjustment.
*kernelinterpolation kernel.
&numbernumber of comparisons.
Returns
double best figure-of-merit.
The orientation and origin are iteratively modified in small random steps,
with selection based on the Fourier shell correlation.
The best result is returned in the orientation parameters of the image structure.
The FOM in the image structure is the first FOM determined, while the best
FOM is returned.

◆ mg_refine_orientations()

long mg_refine_orientations ( Bproject project,
Bstring reffile,
Bstring maskfile,
Bstring sym_string,
int  part_select,
int  max_iter,
double  alpha_step,
double  accuracy,
double  shift_step,
double  shift_accuracy,
int  fom_type,
vector< double >  weight,
double  hi_res,
double  lo_res,
int  kernel_width,
int  kernel_power,
double  edge_radius,
double  def_std,
double  shift_std,
double  view_std,
double  max_angle,
double  max_mag,
int  flags 
)

Refine the orientation and origin with respect to a reference map.

Parameters
*projectimage processing parameter structure.
&reffilefile containing reference map.
&maskfilefile containing a real space mask (can be empty).
&sym_stringpoint group symmetry designator.
part_selectparticle selection for processing.
max_iterMonte Carlo maximum number of refining iterations.
alpha_stepgrid search angular step size.
accuracygrid search accuracy.
shift_stepgrid shift size.
shift_accuracygrid shift accuracy.
fom_typetype of resolution measure: 0=FRC, 1=DPR
weight1D reciprocal space weight curve.
hi_reshigh resolution limit (angstrom).
lo_reslow resolution limit (angstrom).
kernel_widthinterpolation kernel width.
kernel_powerinterpolation kernel power.
edge_radiusedge radius to mask background using previous origin.
def_stdrandom defocus standard deviation
shift_stdrandom origin shift standard deviation.
view_stdrandom view shift standard deviation.
max_anglemaximum random rotation angle adjustment.
max_magmaximum magnification adjustment.
flagsoption flags.
Returns
long number of comparisons, <0 on error.
The orientation, origin, magnitude and defocus are refined for each particle.
The default method uses a grid search around the existing view and origin.
Specifying the maximum number of iterations switches the algorithm to a
Monte Carlo search for the best parameters.
The FOM is either based on the FSC or the DPR.

◆ part_refine_orientation()

long part_refine_orientation ( Bparticle part,
Bstring partfile,
Bimage pref,
Bimage pmask,
Bsymmetry  sym,
int  max_iter,
double  alpha_step,
double  accuracy,
double  shift_step,
double  shift_accuracy,
double  hi_res,
double  lo_res,
int  fom_type,
vector< double >  weight,
double  edge_radius,
CTFparam em_ctf,
double  def_std,
double  shift_std,
double  view_std,
double  max_angle,
double  max_mag,
int  flags,
FSI_Kernel kernel,
fft_plan  planf 
)

Refine the orientation and origin of one particle with respect to a reference map.

Parameters
*partparticle.
&partfileparticle filename.
*prefreference map.
*pmaskmask.
*symsymmetry structure.
max_itermaximum number of refining iterations.
alpha_stepgrid search angular step size.
accuracygrid search accuracy.
shift_stepgrid shift size.
shift_accuracygrid shift accuracy.
hi_reshigh resolution limit (angstrom).
lo_reslow resolution limit (angstrom).
fom_typetype of resolution measure: 0=FRC, 1=DPR
weight1D reciprocal space weight curve.
edge_radiusedge radius to mask background using previous origin.
*em_ctfCTF parameters (if NULL, not used).
def_stdrandom defocus standard deviation
shift_stdrandom origin shift standard deviation.
view_stdrandom view shift standard deviation.
max_anglemaximum random rotation angle adjustment.
max_magmaximum magnification adjustment.
flagsoption flags.
*kernelinterpolation kernel.
planfFFT forward plan for 2D images.
Returns
long number of comparisons.
The orientation and origin are iteratively modified in small random steps,
with selection based on the Fourier shell correlation.

◆ project_refine_orientations()

long project_refine_orientations ( Bproject project,
Bstring reffile,
Bstring maskfile,
Bstring sym_string,
int  part_select,
int  max_iter,
double  alpha_step,
double  accuracy,
double  shift_step,
double  shift_accuracy,
int  fom_type,
vector< double >  weight,
double  hi_res,
double  lo_res,
int  kernel_width,
int  kernel_power,
double  edge_radius,
double  def_std,
double  shift_std,
double  view_std,
double  max_angle,
double  max_mag,
int  flags 
)

Variable Documentation

◆ verbose

int verbose
extern