Bsoft 2.1.4
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>

Functions

Bprojectproject_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...
 
Bfieldfield_add (Bfield **field, Bstring &field_id)
 Adds a field-of-view parameter structure to a linked list. More...
 
Bmicrographmicrograph_add (Bmicrograph **mg, Bstring &mg_id)
 Adds a micrograph parameter structure to a linked list. More...
 
Bframeframe_add (Bframe **frame, int pid)
 Adds a movie frame parameter structure to a linked list. More...
 
Bparticleparticle_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...
 
Bparticlepart_find_first (Bproject *project)
 Finds the first particle in a project. More...
 
Bfilamentfilament_add (Bfilament **fil, int pid)
 Adds a filament parameter structure to a linked list. More...
 
Bfilnodefilament_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...
 
Breconstructionreconstruction_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...
 
Bparticleparticle_copy (Bparticle **partlist, Bparticle *part)
 Adds one particle onto a list of particle parameters. More...
 
Bparticleparticle_copy (Bparticle *partlist)
 Copies a list of particle parameters to a new list. More...
 
Bbadareaparticle_bad_copy (Bbadarea *badlist)
 
Bfilamentfilament_copy (Bfilament *fillist)
 
Bstrucfacstructurefactor_copy (Bstrucfac *sflist)
 
Blayerlinelayerline_copy (Blayerline *layerlist)
 
Bmicrographmicrograph_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_frame_pixel_size (Bproject *project, Vector3< double > pixel_size)
 Sets the pixel size for all the micrograph frames. 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_exposure (Bproject *project, double exposure)
 Sets the aquisition time of all the micrographs. More...
 
int project_set_dose (Bproject *project, double dose)
 Sets the electron dose of all the micrographs. More...
 
int project_set_dose (Bproject *project, JSvalue &dose_frac)
 Sets the dose fractionation scheme 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...
 
Viewviews_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...
 

Variables

int verbose
 

Detailed Description

Functions for micrograph processing.

Author
Bernard Heymann
Date
Created: 20010206
Modified: 20210722

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.

◆ 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.

◆ 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.

◆ filament_copy()

Bfilament * filament_copy ( Bfilament fillist)

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ get_fom_tag()

Bstring get_fom_tag ( FOMType  fom_type)

Returns the tag associated with a particular FOM.

Parameters
fom_typetype of FOM.
Returns
Bstring FOM tag.

◆ layerline_copy()

Blayerline * layerline_copy ( Blayerline layerlist)

◆ mg_part_links()

int mg_part_links ( Bmicrograph mg)

Sets the links from particles to micrographs.

Parameters
*mgpointer to micrograph.
Returns
int 0.

◆ 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.

◆ micrograph_copy()

Bmicrograph * micrograph_copy ( Bmicrograph mg)

Copies a micrograph.

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

◆ 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.

◆ 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.

◆ 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

◆ 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.

◆ 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.

◆ 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.

◆ particle_bad_copy()

Bbadarea * particle_bad_copy ( Bbadarea badlist)

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ path_update()

Bstring path_update ( Bstring filename,
Bstring path 
)

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ project_set_dose() [1/2]

int project_set_dose ( Bproject project,
double  dose 
)

Sets the electron dose of all the micrographs.

Parameters
*projectproject parameter structure.
doseelectron dose (e/A2).
Returns
int 0.

◆ project_set_dose() [2/2]

int project_set_dose ( Bproject project,
JSvalue dose_frac 
)

Sets the dose fractionation scheme of all the micrographs.

Parameters
*projectproject parameter structure.
dose_fracelectron dose fractionation scheme.
Returns
int 0.

◆ project_set_exposure()

int project_set_exposure ( Bproject project,
double  exposure 
)

Sets the aquisition time of all the micrographs.

Parameters
*projectproject parameter structure.
exposureaquisition time (seconds).
Returns
int 0.

◆ 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.

◆ 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.

◆ 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.

◆ project_set_frame_pixel_size()

int project_set_frame_pixel_size ( Bproject project,
Vector3< double >  pixel_size 
)

Sets the pixel size for all the micrograph frames.

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

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ project_set_particle_asu_views() [2/2]

int project_set_particle_asu_views ( Bproject project,
Bsymmetry sym 
)

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ project_show_hierarchy()

long project_show_hierarchy ( Bproject project)

Shows the project hierarchy.

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

◆ 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.

◆ rec_part_links()

int rec_part_links ( Breconstruction rec)

Sets the links from particles to reconstructions.

Parameters
*recpointer to reconstruction.
Returns
int 0.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ structurefactor_copy()

Bstrucfac * structurefactor_copy ( Bstrucfac sflist)

◆ 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.

Variable Documentation

◆ verbose

int verbose
extern