/Users/bernard/b20/bsoft/src/mg/mg_img_proc.cpp(3)

NAME
/Users/bernard/b20/bsoft/src/mg/mg_img_proc.cpp - Functions for image processing from micrograph structures.

SYNOPSIS

#include 'mg_processing.h'
#include 'mg_ctf.h'
#include 'qsort_functions.h'
#include 'rwimg.h'
#include 'linked_list.h'
#include 'math_util.h'
#include 'random_numbers.h'
#include 'utilities.h'

  Functions
Bstring image_type (Bstring type)
Converts an image type string to a standard form.
Bproject * project_create_from_image (Bimage *p, Bstring type)
Creates a project structure using image file names.
Bproject * project_create_from_images (Bstring *file_list, Bstring type)
Creates a project structure using image file names.
Bimage * particle_read_img (Bparticle *part, int readflag)
Reads a particle image file.
int particle_write_img (Bparticle *part, Bimage *p, int compression)
Writes a particle image file.
int project_check_particles (Bproject *project)
Checks particle numbers and box sizes.
Vector3< long > micrograph_get_size (Bmicrograph *mg)
Gets the size of a micrograph.
Vector3< double > micrograph_get_nominal_origin (Bmicrograph *mg)
Gets the nominal origin for a micrograph.
int project_set_nominal_mg_origins (Bproject *project)
Sets micrograph origins to the centers of the micrographs.
int project_reset_origins (Bproject *project)
Resets particle origins to nominal values.
int project_set_part_img_origins (Bproject *project)
Writes particle origins into particle image files.
long project_delesect_edge_particles (Bproject *project)
Deselects particles that are too close to the image edges.
int project_get_part_box_size (Bproject *project)
Gets the box size from particle image files.
Vector3< long > particle_get_box_size (Bparticle *part)
Gets the box size from particle image file.
int project_write_particle_classes (Bproject *project)
Writes particles to different stacks based on class.
int project_trim_class_averages (Bproject *project, Bstring &list)
Deletes selected class averages from the project..
int project_flip_particle_coordinates (Bproject *project, int flip)
Reverses one or more particle coordinates.
int project_set_views_from_images (Bproject *project)
Gets views from particle images.
int project_set_views_in_images (Bproject *project)
Sets views in particle images from the project parameter structure.
Bstring mg_img_scale (Bstring &filename, Bstring &path, Bstring &insert, double scale, Vector3< double > origin, double pixel_size)
int project_scale_box (Bproject *project, double scale, Bstring mgpath, Bstring partpath, Bstring insert)
Changes all the micrograph fields linked to the box size and write new particle files.
int project_bin_micrographs (Bproject *project, int bin, Bstring mgpath, Bstring partpath)
Bins all micrographs a project.
int project_change_pixel_size (Bproject *project, double new_pixel_size, Bstring mgpath, Bstring partpath)
Changes all the micrograph fields linked to the pixel size.

  Variables
int verbose

Detailed Description

Functions for image processing from micrograph structures.

Author:
    Bernard Heymann

Date:
    Created: 20010206

    Modified: 20180507

Definition in file mg_img_proc.cpp.

Function Documentation

  Bstring image_type (Bstring type)

Converts an image type string to a standard form.

Parameters:
    type a string with a type definition.

Returns:
    Bstring standard type definition.

    The input string is converted to the following strings:
    mg      micrograph
    frame   micrograph frames
    rec     reconstruction
    part    particle
    fil     filament
    ps      power spectrum
    ft      Fourier transform

Definition at line 36 of file mg_img_proc.cpp.

  Bstring mg_img_scale (Bstring & filename, Bstring & path, Bstring & insert, double scale, Vector3< double > origin, double pixel_size)

Definition at line 1128 of file mg_img_proc.cpp.

  Vector3<double> micrograph_get_nominal_origin (Bmicrograph * mg)

Gets the nominal origin for a micrograph.

Parameters:
    *mg micrograph parameter structure.

Returns:
    Vector3<double> nominal origin.

    The nominal origin is defined as the center of the micrograph.

Definition at line 631 of file mg_img_proc.cpp.

  Vector3<long> micrograph_get_size (Bmicrograph * mg)

Gets the size of a micrograph.

Parameters:
    *mg micrograph parameter structure.

Returns:
    Vector3<long> size.

    The micrograph image header is read.

Definition at line 602 of file mg_img_proc.cpp.

  Vector3<long> particle_get_box_size (Bparticle * part)

Gets the box size from particle image file.

Parameters:
    *part particle.

Returns:
    Vector3<long> box size (0 if image does not exist).

    Reads the particle file header and returns the box size.

Definition at line 827 of file mg_img_proc.cpp.

  Bimage* particle_read_img (Bparticle * part, int readflag)

Reads a particle image file.

Parameters:
    *part particle.
    readflag flag to indicate reading the data.

Returns:
    Bimage* image (NULL means failure).

    The file name is taken from the particle record by preference,
    otherwise from the micrograph record.

Definition at line 463 of file mg_img_proc.cpp.

  int particle_write_img (Bparticle * part, Bimage * p, int compression)

Writes a particle image file.

Parameters:
    *part particle.
    *p image to be written.
    compression flag to indicate compression.

Returns:
    int images written.

    The file name is taken from the particle record by preference,
    otherwise from the micrograph record.

Definition at line 509 of file mg_img_proc.cpp.

  int project_bin_micrographs (Bproject * project, int bin, Bstring mgpath, Bstring partpath)

Bins all micrographs a project.

Parameters:
    *project project parameter structure.
    bin binning value.
    mgpath binned micrograph path (must be allocated).
    partpath binned particle path (must be allocated).

