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

Analyzes and manipulates single particle images. More...

#include "mg_processing.h"
#include "mg_particles.h"
#include "mg_particle_select.h"
#include "mg_select.h"
#include "mg_img_proc.h"
#include "mg_ctf.h"
#include "rwimg.h"
#include "matrix_linear.h"
#include "file_util.h"
#include "utilities.h"
#include "timer.h"
#include <sys/stat.h>

Functions

int project_align_particles (Bproject *project, int part_select, double nuavg, double nustd)
 Aligns single particle images based on orientation parameters. More...
 
int project_center_particles (Bproject *project, int part_select, double nuavg, double nustd)
 Centers single particle images based on the parametric center.
More...
 
int project_set_particle_centers (Bproject *project, Bimage *pref, int part_select, double hires, double lores)
 Calculates centers of single particle images by cross-correlation with a reference.
More...
 
long project_find_part_centers_in_mgs (Bproject *project, double hires, double lores, int filter_flag)
 Finds the centers of picked particles within a micrograph. More...
 
long mg_find_part_centers (Bmicrograph *mg, double hires, double lores, int filter_flag)
 Finds the centers of picked particles within a micrograph. More...
 
Bimageproject_find_particle_centers (Bproject *project, int max_iter, int part_select, double hires, double lores)
 Calculates centers of single particle images.
More...
 
long particles_mask (Bmicrograph *mg, Bimage *pmask, Bstring &partpath)
 
long project_mask_particles (Bproject *project, Bimage *pmask, Bstring &partpath)
 Calculates centers of single particle images.
More...
 
long project_compare_particles (Bproject *project, Bproject *projcomp)
 Compares the coordinates of particles between two files.
More...
 
double project_tilt_from_particle_defocus (Bproject *project)
 Finds the tilt axis from refined particle defocus values.
More...
 
long project_set_particle_defocus_from_tilt (Bproject *project, double axis, double tilt)
 Finds the tilt axis from refined particle defocus values.
More...
 
Bimageparticle_correlation_sum (Bparticle *part, Bimage *pref, double hires, FSI_Kernel *kernel, fft_plan planf)
 
Bimageproject_correlation_sum (Bproject *project, Bimage *pref, double hires, FSI_Kernel *kernel)
 Correlates each particle with the CTF applied reference projection and sum the correlations. More...
 
int img_add_aberration_terms (Bimage *psum, Bimage *psec, Bimage *ppart, CTFparam &cp)
 
Bimageparticle_aberration_sum (Bparticle *part, Bimage *pref, double hires, FSI_Kernel *kernel, fft_plan planf)
 
int img_check_contrast (Bimage *psum)
 
Bimageimg_calculate_phase_differences (Bimage *psum)
 
Bimageproject_aberration_phase_difference (Bproject *project, Bimage *pref, double hires, FSI_Kernel *kernel)
 Calculates the aberration phase difference from a set of particles. More...
 

Variables

int verbose
 

Detailed Description

Analyzes and manipulates single particle images.

Author
Bernard Heymann
Date
Created: 20080424
Modified: 20221130

Function Documentation

◆ img_add_aberration_terms()

int img_add_aberration_terms ( Bimage psum,
Bimage psec,
Bimage ppart,
CTFparam cp 
)

◆ img_calculate_phase_differences()

Bimage * img_calculate_phase_differences ( Bimage psum)

◆ img_check_contrast()

int img_check_contrast ( Bimage psum)

◆ mg_find_part_centers()

long mg_find_part_centers ( Bmicrograph mg,
double  hires,
double  lores,
int  filter_flag 
)

Finds the centers of picked particles within a micrograph.

Parameters
*mgmicrograph parameter structure.
hireshigh resolution limit.
loreslow resolution limit.
filter_flagflag to filter extremes in particles.
Returns
long number of particles.
An image processing parameter structure loaded with micrograph
information is used to extract particle images from the micrograph
image using the particle coordinates in the parameter structure.
The extracted particle images are each rotated by PI and the shift
found by cross-correlation between the unrotated and rotated images.
The particle coordinates in the parameter structure are updated with
the shift.

◆ particle_aberration_sum()

Bimage * particle_aberration_sum ( Bparticle part,
Bimage pref,
double  hires,
FSI_Kernel kernel,
fft_plan  planf 
)

◆ particle_correlation_sum()

Bimage * particle_correlation_sum ( Bparticle part,
Bimage pref,
double  hires,
FSI_Kernel kernel,
fft_plan  planf 
)

◆ particles_mask()

long particles_mask ( Bmicrograph mg,
Bimage pmask,
Bstring partpath 
)

◆ project_aberration_phase_difference()

Bimage * project_aberration_phase_difference ( Bproject project,
Bimage pref,
double  hires,
FSI_Kernel kernel 
)

