/Users/bernard/b20/bsoft/include/mg_tomography.h(3)

NAME
/Users/bernard/b20/bsoft/include/mg_tomography.h - Header file for single particle image processing in Bsoft.

SYNOPSIS

#include 'mg_processing.h'
#include 'rwimg.h'
#include 'Matrix3.h'

  Functions
int mg_marker_init (Bmicrograph *mg, Bmarker *model)
Initializes markers from the reference.
int mg_marker_update (Bmicrograph *mg, Bmarker *model, Vector3< double > oriref, int update_location)
Calculates the predicted positions of markers from the reference.
Vector3< double > mg_location_from_3D_model (Vector3< double > loc, Matrix3 mat, Vector3< double > ori)
Calculates the 2D location of a marker from a 3D model.
Vector3< double > mg_location_from_3D_model (Vector3< double > loc, Matrix3 mat, Vector3< double > ori, Vector3< double > scale)
Vector3< double > mg_location_from_3D_model (Vector3< double > loc3D, Vector3< double > ori3D, Matrix3 mat, Vector3< double > ori)
Vector3< double > mg_location_from_3D_model (Vector3< double > loc3D, Vector3< double > ori3D, Matrix3 mat, Vector3< double > ori, Vector3< double > scale)
Bimage * img_gold_particle (Vector3< long > size, double radius)
Generates an image representing a gold particle.
Bmarker * img_find_gold_particles (Bimage *p, int img_select, double radius, long edge, double cutoff)
Finds gold particles in micrograph images.
int project_mass_normalize (Bproject *project, double avg, double std, int norm_type, DataType datatype, int setinputZslices, int setoutputZslices, double cutmin, double cutmax, double replace_threshold, string &label)
Normalizes a set of images in a project to a desired average and standard deviation.
double project_thickness_to_lambda_ratio (Bproject *project)
Determines the thickness to mean free path ratio from a tilt series.
double project_lambda (Bproject *project, double thickness)
Determines the mean free path from a tilt series and thickness.
double project_thickness (Bproject *project, double lambda)
Determines the thickness from a tilt series and mean free path.
int project_sort_markers_by_id (Bproject *project)
Sorts markers for each micrograph by ID number.
double project_tomo_residuals (Bproject *project, int show)
Calculates the residuals for an alignment solution.
double mg_tomo_residuals (Bmicrograph *mg, Bmarker *model, Vector3< double > oriref)
Calculates the residuals for an alignment solution of one micrograph.
double project_tomo_errors (Bproject *project)
Analyzes marker errors.
int project_calculate_model (Bproject *project)
Calculates the z-coordinates of the marker model.
int project_generate_markers (Bproject *project)
Generates missing micrograph and model markers.
Bimage * mg_erase_markers (Bmicrograph *mg, double marker_radius)
Erases or paints markers in micrographs.
int project_erase_markers (Bproject *project, double marker_radius)
Erases or paints markers in micrographs.
int mg_reset_model (Bmicrograph *mg, Bmarker *model)
Resets the model x and y coordinates from the zero-tilt micrograph.
long project_find_markers (Bproject *project, long edge, int add)
Finds all markers in a project.
long mg_find_markers (Bmicrograph *mg, long edge, int add)
Finds markers in a micrograph.
Bimage * mg_composite_particle (Bmicrograph *mg, Vector3< long > size)
Generates an average particle image from a micrograph.
long project_count_markers (Bproject *project)
Counts the markers in a project hierarchy.
long project_show_markers (Bproject *project)
Shows the markers in a project hierarchy.
long project_show_errors (Bproject *project, double error_cutoff)
Shows the errors in marker coordinates in a project hierarchy.
long project_deselect_markers (Bproject *project, Bstring &deselect_list)
Deletes selected markers in a project hierarchy.
long project_delete_markers (Bproject *project, Bstring &delete_list)
Deletes selected markers in a project hierarchy.
long project_renumber_markers (Bproject *project)
Renumbers the markers in a project hierarchy.
long project_mg_select (Bproject *project, Bstring &mg_select)
Selects micrographs in a project hierarchy.
long project_mg_exclude (Bproject *project, Bstring &mg_exclude)
Deselects micrographs in a project hierarchy.
int project_set_tilt_axis (Bproject *project, double tilt_axis)
Sets the tilt axis angle in a project parameter structure.
int project_invert_tilt_axis (Bproject *project)
Inverts the tilt axis in a project parameter structure.
int project_set_tilt_angles (Bproject *project, double tilt_start, double tilt_step)
Sets the tilt and tilt axis angles in a project parameter structure.
int project_calculate_angles (Bproject *project)
Calculates tilt and tilt axis angles from matrices in a project parameter structure.
int project_invert_matrices (Bproject *project)
Inverts the micrograph matrices in a project parameter structure.
int project_mg_marker_select (Bproject *project, double fom)
Selects markers.
int project_set_marker_radius (Bproject *project, double mark_radius)
Sets the marker radius in a project parameter structure.
int project_check_markers (Bproject *project, int flags)
Checks if the markers in a project parameter structure fall within micrographs.
int project_fix_markers (Bproject *project)
Checks if the markers in a project parameter structure fall within micrographs.
int project_mg_tilt_to_matrix (Bproject *project)
Sets the matrix from the tilt and axis angles for each micrograph.
int micrograph_clear_extraneous_areas (Bmicrograph *mg, Bimage *p, long thickness, double width)
Clears extraneous areas from a micrograph.
int project_clear_extraneous_areas (Bproject *project, long thickness, double width)
Clears areas from a tilt series not used in a reconstruction.
double project_marker_rotation_axis (Bproject *project)
Determines the most likely rotation axis location for a tilt series.
int project_merge_rec_markers (Bproject *project)
Merges the markers for two reconstructions.

