Bsoft 2.1.4
Bernard's software package
mg_select.h File Reference

Header file for micrograph processing. More...

#include "ctf.h"
#include "symmetry.h"
#include "marker.h"
#include "View.h"
#include "Euler.h"
#include "Bstring.h"

Functions

Bfieldfield_find_id (Bfield *field, Bstring &field_id)
 Finds a field-of-view based on its identifier. More...
 
Bmicrographfield_find_micrograph (Bfield *field, int mg_select, int mg_index, double mg_ang)
 Returns a pointer to a specific micrograph in a field-of-view structure based on a unique characteristic of that micrograph. More...
 
Bmicrographfield_find_micrograph_n (Bfield *field, int n)
 Returns a pointer to the nth micrograph in a field-of-view structure. More...
 
Bmicrographfield_find_micrograph_by_focus (Bfield *field, int focus_opt, int index)
 Returns a pointer to the micrograph in a field-of-view structure based on the focus level and iteration index. More...
 
Bmicrographfield_find_micrograph_by_rotang (Bfield *field, double rotang)
 Returns a pointer to the micrograph in a field-of-view structure with the specified in-plane rotational angle. More...
 
Bmicrographfield_find_micrograph_by_tiltang (Bfield *field, double tiltang)
 Returns a pointer to the micrograph in a field-of-view structure with the specified tilt angle. More...
 
Bmicrographfield_find_zero_tilt_mg (Bfield *field)
 Finds the micrograph closest to a zero degree tilt in a series. More...
 
Bmicrographfield_find_low_tilt_mg_with_markers (Bfield *field)
 Finds the micrograph closest to a zero degree tilt in a series with markers. More...
 
long project_count_fields (Bproject *project)
 Counts all the fields in the project structure. More...
 
long project_count_micrographs (Bproject *project)
 Counts all the micrographs in the project structure. More...
 
long project_count_mg_selected (Bproject *project)
 Counts all the selected micrographs in the project structure. More...
 
long project_count_reconstructions (Bproject *project)
 Counts all the reconstructions in the project structure. More...
 
long project_count_rec_selected (Bproject *project)
 Counts all the selected reconstructions in the project structure. More...
 
long project_count_mg_particles (Bproject *project)
 Counts all the particles in the project structure. More...
 
long project_count_mg_part_selected (Bproject *project)
 Counts the number of particles in a project. More...
 
long project_count_mg_part_selected (Bproject *project, int num_select)
 Counts the number of particles in a project. More...
 
long project_count_mg_groups (Bproject *project)
 Counts the number of groups of particles in the project structure. More...
 
long project_count_mg_groups_selected (Bproject *project)
 Counts the number of groups of particles in the project structure. More...
 
long project_count_rec_particles (Bproject *project)
 Counts all the particles in the project structure. More...
 
long project_count_rec_part_selected (Bproject *project)
 Counts all the particles in the project structure. More...
 
long project_count_rec_groups (Bproject *project)
 Counts all the particles in the project structure. More...
 
long project_count_mg_filaments (Bproject *project)
 Counts the number of filaments in a project. More...
 
long project_count_mg_filament_nodes (Bproject *project)
 Counts the number of filament nodes in a project. More...
 
long project_count_rec_filaments (Bproject *project)
 Counts the number of filaments in a project. More...
 
long project_count_rec_filament_nodes (Bproject *project)
 Counts the number of filaments in a project. More...
 
long field_count (Bfield *field)
 Counts the number of fields-of-view in a linked list. More...
 
long field_count_micrographs (Bfield *field)
 Counts all the micrographs in the field-of-view structure. More...
 
long field_count_mg_selected (Bfield *field)
 Counts all the micrographs in the field-of-view structure. More...
 
long field_count_particles (Bfield *field)
 Counts all the particles in the field-of-view structure. More...
 
long micrograph_count (Bmicrograph *mg)
 Counts the number of micrographs in a linked list. More...
 
