Bsoft  2.1.0
Bernard's software package
mg_processing.cpp File Reference

Functions for micrograph processing. More...

#include "mg_processing.h"
#include "mg_select.h"
#include "mg_tags.h"
#include "qsort_functions.h"
#include "linked_list.h"
#include "math_util.h"
#include "random_numbers.h"
#include "utilities.h"
#include <fstream>

Go to the source code of this file.

Functions

Bproject * project_init ()
 Initializes a micrograph processing project parameter structure. More...
 
Bproject * project_create (int nmg, int nrec)
 Creates a micrograph processing project parameter structure. More...
 
int project_equal_mg_part_files (Bproject *project)
 Sets micrograph and particle files to be the same. More...
 
Bfield * field_add (Bfield **field, Bstring &field_id)
 Adds a field-of-view parameter structure to a linked list. More...
 
Bmicrograph * micrograph_add (Bmicrograph **mg, Bstring &mg_id)
 Adds a micrograph parameter structure to a linked list. More...
 
Bframe * frame_add (Bframe **frame, int pid)
 Adds a movie frame parameter structure to a linked list. More...
 
Bparticle * particle_add (Bparticle **part, int pid)
 Adds a particle parameter structure to a linked list. More...
 
int mg_part_links (Bmicrograph *mg)
 Sets the links from particles to micrographs. More...
 
int rec_part_links (Breconstruction *rec)
 Sets the links from particles to reconstructions. More...
 
Bparticle * part_find_first (Bproject *project)
 Finds the first particle in a project. More...
 
Bfilament * filament_add (Bfilament **fil, int pid)
 Adds a filament parameter structure to a linked list. More...
 
Bfilnode * filament_node_add (Bfilnode **fnode, int pid)
 Adds a filament node parameter structure to a linked list. More...
 
double filament_length (Bfilament *fil)
 Calculates the length of a filament. More...
 
Breconstruction * reconstruction_add (Breconstruction **rec, Bstring &rec_id)
 Adds a reconstruction parameter structure to a linked list. More...
 
int project_kill (Bproject *project)
 Frees a whole project. More...
 
int field_kill (Bfield *field)
 Frees a whole field-of-view structure. More...
 
int micrograph_kill (Bmicrograph *mg)
 Frees a whole micrograph parameter structure. More...
 
int particle_kill (Bparticle *part)
 Frees a list of particles. More...
 
int filament_kill (Bfilament *fil)
 Frees a list of filaments. More...
 
int reconstruction_kill (Breconstruction *rec)
 Frees a whole reconstruction parameter structure. More...
 
Bparticle * particle_copy (Bparticle **partlist, Bparticle *part)
 Adds one particle onto a list of particle parameters. More...
 
Bparticle * particle_copy (Bparticle *partlist)
 Copies a list of particle parameters to a new list. More...
 
Bbadarea * particle_bad_copy (Bbadarea *badlist)
 
Bfilament * filament_copy (Bfilament *fillist)
 
Bstrucfac * structurefactor_copy (Bstrucfac *sflist)
 
Blayerline * layerline_copy (Blayerline *layerlist)
 
Bmicrograph * micrograph_copy (Bmicrograph *mg)
 Copies a micrograph. More...
 
int project_update (Bproject *project, Bproject *proj_new, int fom_index)
 Updates an existing project with new information. More...
 
int micrograph_update (Bmicrograph *mg, Bmicrograph *nu_mg, int fom_index, int flags)
 Updates an existing micrograph with new information. More...
 
int reconstruction_update (Breconstruction *rec, Breconstruction *nu_rec, int fom_index, int flags)
 Updates an existing reconstruction with new information. More...
 
int particle_update (Bparticle *part, Bparticle *nu_part)
 Updates one existing particle with new information. More...
 
int particle_update (Bparticle **pnt_part, Bparticle *nu_part, int fom_index)
 Updates an existing particle list with new information. More...
 
int project_merge_part_parameters (Bproject *project, Bproject *partproject)
 Puts particle parameters from one project into another. More...
 
long project_set_part_links (Bproject *project)
 Sets the links from particles back to the micrographs and reconstructions. More...
 
long micrograph_set_part_links (Bmicrograph *mg)
 Sets the links from particles back to the micrograph. More...
 
long reconstruction_set_part_links (Breconstruction *rec)
 Sets the links from particles back to the reconstruction. More...
 
