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

Functions to process helical data. More...

#include "Bimage.h"
#include "mg_processing.h"
#include "mg_img_proc.h"
#include "mg_helix.h"
#include "mg_extract.h"
#include "spline.h"
#include "linked_list.h"
#include "Complex.h"
#include "utilities.h"
#include "timer.h"

Functions

double * filament_profile (Bfilnode *fnode, Bimage *p, long img_num, int id, double width, long &n)
 Calculates a filament profile and node profile. More...
 
double nodes_center (Bfilnode *fnode, Bimage *p, long img_num, int width)
 
double filaments_center (Bfilament *fillist, Bimage *p, long img_num, int filament_width)
 Centers filament nodes in a micrograph. More...
 
double project_center_filaments (Bproject *project, int filament_width)
 Centers filament nodes in all micrographs in a project. More...
 
int project_filament_powerspectrum (Bproject *project, int pad, int rotated, Bstring &path)
 Calculates and average power spectrum from filaments. More...
 
Bimageproject_filament_density (Bproject *project, int filament_width)
 Extracts filament images from micrographs defined in a project and estimates their density per length. More...
 
int mg_generate_layer_lines (Bmicrograph *mg, int rad_lim)
 Generates layer lines given the unit cell vectors. More...
 
int img_mask_layer_lines (Bimage *p, Blayerline *layer_line, float helix_axis, float width)
 Masks the image using the list of layer lines. More...
 
double * img_extract_layer_line (Bimage *p, Blayerline *line, float helix_axis, int length)
 Extracts one layer line from an image. More...
 
int mg_extract_show_layer_lines (Bmicrograph *mg, int length, int show)
 Extracts and prints layer lines from an image with corresponding Bessel functions. More...
 

Variables

int verbose
 

Detailed Description

Functions to process helical data.

Author
Bernard Heymann
Date
Created: 20061110
Modified: 20170623

Function Documentation

◆ filament_profile()

double * filament_profile ( Bfilnode fnode,
Bimage p,
long  img_num,
int  id,
double  width,
long &  n 
)

Calculates a filament profile and node profile.

Parameters
*fnodenode list.
*pimage with filament.
img_numsub-image number.
ididentifier of selected node.
widthwidth of box around filament.
&nnumber of elements in the profile.
Returns
double* two profile arrays, each length n.
A filament image is extracted from the micrograph along a spline through
the nodes. The overall profile and the profile around a specified node
are calculated and returned in a single array.
It only works for 2D images.

◆ filaments_center()

double filaments_center ( Bfilament fillist,
Bimage p,
long  img_num,
int  filament_width 
)

Centers filament nodes in a micrograph.

Parameters
*fillistlist of filaments.
*pimage with filament.
img_numsub-image number.
filament_widthwidth of box around filament.
Returns
double average correlation coefficient.
The profile for each node is calculated and centered by cross-correlation
with the mirrored profile.

◆ img_extract_layer_line()

double * img_extract_layer_line ( Bimage p,
Blayerline line,
float  helix_axis,
int  length 
)

Extracts one layer line from an image.

Parameters
*ppower spectrum.
*linelayer line.
helix_axishelix axis angle.
lengthlength of line.
Returns
double* array with line values.

◆ img_mask_layer_lines()

int img_mask_layer_lines ( Bimage p,
Blayerline layer_line,
float  helix_axis,
float  width 
)

Masks the image using the list of layer lines.

Parameters
*pcomplex image.
*layer_linelayer line list.
helix_axishelix axis angle.
widthwidth of mask for a line.
Returns
int number of lines or error code.

◆ mg_extract_show_layer_lines()

int mg_extract_show_layer_lines ( Bmicrograph mg,
int  length,
int  show 
)

Extracts and prints layer lines from an image with corresponding Bessel functions.

Parameters
*mgmicrograph.
lengthlength of line.
showshow: 1=extracted layer lines, 2=Bessel functions, 3=both
Returns
int 0.

◆ mg_generate_layer_lines()

int mg_generate_layer_lines ( Bmicrograph mg,
int  rad_lim 
)

Generates layer lines given the unit cell vectors.

Parameters
*mgmicrograph.
rad_limlayer line radial limit.
Returns
int number of layer lines generated, <0 on error.
The structure factor location is given by:
    x = uh + vk
where u and v are the unit cell vectors,
and h and k are the associated Miller indices.

◆ nodes_center()

double nodes_center ( Bfilnode fnode,
Bimage p,
long  img_num,
int  width 
)

◆ project_center_filaments()

double project_center_filaments ( Bproject project,
int  filament_width 
)

Centers filament nodes in all micrographs in a project.

Parameters
*projectproject object.
filament_widthwidth of box around filament.
Returns
double average correlation coefficient.
The profile for each node is calculated and centered by cross-correlation
with the mirrored profile.

◆ project_filament_density()

Bimage * project_filament_density ( Bproject project,
int  filament_width 
)

Extracts filament images from micrographs defined in a project and estimates their density per length.

Parameters
*projectmicrograph project.
filament_widthextracted filament width.
Returns
Bimage* image with all densities.

◆ project_filament_powerspectrum()

int project_filament_powerspectrum ( Bproject project,
int  pad,
int  rotated,
Bstring path 
)

Calculates and average power spectrum from filaments.

Parameters
*projectproject parameter structure.
padadditional padding before transformation.
rotatedflag to indicate if particles are already rotated.
&pathpath to write power spectra.
Returns
int 0.
Particles derived from picked filaments are extracted and transformed
to orient the helical axis along the x-axis. These images are then
Fourier transformed and their power spectra averaged.
One average per micrograph is calculated.
Requirements: The filaments must be picked and converted to particle locations.

Variable Documentation

◆ verbose

int verbose
extern