long micrograph_count_particles (Bmicrograph *mg)
 Counts all the particles in the micrograph structure. More...
 
long particle_count (Bparticle *part)
 Counts the number of particles in a linked list. More...
 
long particle_count_selected (Bparticle *part)
 Counts the number of particles in a linked list. More...
 
long filament_count (Bfilament *fil)
 Counts the number of filaments in a linked list of filaments. More...
 
long filament_node_count (Bfilament *fil)
 Counts the number of filament nodes in a linked list of filaments. More...
 
long project_maximum_selection (Bproject *project)
 Finds the maximum selection number for a project. More...
 
long project_show_selection_numbers (Bproject *project)
 Shows the selection numbers for the particles in a project. More...
 
long project_show_selected (Bproject *project)
 Shows the selected particles in a project. More...
 
long project_show_selected_parameters (Bproject *project, int show)
 Shows the selected particle parameters in a project. More...
 
long project_show_mg_parameter (Bproject *project, Bstring &tag)
 Shows the micrograph parameter indicated by the tag in a project. More...
 
long project_show_part_parameter (Bproject *project, Bstring &tag)
 Shows the particle parameter indicated by the tag in a project. More...
 
long project_show_fom_histogram (Bproject *project, long bins, double min, double max)
 Shows a histogram of the FOM values. More...
 
long project_show_mag_histogram (Bproject *project, long bins, double increment)
 Shows the histogram for magnification values for selected particles. More...
 
int project_select_field (Bproject *project, Bstring &field_id)
 Selects a field from the project and deletes the rest. More...
 
int project_select_micrograph (Bproject *project, Bstring &mg_id)
 Selects a micrograph from the project and deletes the rest. More...
 
long project_select_with_particles (Bproject *project, long part_sel)
 Selects micrographs with particles. More...
 
vector< pair< Bmicrograph *, double > > project_mg_sort (Bproject *project, Bstring tag)
 Sorts the micrographs by a selected parameter. More...
 

Detailed Description

Header file for micrograph processing.

Author
Bernard Heymann
Date
Created: 20000426
Modified: 20210515

Function Documentation

◆ field_count()

long field_count ( Bfield field)

Counts the number of fields-of-view in a linked list.

The function counts fields-of-view in the list from the given pointer,
and does not count fields-of-view prior to this one.
Parameters
*fieldpointer to any field-of-view in the list.
Returns
long number of fields-of-view.

◆ field_count_mg_selected()

long field_count_mg_selected ( Bfield field)

Counts all the micrographs in the field-of-view structure.

Parameters
*fieldfield-of-view parameter structure.
Returns
long number of micrographs of field.

◆ field_count_micrographs()

long field_count_micrographs ( Bfield field)

Counts all the micrographs in the field-of-view structure.

Parameters
*fieldfield-of-view parameter structure.
Returns
long number of micrographs of field.

◆ field_count_particles()

long field_count_particles ( Bfield field)

Counts all the particles in the field-of-view structure.

Parameters
*fieldfield-of-view parameter structure.
Returns
long number of particles in field.

◆ field_find_id()

Bfield * field_find_id ( Bfield field,
Bstring field_id 
)

Finds a field-of-view based on its identifier.

Parameters
*fieldpointer to first field-of-view in the list.
&field_idfield-of-view identifier.
Returns
Bfield* field-of-view or NULL if not found.
The function searches a linked list for the field-of-view
identifier and returns a pointer to that structure or NULL if
it cannot find it.

◆ field_find_low_tilt_mg_with_markers()

Bmicrograph * field_find_low_tilt_mg_with_markers ( Bfield field)

Finds the micrograph closest to a zero degree tilt in a series with markers.

Parameters
*fieldfield-of-view.
Returns
Bmicrograph* micrograph closest to zero degrees tilt with markers.
The first micrograph with the smallest deviation from zero degree
tilt with defined markers is returned.