long project_divide (Bproject *project, long n)
 Divides a project into a number of micrograph subsets. More...
 
Bmicrograph ** project_micrograph_array (Bproject *project, long &nmg)
 Sets up an array of selected micrograph pointers. More...
 
Bparticle ** project_mg_particle_array (Bproject *project, int part_select, long &npart)
 Sets up an array of selected particle pointers. More...
 
Bparticle ** project_rec_particle_array (Bproject *project, int part_select, long &npart)
 Sets up an array of selected particle pointers. More...
 
Bparticle ** particle_array (Bparticle *partlist, int part_select, long &npart)
 Sets up an array of selected particle pointers. More...
 
int project_revert_filenames (Bproject *project, Bproject *project_old, int flag)
 Reverts file names to what it was in an old project. More...
 
int project_set_field_id (Bproject *project, int nseries, Bstring &field_id)
 Sets the field id's according to a regular series. More...
 
long project_show_hierarchy (Bproject *project)
 Shows the project hierarchy. More...
 
long project_show_class_averages (Bproject *project)
 Shows the class averages in a project. More...
 
long project_dump (Bproject *project, Bstring &filename)
 Dumps particle info in the project hierarchy. More...
 
Bstring path_update (Bstring &filename, Bstring &path)
 
int project_set_micrograph_path (Bproject *project, Bstring &path)
 Sets the path to micrograph files for all the micrographs. More...
 
int project_set_frame_path (Bproject *project, Bstring &path)
 Sets the path to micrograph frames files for all the micrographs. More...
 
int project_set_powerspectrum_path (Bproject *project, Bstring &path)
 Sets the path to powerspectrum files for all the micrographs. More...
 
int project_set_particle_path (Bproject *project, Bstring &path)
 Sets the path to particle files for all the micrographs. More...
 
int project_set_filament_path (Bproject *project, Bstring &path)
 Sets the path to filament files for all the micrographs. More...
 
int project_set_magnification (Bproject *project, double mag)
 Sets the magnification for all the micrographs. More...
 
int project_set_scan_sampling (Bproject *project, double sampling)
 Sets the scan sampling for all the micrographs. More...
 
int project_set_mg_pixel_size (Bproject *project, Vector3< double > pixel_size)
 Sets the pixel size for all the micrographs. More...
 
int project_set_rec_voxel_size (Bproject *project, Vector3< double > pixel_size)
 Sets the pixel size for all the reconstructions. More...
 
int project_set_part_pixel_size (Bproject *project, Vector3< double > pixel_size)
 Sets the pixel size for all the particles. More...
 
int project_set_tilt (Bproject *project, double tilt_axis, double tilt_angle)
 Sets the tilt parameters for all the micrographs. More...
 
int project_set_dose (Bproject *project, double dose)
 Sets the electron dose of all the micrographs. More...
 
int project_set_micrograph_origins (Bproject *project, Vector3< double > origin)
 Sets micrograph origins to the given origin. More...
 
int project_add_origins_to_coords (Bproject *project)
 Adds the particle origins to the micrograph coordinates. More...
 
int project_flip_origins (Bproject *project, int flip)
 Flip origin coordinates. More...
 
long project_renumber_particles (Bproject *project)
 Renumbers particles. More...
 
int project_set_particle_box_size (Bproject *project, Vector3< long > box_size)
 Sets particle box size to the given value. More...
 
int project_set_particle_box_size (Bproject *project, long box_size)
 Sets particle box size to the given value. More...
 
int project_set_particle_origins (Bproject *project, Vector3< double > origin)
 Sets particle origins to given values. More...
 
int project_set_particle_asu_views (Bproject *project, Bstring &symmetry_asu)
 Sets particle views within the asymmetric unit. More...
 
int project_set_particle_asu_views (Bproject *project, Bsymmetry *sym)
 
int project_rotate_particle_views (Bproject *project, View view)
 Rotates particle views with respect to a reference view. More...
 
int project_apply_map_magnifications (Bproject *project, int mag_num, float *mag)
 Change particle pixel sizes for particles based on map magnifications. More...
 
long project_reset (Bproject *project, Bstring &reset)
 Reset a particle parameter from its micrograph. More...
 
View * views_from_project (Bproject *project, int selection)
 Retrieves the particle views from a project. More...
 
Bstring get_fom_tag (FOMType fom_type)
 Returns the tag associated with a particular FOM. More...
 