Detailed Description

Header file for single particle image processing in Bsoft.

Author:
    Bernard Heymann

Date:
    Created: 20020416

    Modified: 20191021

Definition in file mg_tomography.h.

Function Documentation

  Bmarker* img_find_gold_particles (Bimage * p, int img_select, double radius, long edge, double cutoff)

Finds gold particles in micrograph images.

Parameters:
    *p image.
    img_select selected subimage, -1 if all.
    radius gold particle radius in voxel units.
    edge edge width to eliminate particles.
    cutoff FOM cutoff, if 0 then half of maximum FOM.

Returns:
    Bmarker* list of markers.

    An image of the size of an input sub-image is generated with a gold
    particle (black or negative density) at its center.
    Each sub-image is cross-correlated with the gold particle image
    and the position within the image reported.
    The FOM cutoff is used to select cross-correlation peaks, except it
    is reset for the following:
        cutoff == 0 ==> cutoff = FOMavg + FOMstd
        cutoff <  0 ==> cutoff = FOMmax/2

Definition at line 227 of file mg_tomography.cpp.

  Bimage* img_gold_particle (Vector3< long > size, double radius)

Generates an image representing a gold particle.

Parameters:
    size size of image to generate.
    radius gold particle radius in voxel units.

Returns:
    Bimage* gold particle image.

    An image of the size of an input sub-image is generated with a gold
    particle (black or negative density) at its center.

Definition at line 187 of file mg_tomography.cpp.

  Bimage* mg_composite_particle (Bmicrograph * mg, Vector3< long > size)

Generates an average particle image from a micrograph.

Parameters:
    *mg micrograph to extract marker images from.
    size size of image.

Returns:
    Bimage* composite marker projection image.

Definition at line 1240 of file mg_tomography.cpp.

  Bimage* mg_erase_markers (Bmicrograph * mg, double marker_radius)

Erases or paints markers in micrographs.

Parameters:
    *mg micrograph parameter structure.
    marker_radius radius to mask out markers.

Returns:
    Bimage* new micrograph image with erased markers.

    Markers can be either erased to a background value or painted in with
    a set value.

Definition at line 1038 of file mg_tomography.cpp.

  long mg_find_markers (Bmicrograph * mg, long edge, int add)

Finds markers in a micrograph.

Parameters:
    *mg project parameter structure.
    edge edge to exclude.
    add flag to add rather than replace the markers.

Returns:
    long number of markers.

    The markers are located by cross-correlation with a synthetic reference
    whose size is defined by the marker radius. Markers close to the edge
    are eliminated using the given edge size. The main intent is to find
    the seed for a 3D marker model in a zero degree tilt micrograph.

Definition at line 1205 of file mg_tomography.cpp.

  Vector3<double> mg_location_from_3D_model (Vector3< double > loc3D, Matrix3 mat, Vector3< double > ori)

Calculates the 2D location of a marker from a 3D model.

Parameters:
    loc3D 3D marker location.
    mat micrograph view matrix.
    ori micrograph origin.

Returns:
    Vector3<double> transformed 2D marker location.