◆ field_find_micrograph()

Bmicrograph * field_find_micrograph ( Bfield field,
int  mg_select,
int  mg_index,
double  mg_ang 
)

Returns a pointer to a specific micrograph in a field-of-view structure based on a unique characteristic of that micrograph.

Author
David Belnap
Parameters
*fieldfield-of-view.
mg_selectselection criterion.
mg_indexReference by its index in field (for mg_ref_select=0|1|2).
mg_angReference by micrograph rotation or tilt angle (for mg_ref_select=3|4).
Returns
Bmicrograph* Pointer to the selected micrograph
Calls functions that find a micrograph by index number within the
field, by focus level, in-plane rotational angle, tilt angle, or
tilt angle plus focus level or index number:

criterion                        mg_select   mg_index  mg_ang
--------------------------------------------------------------
nth closest-to-focus                 0           n        -
nth farthest-from-focus              1           n        -
index number in series (1...n)       2         index      -
in-plane rotation angle              3           -      angle
tilt angle                           4           -      angle

◆ field_find_micrograph_by_focus()

Bmicrograph * field_find_micrograph_by_focus ( Bfield field,
int  focus_opt,
int  iselect 
)

Returns a pointer to the micrograph in a field-of-view structure based on the focus level and iteration index.

Author
David Belnap and Bernard Heymann
Parameters
*fielda field-of-view structure
focus_opt0=closest-to-focus, 1=farthest-from-focus
iselect0,1,...,n; select (index+1)th-closest or (index+1)th-farthest focus
Returns
Bmicrograph* mg Micrograph at specified focus level Loops through micrographs in the field-of-view. Orders focus values in an array from smallest to largest. Selects the (index+1)th closest-to-focus or farthest-from-focus value. (focus_opt determines whether the closest or farthest value is selected.) Loops through micrographs again to find the micrograph with the selected value. Tests if there are zero or multiple micrographs with the same focus value and exits program if so. Otherwise, the pointer to the micrograph with the specified focus level is returned. An example, if index=1 and focus_opt=0, a pointer to the 2nd closest-to-focus micrograph will be returned. To get the closest-to-focus or farthest-from-focus value, the index must be zero.

◆ field_find_micrograph_by_rotang()

Bmicrograph * field_find_micrograph_by_rotang ( Bfield field,
double  rotang 
)

Returns a pointer to the micrograph in a field-of-view structure with the specified in-plane rotational angle.

Author
David Belnap and Bernard Heymann
Parameters
*fielda field-of-view
rotangin-plane rotational angle of micrograph (in radians)
Returns
Bmicrograph* mg Pointer to micrograph with rotang
Loop through all micrographs in the field-of-view to find
micrograph with the specified angle.  Test if there are zero or
multiple micrographs with the same rotational angle, halt program 
if true.  If not true, then return pointer to the micrograph with 
the specified angle.

◆ field_find_micrograph_by_tiltang()

Bmicrograph * field_find_micrograph_by_tiltang ( Bfield field,
double  tiltang 
)

Returns a pointer to the micrograph in a field-of-view structure with the specified tilt angle.

Author
David Belnap
Parameters
*fielda field-of-view
tiltangtilt angle of micrograph (in radians)
Returns
Bmicrograph* micrograph with rotang
Loop through all micrographs in the field-of-view to find
micrograph with the specified tilt angle.  Test if there are zero
or multiple micrographs with the same angle, halt program if true.
If not true, then return pointer to the micrograph with the 
specified angle.

◆ field_find_micrograph_n()

Bmicrograph * field_find_micrograph_n ( Bfield field,
int  n 
)

Returns a pointer to the nth micrograph in a field-of-view structure.

Author
David Belnap and Bernard Heymann
Parameters
*fielda field-of-view
nnth micrograph index (first index number = 1)
Returns
Bmicrograph* Pointer to the nth micrograph
Loop through micrographs in the field-of-view until the nth 
micrograph is reached.  Return pointer to that micrograph.
Tests whether n is within the appropriate range.