int get_fom_tag (FOMType fom_type, char *tag)
 Returns the tag associated with a particular FOM. More...
 

Variables

int verbose
 

Detailed Description

Functions for micrograph processing.

Author
Bernard Heymann
Date
Created: 20010206
Modified: 20200714

Definition in file mg_processing.cpp.

Function Documentation

◆ field_add()

Bfield* field_add ( Bfield **  field,
Bstring &  field_id 
)

Adds a field-of-view parameter structure to a linked list.

Parameters
**fieldpointer to any field-of-view in the list.
field_idfield identifier.
Returns
Bfield* new field-of-view.
The function allocates memory for a new field-of-view structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 121 of file mg_processing.cpp.

◆ field_kill()

int field_kill ( Bfield *  field)

Frees a whole field-of-view structure.

Frees all the structures down the hierarchy.
Parameters
*fieldfield-of-view parameter structure.
Returns
int 0.

Definition at line 466 of file mg_processing.cpp.

◆ filament_add()

Bfilament* filament_add ( Bfilament **  fil,
int  pid 
)

Adds a filament parameter structure to a linked list.

Parameters
**filpointer to any filament in the list.
pidfilament number in file (starts at 1).
Returns
Bfilament* new filament.
The function allocates memory for a new filament structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 319 of file mg_processing.cpp.

◆ filament_copy()

Bfilament* filament_copy ( Bfilament *  fillist)

Definition at line 669 of file mg_processing.cpp.

◆ filament_kill()

int filament_kill ( Bfilament *  fil)

Frees a list of filaments.

Frees all the structures down the hierarchy.
Parameters
*filfilament parameter structure.
Returns
int 0.

Definition at line 552 of file mg_processing.cpp.

◆ filament_length()

double filament_length ( Bfilament *  fil)

Calculates the length of a filament.

Parameters
*filpointer to a filament.
Returns
double length in coordinate units.
The length is defined as the sum of the link lengths connecting the nodes.

Definition at line 375 of file mg_processing.cpp.

◆ filament_node_add()

Bfilnode* filament_node_add ( Bfilnode **  fnode,
int  pid 
)

Adds a filament node parameter structure to a linked list.

Parameters
**fnodepointer to any filament node in the list.
pidfilament node number in file (starts at 1).
Returns
Bfilnode* new filament node.
The function allocates memory for a new filament node structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 349 of file mg_processing.cpp.

◆ frame_add()

Bframe* frame_add ( Bframe **  frame,
int  pid 
)

Adds a movie frame parameter structure to a linked list.

Parameters
**framepointer to any frame in the list.
pidparticle number in file (starts at 1).
Returns
Bframe* new frame.
The function allocates memory for a new frame structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 189 of file mg_processing.cpp.

◆ get_fom_tag() [1/2]

Bstring get_fom_tag ( FOMType  fom_type)

Returns the tag associated with a particular FOM.

Parameters
fom_typetype of FOM.
Returns
Bstring FOM tag.

Definition at line 2612 of file mg_processing.cpp.

◆ get_fom_tag() [2/2]

int get_fom_tag ( FOMType  fom_type,
char *  tag 
)

Returns the tag associated with a particular FOM.

Parameters
fom_typetype of FOM.
*tagFOM tag.
Returns
int string length of the new comment.

Definition at line 2651 of file mg_processing.cpp.

◆ layerline_copy()

Blayerline* layerline_copy ( Blayerline *  layerlist)

Definition at line 710 of file mg_processing.cpp.

◆ mg_part_links()

int mg_part_links ( Bmicrograph *  mg)

Sets the links from particles to micrographs.

Parameters
*mgpointer to micrograph.
Returns
int 0.

Definition at line 249 of file mg_processing.cpp.

◆ micrograph_add()

Bmicrograph* micrograph_add ( Bmicrograph **  mg,
Bstring &  mg_id 
)

Adds a micrograph parameter structure to a linked list.

Parameters
**mgpointer to any micrograph in the list.
mg_idmicrograph identifier.
Returns
Bmicrograph* new micrograph.
The function allocates memory for a new micrograph structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 154 of file mg_processing.cpp.

◆ micrograph_copy()

Bmicrograph* micrograph_copy ( Bmicrograph *  mg)

Copies a micrograph.

Parameters
*mgmicrograph structure to be copied.
Returns
Bmicrograph* new micrograph.

Definition at line 735 of file mg_processing.cpp.

◆ micrograph_kill()

