| Bsoft 2.0.5 Bernard's software package

Functions | Variables
mg_orient.cpp File Reference

Determines orientation angles and x,y origins of single particle images. More...

`#include "mg_orient.h"`
`#include "mg_processing.h"`
`#include "rwmg.h"`
`#include "mg_particle_select.h"`
`#include "mg_ctf.h"`
`#include "symmetry.h"`
`#include "linked_list.h"`
`#include "rwimg.h"`
`#include "ps_views.h"`
`#include "utilities.h"`
`#include <fstream>`
`#include <sys/stat.h>`
`#include <fcntl.h>`

Go to the source code of this file.

## Functions
int | part_determine_orientation (Bparticle *part, Bimage *proj, Bimage *part_mask, Bimage *prs_mask, Bsymmetry *sym, int bin, double res_lo, double res_hi, double res_polar, int ann_min, int ann_max, double shift_limit, double angle_limit, double edge_radius, int flags, fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D)
double | correlation_coefficient_adjust (double cc, double std)
Bimage * | project_prepare_2D_references (Bproject *project, long first, long number, int bin, int ctf_action, double wiener)
| Prepare reference images from particles. More...
Bimage * | img_prepare_projections (Bstring &filename, Bstring &mask_file, int bin, Bsymmetry *sym, double theta_step, double phi_step, double side_ang)
| Generate projections if a 3D file, otherwise clean projections. More...
Bimage * | img_read_projection (Bstring &proj_file, int multi_file, int proj_num)
int | project_determine_orientations (Bproject *project, Bimage *proj, Bstring &mask_file, int bin, Bsymmetry *sym, int part_select, vector< double > &band, double res_lo, double res_hi, double res_polar, int ann_min, int ann_max, double shift_limit, double angle_limit, double edge_radius, int flags)
| Find the orientation and origin of every image in a project. More...
int | project_determine_origins (Bproject *project, Bimage *proj, int bin, Bsymmetry *sym, int part_select, double res_lo, double res_hi, double shift_limit, int flags)
| Find the origin of every image in a project. More...
double | img_cross_validate (Bimage *p, Bimage *pref, Bimage *prs_mask, fft_plan planf)
| Rotates and shifts a reference image and calculates a cross-validation coefficient. More...

## Variables
int | verbose

## Detailed Description

Determines orientation angles and x,y origins of single particle images.

Author
  Bernard Heymann and David M. Belnap

Date
  Created: 20010403
  Modified: 20190826 (BH)

Definition in file mg_orient.cpp.

## Function Documentation

## ◆ correlation_coefficient_adjust()

double correlation_coefficient_adjust | ( | double | cc,
|  | double | std
| ) |  |

Definition at line 35 of file mg_orient.cpp.

## ◆ img_cross_validate()

double img_cross_validate | ( | Bimage * | p,
|  | Bimage * | pref,
|  | Bimage * | prs_mask,
|  | fft_plan | planf
| ) |  |

Rotates and shifts a reference image and calculates a cross-validation coefficient.

Parameters

  *p | 2D image.
  *pref | reference 2D image.
  *prs_mask | dual mask.
  planf | FFT forward plan.

Returns
  double cross-validation coefficient.

      The reference image is first rotated by the difference in the angles
      between the image and the reference, then shifted to the same origin
      as the image. Both are then Fourier transformed, the negative values in
      the mask used to select reciprocal space areas, and the complex product
      calculated. The sum of the zeroeth pixel then gives the cross-validation
      coefficient.
      The input images must be equal-sized square 2D images.

Definition at line 976 of file mg_orient.cpp.

## ◆ img_prepare_projections()

Bimage* img_prepare_projections | ( | Bstring & | filename,
|  | Bstring & | mask_file,
|  | int | bin,
|  | Bsymmetry * | sym,
|  | double | theta_step,
|  | double | phi_step,
|  | double | side_ang
| ) |  |

Generate projections if a 3D file, otherwise clean projections.

Parameters

  &filename | file containing reference map or projections.
  &mask_file | mask to apply to projections.
  bin | data compression by binning.
  *sym | point group symmetry structure.
  theta_step | angular step size from primary symmetry axis (radians).
  phi_step | angular step size around primary symmetry axis (radians).
  side_ang | angular devaition from eqautor (radians).

Returns
  Bimage* projection images, NULL on error.

      If the input file is a 3D map, a set of projections are generated
      given the point group symmetry.
      Flags:
          FULL_ASU    projections for full asymmetric unit
          MULTI_FILE  projections in multiple files

Definition at line 156 of file mg_orient.cpp.

## ◆ img_read_projection()

Bimage* img_read_projection | ( | Bstring & | proj_file,
|  | int | multi_file,
|  | int | proj_num
| ) |  |