◆ field_find_zero_tilt_mg()

Bmicrograph * field_find_zero_tilt_mg ( Bfield field)

Finds the micrograph closest to a zero degree tilt in a series.

Parameters
*fieldfield-of-view.
Returns
Bmicrograph* micrograph closest to zero degrees tilt.
The first micrograph with the smallest deviation from zero degree
tilt is returned.

◆ filament_count()

long filament_count ( Bfilament fil)

Counts the number of filaments in a linked list of filaments.

The function counts filaments in the list from the given pointer,
and does not count filaments prior to this one.
Parameters
*filpointer to any filament in the list.
Returns
long number of filaments.

◆ filament_node_count()

long filament_node_count ( Bfilament fil)

Counts the number of filament nodes in a linked list of filaments.

The function counts filament nodes in the list from the given pointer,
and does not count filaments prior to this one.
Parameters
*filpointer to any filament in the list.
Returns
long number of filament nodes.

◆ micrograph_count()

long micrograph_count ( Bmicrograph mg)

Counts the number of micrographs in a linked list.

The function counts micrographs in the list from the given pointer,
and does not count micrographs prior to this one.
Parameters
*mgpointer to any micrograph in the list.
Returns
long number of micrographs.

◆ micrograph_count_particles()

long micrograph_count_particles ( Bmicrograph mg)

Counts all the particles in the micrograph structure.

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

◆ particle_count()

long particle_count ( Bparticle part)

Counts the number of particles in a linked list.

The function counts particles in the list from the given pointer,
and does not count particles prior to this one.
Parameters
*partpointer to any particle in the list.
Returns
long number of particles.

◆ particle_count_selected()

long particle_count_selected ( Bparticle part)

Counts the number of particles in a linked list.

The function counts particles in the list from the given pointer,
and does not count particles prior to this one.
Parameters
*partpointer to any particle in the list.
Returns
long number of particles selected.

◆ project_count_fields()

long project_count_fields ( Bproject project)

Counts all the fields in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of fields in project.

◆ project_count_mg_filament_nodes()

long project_count_mg_filament_nodes ( Bproject project)

Counts the number of filament nodes in a project.

Parameters
*projectproject.
Returns
long number of filament nodes.
The function counts all the filament nodes in a project.

◆ project_count_mg_filaments()

long project_count_mg_filaments ( Bproject project)

Counts the number of filaments in a project.

Parameters
*projectproject.
Returns
long number of filaments.
The function counts all the filaments in a project.

◆ project_count_mg_groups()

long project_count_mg_groups ( Bproject project)

Counts the number of groups of particles in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of groups in project.

◆ project_count_mg_groups_selected()

long project_count_mg_groups_selected ( Bproject project)

Counts the number of groups of particles in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of groups selected in project.

◆ project_count_mg_part_selected() [1/2]

long project_count_mg_part_selected ( Bproject project)

Counts the number of particles in a project.

Parameters
*projectproject.
Returns
long number of particles selected.
The function counts all the selected particles in a project.

◆ project_count_mg_part_selected() [2/2]

long project_count_mg_part_selected ( Bproject project,
int  num_select 
)

Counts the number of particles in a project.

Parameters
*projectproject.
num_selectselection number.
Returns
long number of particles selected.
The function counts all the selected particles in a project.

◆ project_count_mg_particles()

long project_count_mg_particles ( Bproject project)

Counts all the particles in the project structure.

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

◆ project_count_mg_selected()

long project_count_mg_selected ( Bproject project)

Counts all the selected micrographs in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of micrographs selected in project.

◆ project_count_micrographs()

long project_count_micrographs ( Bproject project)

Counts all the micrographs in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of micrographs in project.

◆ project_count_rec_filament_nodes()