int micrograph_kill ( Bmicrograph *  mg)

Frees a whole micrograph parameter structure.

Frees all the structures down the hierarchy.
Parameters
*mgmicrograph parameter structure.
Returns
int 0.

Definition at line 493 of file mg_processing.cpp.

◆ micrograph_set_part_links()

long micrograph_set_part_links ( Bmicrograph *  mg)

Sets the links from particles back to the micrograph.

Parameters
*mgmicrograph parameter structure.
Returns
long number of particles.

Definition at line 1170 of file mg_processing.cpp.

◆ micrograph_update()

int micrograph_update ( Bmicrograph *  mg,
Bmicrograph *  nu_mg,
int  fom_index,
int  flags 
)

Updates an existing micrograph with new information.

Parameters
*mgmicrograph structure to be updated.
*nu_mgmicrograph structure with new information.
fom_indexindex of FOM to select on.
flagsflags indicating which parts to update.
Returns
int 0.
The new information is encoded as a micrograph structure.
All fields are updated if the new fields contain non-default data.
Defaults are defined here as zero-length strings or zeroes.
The particles in the original micrograph are matched by ID with 
those in the new micrograph and updated, with any new particles 
added from the new micrograph.
The bad area and marker coordinates are replaced if they exist 
in the new structure.
The new micrograph structure is not modified, except for deletion 
of bad areas and markers.

Flags:
    1   particles
    2   bad areas
    4   filaments
    8   structure factors
    16  layer lines
    32  markers

Definition at line 878 of file mg_processing.cpp.

◆ part_find_first()

Bparticle* part_find_first ( Bproject *  project)

Finds the first particle in a project.

Parameters
*projectpointer to project.
Returns
Bparticle* first particle with a filename.
The function searches for the first particle with a filename.

Definition at line 283 of file mg_processing.cpp.

◆ particle_add()

Bparticle* particle_add ( Bparticle **  part,
int  pid 
)

Adds a particle parameter structure to a linked list.

Parameters
**partpointer to any particle in the list.
pidparticle number in file (starts at 1).
Returns
Bparticle* new particle.
The function allocates memory for a new particle structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 221 of file mg_processing.cpp.

◆ particle_array()

Bparticle** particle_array ( Bparticle *  partlist,
int  part_select,
long &  npart 
)

Sets up an array of selected particle pointers.

Parameters
*partlistparticle linked list.
part_selectparticle selection (-1 if none).
&npartarray length (modified).
Returns
Bparticle** particle pointer array.
FOM's of non-selected particles are zeroed.

Definition at line 1360 of file mg_processing.cpp.

◆ particle_bad_copy()

Bbadarea* particle_bad_copy ( Bbadarea *  badlist)

Definition at line 654 of file mg_processing.cpp.

◆ particle_copy() [1/2]

Bparticle* particle_copy ( Bparticle **  partlist,
Bparticle *  part 
)

Adds one particle onto a list of particle parameters.

Parameters
**partlistdestination particle list.
*partparticle.
Returns
Bparticle* new particle.

Definition at line 614 of file mg_processing.cpp.

◆ particle_copy() [2/2]

Bparticle* particle_copy ( Bparticle *  partlist)

Copies a list of particle parameters to a new list.

Parameters
*partlistsource particle list.
Returns
Bparticle* new list.

Definition at line 643 of file mg_processing.cpp.

◆ particle_kill()

int particle_kill ( Bparticle *  part)

Frees a list of particles.

Frees all the structures down the hierarchy.
Parameters
*partparticle parameter structure.
Returns
int 0.

Definition at line 528 of file mg_processing.cpp.

◆ particle_update() [1/2]

int particle_update ( Bparticle **  pnt_part,
Bparticle *  nu_part,
int  fom_index 
)

Updates an existing particle list with new information.

Parameters
**pnt_partparticle structure list to be updated.
*nu_partparticle structure list with new information.
fom_indexindex of FOM to select on.
Returns
int 0.
The new information is encoded as a particle structure.
All fields are updated if the new fields contain non-default data.
Defaults are defined here as zeroes.
The new particle structure is not modified.

Definition at line 1073 of file mg_processing.cpp.

◆ particle_update() [2/2]

int particle_update ( Bparticle *  part,
Bparticle *  nu_part 
)

Updates one existing particle with new information.