Definition at line 139 of file mg_tomography.cpp.

  Vector3<double> mg_location_from_3D_model (Vector3< double > loc, Matrix3 mat, Vector3< double > ori, Vector3< double > scale)

Definition at line 150 of file mg_tomography.cpp.

  Vector3<double> mg_location_from_3D_model (Vector3< double > loc3D, Vector3< double > ori3D, Matrix3 mat, Vector3< double > ori)

Definition at line 162 of file mg_tomography.cpp.

  Vector3<double> mg_location_from_3D_model (Vector3< double > loc3D, Vector3< double > ori3D, Matrix3 mat, Vector3< double > ori, Vector3< double > scale)

Definition at line 169 of file mg_tomography.cpp.

  int mg_marker_init (Bmicrograph * mg, Bmarker * model)

Initializes markers from the reference.

Parameters:
    *mg micrograph to initialize.
    *model marker model.

Returns:
    int 0.

Definition at line 29 of file mg_tomography.cpp.

  int mg_marker_update (Bmicrograph * mg, Bmarker * model, Vector3< double > oriref, int update_location)

Calculates the predicted positions of markers from the reference.

Parameters:
    *mg micrograph to update.
    *model marker model.
    oriref reference origin.
    update_location flag to update location based on marker model.

Returns:
    int 0.

    If the marker does not exist in the micrograph, a new one is generated.

Definition at line 59 of file mg_tomography.cpp.

  int mg_reset_model (Bmicrograph * mg, Bmarker * model)

Resets the model x and y coordinates from the zero-tilt micrograph.

Parameters:
    *mg reference micrograph parameter structure.
    *model model marker list.

Returns:
    int markers selected in model.

    Missing model markers are added in and excessive model markers deleted.

Definition at line 1135 of file mg_tomography.cpp.

  double mg_tomo_residuals (Bmicrograph * mg, Bmarker * model, Vector3< double > oriref)

Calculates the residuals for an alignment solution of one micrograph.

Parameters:
    *mg micrograph.
    *model model marker list.
    oriref reference origin.

Returns:
    double average residual.

    Requires the matrices in the micrograph structures to be defined.

Definition at line 809 of file mg_tomography.cpp.

  int micrograph_clear_extraneous_areas (Bmicrograph * mg, Bimage * p, long thickness, double width)

Clears extraneous areas from a micrograph.

Parameters:
    *mg micrograph parameter structure.
    *p micrograph image.
    thickness intended thickness of reconstruction.
    width edge smoothing width.

Returns:
    int 0.

Definition at line 2015 of file mg_tomography.cpp.

  int project_calculate_angles (Bproject * project)

Calculates tilt and tilt axis angles from matrices in a project parameter structure.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    From each matrix, a quaternion is calculated, giving the tilt axis
    and rotation angle.
    The level angle is calculated as the arcsin of the z-coordinate of the axis.

Definition at line 1749 of file mg_tomography.cpp.

  int project_calculate_model (Bproject * project)

Calculates the z-coordinates of the marker model.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    If the project does not have markers, it returns without any change.
    If the reconstruction model is not defined, it is created.

Definition at line 886 of file mg_tomography.cpp.

  int project_check_markers (Bproject * project, int flags)

Checks if the markers in a project parameter structure fall within micrographs.

Parameters:
    *project project parameter structure.
    flags flags to modify actions.

Returns:
    int 0.

    Markers outside the boundaries are dealt with based on the flags variable:
    1   show markers outside the image boundaries.
    2   set marker selections to zero.
    4   set marker fom's to zero.
    8   set marker errors to zero.

Definition at line 1891 of file mg_tomography.cpp.

  int project_clear_extraneous_areas (Bproject * project, long thickness, double width)

Clears areas from a tilt series not used in a reconstruction.

Parameters:
    *project project parameter structure.
    thickness intended thickness of reconstruction.
    width edge smoothing width.

Returns:
    int 0.

Definition at line 2043 of file mg_tomography.cpp.

  long project_count_markers (Bproject * project)

Counts the markers in a project hierarchy.

Parameters:
    *project project parameter structure.

Returns:
    long number of markers.

Definition at line 1293 of file mg_tomography.cpp.

  long project_delete_markers (Bproject * project, Bstring & delete_list)

Deletes selected markers in a project hierarchy.

Parameters:
    *project project parameter structure.
    &delete_list list of markers to deselect.

Returns:
    long number of markers.

    All the occurrences of selected markers in the tilt series are deleted.

Definition at line 1445 of file mg_tomography.cpp.

  long project_deselect_markers (Bproject * project, Bstring & deselect_list)