Calculates the aberration phase difference from a set of particles.

Parameters
*projectproject parameter structure.
*prefreference map.
hireshigh resolution limit (angstrom).
*kernelfrequency space interpolation kernel lookup table.
Returns
Bimage* aberration phase differences as a complex image.
Uses the method as described in Zivanov et al (2020).
The return image is complex with the even and odd phase differences
in real and imaginary parts, respectively.

◆ project_align_particles()

int project_align_particles ( Bproject project,
int  part_select,
double  nuavg,
double  nustd 
)

Aligns single particle images based on orientation parameters.

Parameters
*projectmicrograph processing parameter structure.
part_selectselection number from the selection column.
nuavgrescale to new average.
nustdrescale to new standard deviation.
Returns
int 0.
Each selected particle image is rotated and shifted.

◆ project_center_particles()

int project_center_particles ( Bproject project,
int  part_select,
double  nuavg,
double  nustd 
)

Centers single particle images based on the parametric center.

Parameters
*projectmicrograph processing parameter structure.
part_selectselection number from the selection column.
nuavgrescale to new average.
nustdrescale to new standard deviation.
Returns
int 0.
Each particle image is shifted to center the origin.

◆ project_compare_particles()

long project_compare_particles ( Bproject project,
Bproject projcomp 
)

Compares the coordinates of particles between two files.

Parameters
*projectproject parameter structure.
*projcompcomparable project parameter structure.
Returns
long number of common particles.
The coordinates of particles in one parameter file is compared to
that of a reference parameter file.
The two parameter files must have the same field and micrograph ID's.

◆ project_correlation_sum()

Bimage * project_correlation_sum ( Bproject project,
Bimage pref,
double  hires,
FSI_Kernel kernel 
)

Correlates each particle with the CTF applied reference projection and sum the correlations.

Parameters
*projectproject parameter structure.
*prefreference map.
hireshigh resolution limit (angstrom).
*kernelfrequency space interpolation kernel lookup table.
Returns
Bimage* sum of cross-correlations.

◆ project_find_part_centers_in_mgs()

long project_find_part_centers_in_mgs ( Bproject project,
double  hires,
double  lores,
int  filter_flag 
)

Finds the centers of picked particles within a micrograph.

Parameters
*projectproject parameter structure.
hireshigh resolution limit.
loreslow resolution limit.
filter_flagflag to filter extremes in particles.
Returns
int 0.
An image processing parameter structure loaded with micrograph
information is used to extract particle images from the micrograph
image using the particle coordinates in the parameter structure.
The extracted particle images are each rotated by PI and the shift
found by cross-correlation between the unrotated and rotated images.
The particle coordinates in the parameter structure are updated with
the shift.

◆ project_find_particle_centers()

Bimage * project_find_particle_centers ( Bproject project,
int  max_iter,
int  part_select,
double  hires,
double  lores 
)

Calculates centers of single particle images.

Parameters
*projectimage processing parameter structure.
max_itermaximum number of iterations.
part_selectselection number from the selection column.
hireshigh resolution limit.
loreslow resolution limit.
Returns
Bimage* final image composite reference.
A composite image is generated from the selected particles and radially
symmetrized. Each image shift is then determined by cross correlation.
This is repeated until the chnage in image shifts decreases below
a threshold.

◆ project_mask_particles()

long project_mask_particles ( Bproject project,
Bimage pmask,
Bstring partpath 
)

Calculates centers of single particle images.

Parameters
*projectimage processing parameter structure.
*pmask3D volume mask to be projected.
&partpathnew path to particle files.
Returns
long number of particles masked.
A 3D mask is projected into each particle view and the particle image masked.

◆ project_set_particle_centers()

int project_set_particle_centers ( Bproject project,
Bimage pref,
int  part_select,
double  hires,
double  lores 
)

Calculates centers of single particle images by cross-correlation with a reference.

Parameters
*projectmicrograph processing parameter structure.
*prefreference image.
part_selectselection number from the selection column.
hireshigh resolution limit.
loreslow resolution limit.
Returns
int 0.
Each particle image shift is determined by cross correlation with
the reference image.
The reference must be the same size as the particle images.

◆ project_set_particle_defocus_from_tilt()

long project_set_particle_defocus_from_tilt ( Bproject project,
double  axis,
double  tilt 
)

Finds the tilt axis from refined particle defocus values.

Parameters
*projectproject parameter structure.
axistilt axis angle (radians).
tilttilt angle (radians).
Returns
long number of selected particles.

◆ project_tilt_from_particle_defocus()

double project_tilt_from_particle_defocus ( Bproject project)

Finds the tilt axis from refined particle defocus values.

Parameters
*projectproject parameter structure.
Returns
double average tilt axis.

Variable Documentation

◆ verbose

int verbose
extern