Parameters
*partparticle structure to be updated.
*nu_partparticle structure with new information.
Returns
int 0.
The new information is encoded as a particle structure.
All fields are updated if the new fields contain non-default data.
Defaults are defined here as zeroes.
The new particle structure is not modified.

Definition at line 1026 of file mg_processing.cpp.

◆ path_update()

Bstring path_update ( Bstring &  filename,
Bstring &  path 
)

Definition at line 1740 of file mg_processing.cpp.

◆ project_add_origins_to_coords()

int project_add_origins_to_coords ( Bproject *  project)

Adds the particle origins to the micrograph coordinates.

Parameters
*projectproject parameter structure.
Returns
int 0.
The coordinates of particles from a micrograph and particle origins
in an image processing parameter structure are added. The old
micrograph coordinates are overwritten with the results.
Requirement: The box radius for picked particles must be specified.

Definition at line 2154 of file mg_processing.cpp.

◆ project_apply_map_magnifications()

int project_apply_map_magnifications ( Bproject *  project,
int  mag_num,
float *  mag 
)

Change particle pixel sizes for particles based on map magnifications.

Parameters
*projectproject parameter structure.
mag_numnumber of maps;
*magarray of map magnifications.
Returns
int 0.

Definition at line 2471 of file mg_processing.cpp.

◆ project_create()

Bproject* project_create ( int  nmg,
int  nrec 
)

Creates a micrograph processing project parameter structure.

Parameters
nmgnumber of micrograph structures.
nrecnumber of reconstruction structures.
Returns
Bproject* project parameter structure.
The function allocates memory for the project structure, a field-of-view structure,
and the requested number of micrographs and reconstructions.

Definition at line 48 of file mg_processing.cpp.

◆ project_divide()

long project_divide ( Bproject *  project,
long  n 
)

Divides a project into a number of micrograph subsets.

Parameters
*projectproject parameter structure.
nnumber of subsets.
Returns
long number of new projects created.
Only selected micrographs are considered in the subdivision.

Definition at line 1204 of file mg_processing.cpp.

◆ project_dump()

long project_dump ( Bproject *  project,
Bstring &  filename 
)

Dumps particle info in the project hierarchy.

Parameters
*projectproject parameter structure.
&filenameoutput file name.
Returns
long number of particles dumped.

Definition at line 1646 of file mg_processing.cpp.

◆ project_equal_mg_part_files()

int project_equal_mg_part_files ( Bproject *  project)

Sets micrograph and particle files to be the same.

Parameters
*projectproject parameter structure.
Returns
int 0.
If the micrograph file name exists, that is used, otherwise the
particle file name is used.

Definition at line 88 of file mg_processing.cpp.

◆ project_flip_origins()

int project_flip_origins ( Bproject *  project,
int  flip 
)

Flip origin coordinates.

Parameters
*projectproject parameter structure.
flipaxes to flip.
Returns
int 0.
The particle origins are reversed.
The specification of axes to flip is embedded in the flip number:
    first bit  - x
    second bit - y
    third bit  - z

Definition at line 2196 of file mg_processing.cpp.

◆ project_init()

Bproject* project_init ( )

Initializes a micrograph processing project parameter structure.

Returns
Bproject* project parameter structure.
The function allocates memory for the project structure.

Definition at line 30 of file mg_processing.cpp.

◆ project_kill()

int project_kill ( Bproject *  project)

Frees a whole project.

Frees all the structures down the hierarchy.
Parameters
*projectproject parameter structure.
Returns
int 0.

Definition at line 429 of file mg_processing.cpp.

◆ project_merge_part_parameters()

int project_merge_part_parameters ( Bproject *  project,
Bproject *  partproject 
)

Puts particle parameters from one project into another.

Parameters
*projectproject parameter structure with all parameters.
*partprojectproject parameter structure with particle parameters.
Returns
int 0.

Definition at line 1118 of file mg_processing.cpp.

◆ project_mg_particle_array()

Bparticle** project_mg_particle_array ( Bproject *  project,
int  part_select,
long &  npart 
)

Sets up an array of selected particle pointers.

Parameters
*projectproject parameter structure.
part_selectparticle selection (-1 if none).
&npartarray length (modified).
Returns
Bparticle** particle pointer array.
FOM's of non-selected particles are zeroed.

Definition at line 1282 of file mg_processing.cpp.

◆ project_micrograph_array()

Bmicrograph** project_micrograph_array ( Bproject *  project,
long &  nmg 
)