Deletes selected markers in a project hierarchy.

Parameters:
    *project project parameter structure.
    &deselect_list list of markers to deselect.

Returns:
    long number of markers.

    All the occurrences of selected markers in the tilt series are deleted.

Definition at line 1389 of file mg_tomography.cpp.

  int project_erase_markers (Bproject * project, double marker_radius)

Erases or paints markers in micrographs.

Parameters:
    *project project parameter structure.
    marker_radius radius to mask out markers.

Returns:
    int 0, <0 on error.

    Markers can be either erased to a background value or painted in with
    a set value.

Definition at line 1080 of file mg_tomography.cpp.

  long project_find_markers (Bproject * project, long edge, int add)

Finds all markers in a project.

Parameters:
    *project project parameter structure.
    edge edge to exclude.
    add flag to add rather than replace the markers.

Returns:
    long number of markers.

    Markers are located in each micrograph by cross-correlation.

Definition at line 1180 of file mg_tomography.cpp.

  int project_fix_markers (Bproject * project)

Checks if the markers in a project parameter structure fall within micrographs.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

Definition at line 1926 of file mg_tomography.cpp.

  int project_generate_markers (Bproject * project)

Generates missing micrograph and model markers.

Parameters:
    *project project parameter structure.

Returns:
    int 0, <0 on error.

    First the 3D model is updated to represent all markers from all micrographs.
    Then the missing markers in the micrographs are generated from the
    updated model.

Definition at line 1007 of file mg_tomography.cpp.

  int project_invert_matrices (Bproject * project)

Inverts the micrograph matrices in a project parameter structure.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    The tilt axis angle for all the micrographs are set to the same value.

Definition at line 1819 of file mg_tomography.cpp.

  int project_invert_tilt_axis (Bproject * project)

Inverts the tilt axis in a project parameter structure.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    The tilt axis angle for all the micrographs are set to the same value.

Definition at line 1694 of file mg_tomography.cpp.

  double project_lambda (Bproject * project, double thickness)

Determines the mean free path from a tilt series and thickness.

Parameters:
    *project project structure.
    thickness tomogram thickness (in angstrom).

Returns:
    double ratio.

    The micrographs should be unmodified gain-corrected images obtained from the detector.

Definition at line 598 of file mg_tomography.cpp.

  double project_marker_rotation_axis (Bproject * project)

Determines the most likely rotation axis location for a tilt series.

Parameters:
    *project project parameter structure.

Returns:
    double average z offset from marker z average.

    All micrographs must have associated markers.

Definition at line 2124 of file mg_tomography.cpp.

  int project_mass_normalize (Bproject * project, double avg, double std, int norm_type, DataType datatype, int setinputZslices, int setoutputZslices, double cutmin, double cutmax, double replace_threshold, string & label)

Normalizes a set of images in a project to a desired average and standard deviation.

Parameters:
    *project project structure.
    avg desired average.
    std desired standard deviation (if 0, use defaults).
    norm_type type of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson.
    datatype data type for normalized images.
    setinputZslices convert z-slices in the input to 2D images.
    setoutputZslices convert output image back to z-slices.
    cutmin truncate to minimum.
    cutmax truncate to maximum.
    replace_threshold replace maxima above this threshold.
    label output image text label.

Returns:
    int 0, <0 on error.

    The effective average and standard deviation for each image is obtained
    in one of three ways:
        0.      The simple avergae and standard devaition for the image.
        1.      Gaussian fit of the histogram.
        2.      Poisson fit of the histogram.
    A histogram of an image is calculated with a given number of bins.
    The histogram is fit to a Gaussian or Poisson function with exclusion of a
    small number of bins in the histogram (defined as outliers).
    The effective average and standard deviation are used to
    rescale the data for each image.

Definition at line 379 of file mg_tomography.cpp.

  int project_merge_rec_markers (Bproject * project)

Merges the markers for two reconstructions.

Parameters:
    *project project parameter structure.

Returns:
    int number of markers merged.

    The reconstructions must have corresponding markers.
    The marker locations are set to the average of the two.
    The second reconstruction is removed.

Definition at line 2163 of file mg_tomography.cpp.

  long project_mg_exclude (Bproject * project, Bstring & mg_exclude)

Deselects micrographs in a project hierarchy.

Parameters:
    *project project parameter structure.
    &mg_exclude list of micrograph numbers.

Returns:
    long number of micrographs excluded.

Definition at line 1623 of file mg_tomography.cpp.

  int project_mg_marker_select (Bproject * project, double fom)