long project_count_rec_filament_nodes ( Bproject project)

Counts the number of filaments in a project.

The function counts all the filaments in a project.
Parameters
*projectproject.
Returns
long number of filaments.

◆ project_count_rec_filaments()

long project_count_rec_filaments ( Bproject project)

Counts the number of filaments in a project.

Parameters
*projectproject.
Returns
long number of filaments.
The function counts all the filaments in a project.

◆ project_count_rec_groups()

long project_count_rec_groups ( Bproject project)

Counts all the particles in the project structure.

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

◆ project_count_rec_part_selected()

long project_count_rec_part_selected ( Bproject project)

Counts all the particles in the project structure.

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

◆ project_count_rec_particles()

long project_count_rec_particles ( Bproject project)

Counts all the particles in the project structure.

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

◆ project_count_rec_selected()

long project_count_rec_selected ( Bproject project)

Counts all the selected reconstructions in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of reconstructions selected in project.

◆ project_count_reconstructions()

long project_count_reconstructions ( Bproject project)

Counts all the reconstructions in the project structure.

Parameters
*projectproject parameter structure.
Returns
long number of reconstructions in project.

◆ project_maximum_selection()

long project_maximum_selection ( Bproject project)

Finds the maximum selection number for a project.

Parameters
*projectproject parameter structure.
Returns
long maximum selection number.

◆ project_mg_sort()

vector< pair< Bmicrograph *, double > > project_mg_sort ( Bproject project,
Bstring  tag 
)

Sorts the micrographs by a selected parameter.

Parameters
*projectproject parameter structure.
tagparameter tag.
Returns
vector<pair<Bmicrograph*,double>> array of micrograph links and values.

◆ project_select_field()

int project_select_field ( Bproject project,
Bstring field_id 
)

Selects a field from the project and deletes the rest.

Parameters
*projectproject parameter structure.
&field_idfield to select.
Returns
int 0.

◆ project_select_micrograph()

int project_select_micrograph ( Bproject project,
Bstring mg_id 
)

Selects a micrograph from the project and deletes the rest.

Parameters
*projectproject parameter structure.
&mg_idmicrograph to select.
Returns
int 0.

◆ project_select_with_particles()

long project_select_with_particles ( Bproject project,
long  part_sel 
)

Selects micrographs with particles.

Parameters
*projectproject parameter structure.
part_selflag to select only with this selection number
Returns
long number of particles.

◆ project_show_fom_histogram()

long project_show_fom_histogram ( Bproject project,
long  bins,
double  min,
double  max 
)

Shows a histogram of the FOM values.

Parameters
*projectproject parameter structure.
binsnumber of bins, if 0, set to 100.
minFOM for the first bin.
maxFOM for the last bin.
Returns
long number of particles selected.

◆ project_show_mag_histogram()

long project_show_mag_histogram ( Bproject project,
long  bins,
double  increment 
)

Shows the histogram for magnification values for selected particles.

Parameters
*projectproject parameter structure.
binsnumber of bins.
incrementincrement between bins.
Returns
long number of particles selected.

◆ project_show_mg_parameter()

long project_show_mg_parameter ( Bproject project,
Bstring tag 
)

Shows the micrograph parameter indicated by the tag in a project.

Parameters
*projectproject parameter structure.
&tagparameter tag.
Returns
long number of micrographs selected.

◆ project_show_part_parameter()

long project_show_part_parameter ( Bproject project,
Bstring tag 
)

Shows the particle parameter indicated by the tag in a project.

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

◆ project_show_selected()

long project_show_selected ( Bproject project)

Shows the selected particles in a project.

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

◆ project_show_selected_parameters()

long project_show_selected_parameters ( Bproject project,
int  show 
)

Shows the selected particle parameters in a project.

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

◆ project_show_selection_numbers()

long project_show_selection_numbers ( Bproject project)

Shows the selection numbers for the particles in a project.

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