Sets up an array of selected micrograph pointers.

Parameters
*projectproject parameter structure.
&nmgarray length (modified).
Returns
Bmicrograph** micrograph pointer array.
FOM's of non-selected micrographs are zeroed.

Definition at line 1254 of file mg_processing.cpp.

◆ project_rec_particle_array()

Bparticle** project_rec_particle_array ( Bproject *  project,
int  part_select,
long &  npart 
)

Sets up an array of selected particle pointers.

Parameters
*projectproject parameter structure.
part_selectparticle selection (-1 if none).
&npartarray length (modified).
Returns
Bparticle** particle pointer array.
FOM's of non-selected particles are zeroed.

Definition at line 1324 of file mg_processing.cpp.

◆ project_renumber_particles()

long project_renumber_particles ( Bproject *  project)

Renumbers particles.

Parameters
*projectproject parameter structure.
Returns
long total number of particles.
For each micrograph the particles are renumbered starting from 1.

Definition at line 2247 of file mg_processing.cpp.

◆ project_reset()

long project_reset ( Bproject *  project,
Bstring &  reset 
)

Reset a particle parameter from its micrograph.

Parameters
*projectproject parameter structure.
&reseta string specifying the parameter.
Returns
long number of particles changed.

Definition at line 2516 of file mg_processing.cpp.

◆ project_revert_filenames()

int project_revert_filenames ( Bproject *  project,
Bproject *  project_old,
int  flag 
)

Reverts file names to what it was in an old project.

Parameters
*projectproject parameter structure.
*project_oldproject parameter structure with old file names.
flag1=mg, 2=ps, 4=rec, 8=part, 16=frames.
Returns
int 0.

Definition at line 1388 of file mg_processing.cpp.

◆ project_rotate_particle_views()

int project_rotate_particle_views ( Bproject *  project,
View  view 
)

Rotates particle views with respect to a reference view.

Author
Eduardo Sanz-Garcia
Parameters
*projectproject parameter structure.
viewreference view.
Returns
int 0.

Definition at line 2429 of file mg_processing.cpp.

◆ project_set_dose()

int project_set_dose ( Bproject *  project,
double  dose 
)

Sets the electron dose of all the micrographs.

Parameters
*projectproject parameter structure.
doseelectron dose (electrons/angstrom).
Returns
int 0.

Definition at line 2099 of file mg_processing.cpp.

◆ project_set_field_id()

int project_set_field_id ( Bproject *  project,
int  nseries,
Bstring &  field_id 
)

Sets the field id's according to a regular series.

The micrograph data blocks must be arranged in a regular order with
every nseries micrographs from the same field-of-view.
The field id's are taken from the first micrograph id in a series.
Parameters
*projectproject parameter structure.
nseriesnumber of micrographs per field-of-view.
&field_ida user-specified field ID.
Returns
int 0.

Definition at line 1456 of file mg_processing.cpp.

◆ project_set_filament_path()

int project_set_filament_path ( Bproject *  project,
Bstring &  path 
)

Sets the path to filament files for all the micrographs.

Parameters
*projectproject parameter structure.
&pathpath to filament files.
Returns
int 0.
If the requested path is "." or "./", the path is completely removed.

Definition at line 1903 of file mg_processing.cpp.

◆ project_set_frame_path()

int project_set_frame_path ( Bproject *  project,
Bstring &  path 
)

Sets the path to micrograph frames files for all the micrographs.

Parameters
*projectproject parameter structure.
&pathpath to micrograph frames files.
Returns
int 0.
If the requested path is "." or "./", the path is completely removed.

Definition at line 1795 of file mg_processing.cpp.

◆ project_set_magnification()

int project_set_magnification ( Bproject *  project,
double  mag 
)

Sets the magnification for all the micrographs.

Parameters
*projectproject parameter structure.
magmagnification.
Returns
int 0.

Definition at line 1954 of file mg_processing.cpp.

◆ project_set_mg_pixel_size()

int project_set_mg_pixel_size ( Bproject *  project,
Vector3< double >  pixel_size 
)

Sets the pixel size for all the micrographs.

Parameters
*projectproject parameter structure.
pixel_sizepixel size.
Returns
int 0.

Definition at line 1997 of file mg_processing.cpp.

◆ project_set_micrograph_origins()

int project_set_micrograph_origins ( Bproject *  project,
Vector3< double >  origin 
)

Sets micrograph origins to the given origin.