Selects markers.

Parameters:
    *project project parameter structure.
    fom fom cutoff.

Returns:
    int 0.

    Selects all micrograph markers above the given fom cutoff.

Definition at line 1841 of file mg_tomography.cpp.

  long project_mg_select (Bproject * project, Bstring & mg_select)

Selects micrographs in a project hierarchy.

Parameters:
    *project project parameter structure.
    &mg_select list of micrograph numbers.

Returns:
    long number of micrographs selected.

    A micrograph is only selected when it has its selection already set
    and it is in the list of numbers.

Definition at line 1585 of file mg_tomography.cpp.

  int project_mg_tilt_to_matrix (Bproject * project)

Sets the matrix from the tilt and axis angles for each micrograph.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    This is in preparation for reconstruction.

Definition at line 1960 of file mg_tomography.cpp.

  long project_renumber_markers (Bproject * project)

Renumbers the markers in a project hierarchy.

Parameters:
    *project project parameter structure.

Returns:
    long number of markers.

    The markers are assumed to correspond across micrographs and reconstructions.
    The existing marker ids are mapped to an array, and new marker ids generated.

Definition at line 1516 of file mg_tomography.cpp.

  int project_set_marker_radius (Bproject * project, double mark_radius)

Sets the marker radius in a project parameter structure.

Parameters:
    *project project parameter structure.
    mark_radius gold fiducial marker radius (voxels).

Returns:
    int 0.

Definition at line 1862 of file mg_tomography.cpp.

  int project_set_tilt_angles (Bproject * project, double tilt_start, double tilt_step)

Sets the tilt and tilt axis angles in a project parameter structure.

Parameters:
    *project project parameter structure.
    tilt_start starting tilt angle (usually negative).
    tilt_step tilt increment angle.

Returns:
    int 0.

    The single tilt series is defined by a starting tilt angle and a
    tilt increment angle, as well as the tilt axis angle.

Definition at line 1719 of file mg_tomography.cpp.

  int project_set_tilt_axis (Bproject * project, double tilt_axis)

Sets the tilt axis angle in a project parameter structure.

Parameters:
    *project project parameter structure.
    tilt_axis tilt axis angle (wrt x-axis).

Returns:
    int 0.

    The tilt axis angle for all the micrographs are set to the same value.

Definition at line 1672 of file mg_tomography.cpp.

  long project_show_errors (Bproject * project, double error_cutoff)

Shows the errors in marker coordinates in a project hierarchy.

Parameters:
    *project project parameter structure.
    error_cutoff threshold to show errors (distance in pixels).

Returns:
    long number of errors above threshold.

Definition at line 1351 of file mg_tomography.cpp.

  long project_show_markers (Bproject * project)

Shows the markers in a project hierarchy.

Parameters:
    *project project parameter structure.

Returns:
    long number of markers.

Definition at line 1321 of file mg_tomography.cpp.

  int project_sort_markers_by_id (Bproject * project)

Sorts markers for each micrograph by ID number.

Parameters:
    *project micrograph project.

Returns:
    int 0.

    Requires the matrices in the micrograph structures to be defined.

Definition at line 647 of file mg_tomography.cpp.

  double project_thickness (Bproject * project, double lambda)

Determines the thickness from a tilt series and mean free path.

Parameters:
    *project project structure.
    lambda proportionality parameter (in angstrom).

Returns:
    double ratio.

    The micrographs should be unmodified gain-corrected images obtained from the detector.

Definition at line 623 of file mg_tomography.cpp.

  double project_thickness_to_lambda_ratio (Bproject * project)

Determines the thickness to mean free path ratio from a tilt series.

Parameters:
    *project project structure.

Returns:
    double ratio.

    The micrographs should be unmodified gain-corrected images obtained from the detector.

Definition at line 504 of file mg_tomography.cpp.

  double project_tomo_errors (Bproject * project)

Analyzes marker errors.

Parameters:
    *project micrograph project.

Returns:
    double 0.

    Requires the marker errors to be calculated.

Definition at line 843 of file mg_tomography.cpp.

  double project_tomo_residuals (Bproject * project, int show)

Calculates the residuals for an alignment solution.

Parameters:
    *project micrograph project.
    show flag to indicate showing lists.

Returns:
    double average residual.

    Requires the matrices in the micrograph structures to be defined.

Definition at line 671 of file mg_tomography.cpp.

Author

Generated automatically by Doxygen for Bsoft from the source code.