Definition at line 271 of file mg_orient.cpp.

## ◆ part_determine_orientation()

int part_determine_orientation | ( | Bparticle * | part,
|  | Bimage * | proj,
|  | Bimage * | part_mask,
|  | Bimage * | prs_mask,
|  | Bsymmetry * | sym,
|  | int | bin,
|  | double | res_lo,
|  | double | res_hi,
|  | double | res_polar,
|  | int | ann_min,
|  | int | ann_max,
|  | double | shift_limit,
|  | double | angle_limit,
|  | double | edge_radius,
|  | int | flags,
|  | fft_plan | planf_1D,
|  | fft_plan | planb_1D,
|  | fft_plan | planf_2D,
|  | fft_plan | planb_2D
| ) |  |

Definition at line 530 of file mg_orient.cpp.

## ◆ project_determine_orientations()

int project_determine_orientations | ( | Bproject * | project,
|  | Bimage * | proj,
|  | Bstring & | mask_file,
|  | int | bin,
|  | Bsymmetry * | sym,
|  | int | part_select,
|  | vector< double > & | band,
|  | double | res_lo,
|  | double | res_hi,
|  | double | res_polar,
|  | int | ann_min,
|  | int | ann_max,
|  | double | shift_limit,
|  | double | angle_limit,
|  | double | edge_radius,
|  | int | flags
| ) |  |

Find the orientation and origin of every image in a project.

Parameters

  *project | image processing parameter structure.
  *proj | reference projections.
  &mask_file | mask to apply to particles.
  bin | data compression by binning.
  *sym | point group symmetry structure.
  part_select | particle selection for processing.
  *band | array of reciprocal space bands.
  res_lo | low resolution limit (angstrom).
  res_hi | high resolution limit (angstrom).
  res_polar | resolution limit for in-plane angular alignment (angstrom).
  ann_min | minimum annulus (>=0).
  ann_max | maximum annulus (< image radius).
  shift_limit | maximum shift from nominal origin of box.
  angle_limit | maximum rotation from original in-plane rotation angle.
  edge_radius | edge radius to mask background using previous origin.
  flags | option flags.

Returns
  int error code.

      The polar power spectrum (pps) of the reference projection is cross correlated
      with that of the image in order to find the angle of rotation.  The image
      is transformed using this angle and the shift found by cross correlation (cc).
      A  second iterative comparison is done with real space polar images
      to find the angle followed by cross correlation to find the shift.
      How much of this second comparison is done depends on the mode flag:
          mode=0  pps     projection selected only based on pps comparison
          mode=1  scc     several projections selected based on cutoff for pps cc's
          mode=2  ccc     all projections selected
      The angle and the x and y values are stored in the view_angle, and ox and oy
      arrays of the micrograph parameter structure.
      The projections must already be binned.
      Flags:
          MODE        projection matching mode
          APPLY_CTF   apply CTF to projections
          PART_LOG    write log files in log directory

Definition at line 329 of file mg_orient.cpp.

## ◆ project_determine_origins()

int project_determine_origins | ( | Bproject * | project,
|  | Bimage * | proj,
|  | int | bin,
|  | Bsymmetry * | sym,
|  | int | part_select,
|  | double | res_lo,
|  | double | res_hi,
|  | double | shift_limit,
|  | int | flags
| ) |  |

Find the origin of every image in a project.

Parameters

  *project | image processing parameter structure.
  *proj | reference projections.
  bin | data compression by binning.
  sym | point group symmetry structure.
  part_select | particle selection for processing.
  res_lo | low resolution limit (angstrom).
  res_hi | high resolution limit (angstrom).
  shift_limit | maximum shift from nominal origin of box.
  flags | option flags.

Returns
  int error code.

      The input view is used to find the corresponding reference projection.
      This projection is then rotated by the input view angle and cross-correlated
      with the image to find the shift.
      Flags:
          PART_LOG    write log files in log directory

Definition at line 797 of file mg_orient.cpp.

## ◆ project_prepare_2D_references()

Bimage* project_prepare_2D_references | ( | Bproject * | project,
|  | long | first,
|  | long | number,
|  | int | bin,
|  | int | ctf_action,
|  | double | wiener
| ) |  |

Prepare reference images from particles.

Parameters

  project | micrograph project structure.
  first | first particle image to use.
  number | number of particle images to use.
  bin | data compression by binning.
  ctf_action | flag to apply CTF to projections.
  wiener | Wiener factor.

Returns
  Bimage* reference images, NULL on error.

      The particle images are shifted to center their origins.

Definition at line 65 of file mg_orient.cpp.

## Variable Documentation

## ◆ verbose

int verbose