Parameters
*projectproject parameter structure.
originparticle origin.
Returns
int 0.
For each micrograph the micrograph origin is set to the given origin.

Definition at line 2122 of file mg_processing.cpp.

◆ project_set_micrograph_path()

int project_set_micrograph_path ( Bproject *  project,
Bstring &  path 
)

Sets the path to micrograph files for all the micrographs.

Parameters
*projectproject parameter structure.
&pathpath to micrograph files.
Returns
int 0.
If the requested path is "." or "./", the path is completely removed.

Definition at line 1766 of file mg_processing.cpp.

◆ project_set_part_links()

long project_set_part_links ( Bproject *  project)

Sets the links from particles back to the micrographs and reconstructions.

Parameters
*projectproject parameter structure.
Returns
long number of particles.

Definition at line 1148 of file mg_processing.cpp.

◆ project_set_part_pixel_size()

int project_set_part_pixel_size ( Bproject *  project,
Vector3< double >  pixel_size 
)

Sets the pixel size for all the particles.

Parameters
*projectproject parameter structure.
pixel_sizepixel size.
Returns
int 0.

Definition at line 2042 of file mg_processing.cpp.

◆ project_set_particle_asu_views() [1/2]

int project_set_particle_asu_views ( Bproject *  project,
Bstring &  symmetry_asu 
)

Sets particle views within the asymmetric unit.

Parameters
*projectproject parameter structure.
&symmetry_asupoint group string.
Returns
int 0.
For each micrograph or reconstruction the particle view is set to within the asymmetric unit.

Definition at line 2383 of file mg_processing.cpp.

◆ project_set_particle_asu_views() [2/2]

int project_set_particle_asu_views ( Bproject *  project,
Bsymmetry *  sym 
)

Definition at line 2396 of file mg_processing.cpp.

◆ project_set_particle_box_size() [1/2]

int project_set_particle_box_size ( Bproject *  project,
long  box_size 
)

Sets particle box size to the given value.

Parameters
*projectproject parameter structure.
box_sizeparticle box size.
Returns
int 0.
For each micrograph or reconstruction the particle box size is set 
to the given radius and the particle origins are adjusted as well.

Definition at line 2329 of file mg_processing.cpp.

◆ project_set_particle_box_size() [2/2]

int project_set_particle_box_size ( Bproject *  project,
Vector3< long >  box_size 
)

Sets particle box size to the given value.

Parameters
*projectproject parameter structure.
box_sizeparticle box size.
Returns
int 0.
For each micrograph or reconstruction the particle box size is set 
to the given radius and the particle origins are adjusted as well.

Definition at line 2284 of file mg_processing.cpp.

◆ project_set_particle_origins()

int project_set_particle_origins ( Bproject *  project,
Vector3< double >  origin 
)

Sets particle origins to given values.

Parameters
*projectproject parameter structure.
originparticle origin.
Returns
int 0.
For each micrograph or reconstruction the particle origin is set to the given origin.

Definition at line 2348 of file mg_processing.cpp.

◆ project_set_particle_path()

int project_set_particle_path ( Bproject *  project,
Bstring &  path 
)

Sets the path to particle files for all the micrographs.

Parameters
*projectproject parameter structure.
&pathpath to particle files.
Returns
int 0.
If the requested path is "." or "./", the path is completely removed.

Definition at line 1853 of file mg_processing.cpp.

◆ project_set_powerspectrum_path()

int project_set_powerspectrum_path ( Bproject *  project,
Bstring &  path 
)

Sets the path to powerspectrum files for all the micrographs.

Parameters
*projectproject parameter structure.
&pathpath to powerspectrum files.
Returns
int 0.
If the requested path is "." or "./", the path is completely removed.

Definition at line 1824 of file mg_processing.cpp.

◆ project_set_rec_voxel_size()

int project_set_rec_voxel_size ( Bproject *  project,
Vector3< double >  pixel_size 
)

Sets the pixel size for all the reconstructions.

Parameters
*projectproject parameter structure.
pixel_sizepixel size.
Returns
int 0.

Definition at line 2021 of file mg_processing.cpp.

◆ project_set_scan_sampling()

int project_set_scan_sampling ( Bproject *  project,
double  sampling 
)

Sets the scan sampling for all the micrographs.

Parameters
*projectproject parameter structure.
samplingsampling.
Returns
int 0.
Sampling is isotropic.