Returns:
    int 0.

    All micrographs in a project are binned by the indicated value.
    New micrograph file names are generated with a "_b<n>" insert,
    where the n indicates the bin value.
    The path to the binned micrograph can be specified.

Definition at line 1383 of file mg_img_proc.cpp.

  int project_change_pixel_size (Bproject * project, double new_pixel_size, Bstring mgpath, Bstring partpath)

Changes all the micrograph fields linked to the pixel size.

Parameters:
    *project project parameter structure.
    new_pixel_size new pixel size.
    mgpath binned micrograph path (must be allocated).
    partpath binned particle path (must be allocated).

Returns:
    int 0.

    The fields linked to pixel size are:
        pixel_size
        shift
        box, bad and marker radii
        particle origins and locations
        bad area and marker locations

Definition at line 1414 of file mg_img_proc.cpp.

  int project_check_particles (Bproject * project)

Checks particle numbers and box sizes.

Parameters:
    *project project.

Returns:
    int error code (<0 means failure).

    Reads each particle file header, checks the number of particles
    and sets the box size for the micrograph.

Definition at line 548 of file mg_img_proc.cpp.

  Bproject* project_create_from_image (Bimage * p, Bstring type)

Creates a project structure using image file names.

Parameters:
    *p list of images.
    type type of images: mg, frame, rec, part, fil.

Returns:
    Bproject* new project parameter structure.

    The function sets up the project hierarchy from a list of file names.
    Each file may represent a micrograph or a picked particle file.
    If the image is equal or larger than 1024x1024, it is assumed to be
    a micrograph, its name will be assigned as a micrograph
    file name, and no particle tags will be added.
    If the image is smaller than 1024x1024 or the make_part flag is set,
    it is taken to be picked particles and the file name will
    be assigned as a particle file name.

Definition at line 67 of file mg_img_proc.cpp.

  Bproject* project_create_from_images (Bstring * file_list, Bstring type)

Creates a project structure using image file names.

Parameters:
    *file_list list of file names.
    type type of images: mg, frame, rec, part, fil.

Returns:
    Bproject* new project parameter structure.

    The function sets up the project hierarchy from a list of file names.
    Each file may represent a micrograph or a picked particle file.
    If the image is equal or larger than 1024x1024, it is assumed to be
    a micrograph, its name will be assigned as a micrograph
    file name, and no particle tags will be added.
    If the image is smaller than 1024x1024 or the make_part flag is set,
    it is taken to be picked particles and the file name will
    be assigned as a particle file name.

Definition at line 224 of file mg_img_proc.cpp.

  long project_delesect_edge_particles (Bproject * project)

Deselects particles that are too close to the image edges.

Parameters:
    *project project.

Returns:
    long number of particles selected.

Definition at line 757 of file mg_img_proc.cpp.

  int project_flip_particle_coordinates (Bproject * project, int flip)

Reverses one or more particle coordinates.

Parameters:
    *project project parameter structure.
    flip axes to flip.

Returns:
    int 0.

    The specification of axes to flip is embedded in the flip number:
        first bit  - x
        second bit - y
        third bit  - z

Definition at line 970 of file mg_img_proc.cpp.

  int project_get_part_box_size (Bproject * project)

Gets the box size from particle image files.

Parameters:
    *project project.

Returns:
    int error code (<0 means failure).

    Reads each particle file header and sets the box size for the micrograph.

Definition at line 794 of file mg_img_proc.cpp.

  int project_reset_origins (Bproject * project)

Resets particle origins to nominal values.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    For each micrograph a particle image header is read and the origin
    is set to to the middle of the image.

Definition at line 690 of file mg_img_proc.cpp.

  int project_scale_box (Bproject * project, double scale, Bstring mgpath, Bstring partpath, Bstring insert)

Changes all the micrograph fields linked to the box size and write new particle files.

Parameters:
    *project project parameter structure.
    scale scaling factor.
    mgpath scaled micrograph path.
    partpath scaled particle path.
    insert string to insert into new file names.

Returns:
    int 0.

    The fields linked to pixel size are:
        pixel_size
        shift
        box, bad and marker radii
        particle origins and locations
        bad area and marker locations

Definition at line 1187 of file mg_img_proc.cpp.

  int project_set_nominal_mg_origins (Bproject * project)

Sets micrograph origins to the centers of the micrographs.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

    For each micrograph the micrograph origin is set to the center.

Definition at line 660 of file mg_img_proc.cpp.

  int project_set_part_img_origins (Bproject * project)

Writes particle origins into particle image files.

Author:
    D. Belnap

Parameters:
    *project project.

Returns:
    int error code (<0 means failure).

    Sets the origins (offsets from the first voxel) in an image header to
    values set within a project.  Rewrites image to file.

Definition at line 729 of file mg_img_proc.cpp.

  int project_set_views_from_images (Bproject * project)

Gets views from particle images.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

Definition at line 1033 of file mg_img_proc.cpp.

  int project_set_views_in_images (Bproject * project)

Sets views in particle images from the project parameter structure.

Parameters:
    *project project parameter structure.

Returns:
    int 0.

Definition at line 1082 of file mg_img_proc.cpp.

  int project_trim_class_averages (Bproject * project, Bstring & list)

Deletes selected class averages from the project..

Parameters:
    *project project parameter structure.
    &list selection list.

Returns:
    int 0.

    The new class average file name has an insert of "_del".

Definition at line 919 of file mg_img_proc.cpp.

  int project_write_particle_classes (Bproject * project)

Writes particles to different stacks based on class.

Parameters:
    *project project.

Returns:
    int error code (<0 means failure).

    Writes new particle image files, numbered by the selection number.

Definition at line 849 of file mg_img_proc.cpp.

Variable Documentation

  int verbose

Author

Generated automatically by Doxygen for Bsoft from the source code.