Definition at line 1977 of file mg_processing.cpp.

◆ project_set_tilt()

int project_set_tilt ( Bproject *  project,
double  tilt_axis,
double  tilt_angle 
)

Sets the tilt parameters for all the micrographs.

Parameters
*projectproject parameter structure.
tilt_axismicrograph tilt axis angle.
tilt_anglemicrograph tilt angle.
Returns
int 0.

Definition at line 2076 of file mg_processing.cpp.

◆ project_show_class_averages()

long project_show_class_averages ( Bproject *  project)

Shows the class averages in a project.

Parameters
*projectproject parameter structure.
Returns
long number of class averages.

Definition at line 1617 of file mg_processing.cpp.

◆ project_show_hierarchy()

long project_show_hierarchy ( Bproject *  project)

Shows the project hierarchy.

Parameters
*projectproject parameter structure.
Returns
long number of particles selected.

Definition at line 1506 of file mg_processing.cpp.

◆ project_update()

int project_update ( Bproject *  project,
Bproject *  proj_new,
int  fom_index 
)

Updates an existing project with new information.

Parameters
*projectproject parameter structure to be updated.
*proj_newproject parameter structure with new information.
fom_indexindex of FOM to select on.
Returns
int 0.
The new information is encoded as a project hierarchy.
The original project hierarchy is searched for the micrograph ID
tags that correspond to the original project hierarchy and those
micrograph parameters are updated. Because the micrograph ID tags
should be unique in themselves, the field ID tags are ignored and
the two project hierarchies may have different field designations.
If a micrograph ID from the new project hierarchy is not found in
the original project hierarchy, it is added.
The new project hierarchy is not modified.

Definition at line 809 of file mg_processing.cpp.

◆ rec_part_links()

int rec_part_links ( Breconstruction *  rec)

Sets the links from particles to reconstructions.

Parameters
*recpointer to reconstruction.
Returns
int 0.

Definition at line 265 of file mg_processing.cpp.

◆ reconstruction_add()

Breconstruction* reconstruction_add ( Breconstruction **  rec,
Bstring &  rec_id 
)

Adds a reconstruction parameter structure to a linked list.

Parameters
**recpointer to any reconstruction in the list.
&rec_idreconstruction identifier.
Returns
Breconstruction* new reconstruction.
The function allocates memory for a new micrograph structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Definition at line 398 of file mg_processing.cpp.

◆ reconstruction_kill()

int reconstruction_kill ( Breconstruction *  rec)

Frees a whole reconstruction parameter structure.

Frees all the structures down the hierarchy.
Parameters
*recreconstruction parameter structure.
Returns
int 0.

Definition at line 582 of file mg_processing.cpp.

◆ reconstruction_set_part_links()

long reconstruction_set_part_links ( Breconstruction *  rec)

Sets the links from particles back to the reconstruction.

Parameters
*recreconstruction parameter structure.
Returns
long number of particles.

Definition at line 1185 of file mg_processing.cpp.

◆ reconstruction_update()

int reconstruction_update ( Breconstruction *  rec,
Breconstruction *  nu_rec,
int  fom_index,
int  flags 
)

Updates an existing reconstruction with new information.

Parameters
*recreconstruction structure to be updated.
*nu_recreconstruction structure with new information.
fom_indexindex of FOM to select on.
flagsflags indicating which parts to update.
Returns
int 0.
The new information is encoded as a reconstruction structure.
The update is only done if the FOM of the new reconstruction is better.
All fields are updated if the new fields contain non-default data.
Defaults are defined here as zero-length strings or zeroes.
The particles in the original reconstruction are matched by ID with 
those in the new reconstruction and updated, with any new particles 
added from the new reconstruction.
The bad area and marker coordinates are replaced if they exist 
in the new structure.
The new reconstruction structure is not modified, except for deletion 
of bad areas and markers.

Definition at line 982 of file mg_processing.cpp.

◆ structurefactor_copy()

Bstrucfac* structurefactor_copy ( Bstrucfac *  sflist)

Definition at line 689 of file mg_processing.cpp.

◆ views_from_project()

View* views_from_project ( Bproject *  project,
int  selection 
)

Retrieves the particle views from a project.

Parameters
*projectproject parameter structure.
selectionselection number (-1 selects positives, 0 selects all).
Returns
View* linked list of views.

Definition at line 2566 of file mg_processing.cpp.

Variable Documentation

◆ verbose

int verbose
extern