rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
rexlib::em Namespace Reference

Operations for CryoEM and CryoET image processing. More...

Classes

class  ctf_optics
 Constants of a microscope that the contrast transfer function depends on. More...
 
struct  em_component
 Component tag for the CryoEM operations. More...
 
class  gridding_window
 Separable window that spreads a sample over the voxels of a grid. More...
 
class  insert_ctf_slices_operation
 Insert the spectra of projections into the spectrum of a volume, weighted by their contrast transfer function. More...
 
class  insert_slices_operation
 Insert the spectra of projections into the spectrum of a volume. More...
 
class  insert_weighted_slices_operation
 Insert the spectra of projections into the spectrum of a volume, with a denominator weight per frequency. More...
 
class  standardize_background_operation
 Standardize images against the statistics of their background. More...
 

Typedefs

using volume_half_spectrum_core = core_dimensions< axis_same_as< 0 >, axis_same_as< 0 >, ops::axis_half_spectrum_of< 0 > >
 Core axes of the half spectrum of a cubic volume.
 
using slice_half_spectrum_core = core_dimensions< axis_same_as< 1 >, ops::axis_half_spectrum_of< 1 > >
 Core axes of the half spectrum of a square slice.
 
using slice_transform_core = core_dimensions< axis_same_as< 2 >, axis_same_as< 3 > >
 Core axes of a 3x4 transform.
 
using slice_radial_core = core_dimensions< ops::axis_half_spectrum_of< 1 > >
 Core axes of a weight per frequency shell of a slice.
 
using slice_ctf_core = core_dimensions< axis_same_as< 3 > >
 Core axes of the four CTF parameters of a slice.
 
using slice_insertion_pivots = type_list< extent_from_inputs< positive_extent_domain >, extent_from_inputs< positive_extent_domain >, extent_fixed< 3 >, extent_fixed< 4 > >
 Extent variables of the slice insertions.
 
using slice_insertion_type_domain = domain_union< single_type_domain< numerical_type::float32 >, single_type_domain< numerical_type::float64 > >
 Element types of the slice insertions.
 
using slice_insertion_shape_rule = operand_shape_rule< slice_insertion_pivots, type_list< volume_half_spectrum_core, volume_half_spectrum_core >, type_list< volume_half_spectrum_core, volume_half_spectrum_core, slice_half_spectrum_core, slice_transform_core, slice_radial_core >, trailing_core, output_batch::accumulated >
 Shape rule of insert_slices_operation.
 
using slice_insertion_type_rule = operand_type_rule< type_list< pivot_from_input< 1, slice_insertion_type_domain > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 >, slot_complex_of< 0 >, slot_same_as< 0 >, slot_same_as< 0 > > >
 Type rule of insert_slices_operation.
 
using weighted_slice_insertion_shape_rule = operand_shape_rule< slice_insertion_pivots, type_list< volume_half_spectrum_core, volume_half_spectrum_core >, type_list< volume_half_spectrum_core, volume_half_spectrum_core, slice_half_spectrum_core, slice_half_spectrum_core, slice_transform_core, slice_radial_core >, trailing_core, output_batch::accumulated >
 Shape rule of insert_weighted_slices_operation.
 
using weighted_slice_insertion_type_rule = operand_type_rule< type_list< pivot_from_input< 1, slice_insertion_type_domain > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 >, slot_complex_of< 0 >, slot_same_as< 0 >, slot_same_as< 0 >, slot_same_as< 0 > > >
 Type rule of insert_weighted_slices_operation.
 
using ctf_slice_insertion_shape_rule = operand_shape_rule< slice_insertion_pivots, type_list< volume_half_spectrum_core, volume_half_spectrum_core >, type_list< volume_half_spectrum_core, volume_half_spectrum_core, slice_half_spectrum_core, slice_transform_core, slice_ctf_core, slice_radial_core >, trailing_core, output_batch::accumulated >
 Shape rule of insert_ctf_slices_operation.
 
using ctf_slice_insertion_type_rule = operand_type_rule< type_list< pivot_from_input< 1, slice_insertion_type_domain > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 > >, type_list< slot_complex_of< 0 >, slot_same_as< 0 >, slot_complex_of< 0 >, slot_same_as< 0 >, slot_same_as< 0 >, slot_same_as< 0 > > >
 Type rule of insert_ctf_slices_operation.
 

Enumerations

enum class  gridding_profile { box , triangle , kaiser_bessel }
 Shape of the one-dimensional window of a gridding_window. More...
 

Functions

array standardize_background (const_array_ref value, const_array_ref key, span< const std::ptrdiff_t > axes, double radius, double lower_bound, double upper_bound, const execution_context &context, array *out=nullptr)
 Standardize images against the statistics of their background.
 
array standardize_background_2d (const_array_ref value, const_array_ref key, double radius, double lower_bound, double upper_bound, const execution_context &context, array *out=nullptr)
 Standardize images held in the last two axes against the statistics of their background.
 
array standardize_background_3d (const_array_ref value, const_array_ref key, double radius, double lower_bound, double upper_bound, const execution_context &context, array *out=nullptr)
 Standardize volumes held in the last three axes against the statistics of their background.
 
std::pair< array, array > insert_slices (const_array_ref numerator, const_array_ref denominator, const_array_ref slices, const_array_ref transforms, const_array_ref radial_weights, const gridding_window &window, const execution_context &context, array *numerator_out=nullptr, array *denominator_out=nullptr)
 Insert the spectra of projections into the spectrum of a volume.
 
std::pair< array, array > insert_weighted_slices (const_array_ref numerator, const_array_ref denominator, const_array_ref slices, const_array_ref weights, const_array_ref transforms, const_array_ref radial_weights, const gridding_window &window, const execution_context &context, array *numerator_out=nullptr, array *denominator_out=nullptr)
 Insert the spectra of projections into the spectrum of a volume, with a denominator weight per frequency.
 
std::pair< array, array > insert_ctf_slices (const_array_ref numerator, const_array_ref denominator, const_array_ref slices, const_array_ref transforms, const_array_ref ctf, const_array_ref radial_weights, const gridding_window &window, const ctf_optics &optics, double pixel_size, const execution_context &context, array *numerator_out=nullptr, array *denominator_out=nullptr)
 Insert the spectra of projections into the spectrum of a volume, weighted by their contrast transfer function.
 
const char * to_string (gridding_profile profile) noexcept
 
std::ostream & operator<< (std::ostream &os, gridding_profile profile)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (standardize_background, em_component, REXLIB_OPERANDS("result"), REXLIB_OPERANDS("value", "key"), ops::keyed_axiswise_shape_rule, ops::axis_selection, ops::keyed_unary_homogeneous_rule< floating_point_type_domain >)
 
 REXLIB_DECLARE_OPERATION_TRAITS (insert_ctf_slices, em_component, REXLIB_OPERANDS("numerator", "denominator"), REXLIB_OPERANDS("numerator", "denominator", "slice", "transform", "ctf", "radial_weight"), ctf_slice_insertion_shape_rule, ctf_slice_insertion_type_rule)
 
 REXLIB_DECLARE_OPERATION_TRAITS (insert_slices, em_component, REXLIB_OPERANDS("numerator", "denominator"), REXLIB_OPERANDS("numerator", "denominator", "slice", "transform", "radial_weight"), slice_insertion_shape_rule, slice_insertion_type_rule)
 
 REXLIB_DECLARE_OPERATION_TRAITS (insert_weighted_slices, em_component, REXLIB_OPERANDS("numerator", "denominator"), REXLIB_OPERANDS("numerator", "denominator", "slice", "weight", "transform", "radial_weight"), weighted_slice_insertion_shape_rule, weighted_slice_insertion_type_rule)
 

Detailed Description

Operations for CryoEM and CryoET image processing.

Enumeration Type Documentation

◆ gridding_profile

Shape of the one-dimensional window of a gridding_window.

The window phi(d) weighs a voxel at a signed distance d from a sample, in voxels, along one axis. It is 0 for |d| >= w, where w is the half-width of the window.

Enumerator
box 

Weight 1 on the voxel nearest to the sample, 0 elsewhere.

The half-width is 1/2. A sample halfway between two voxels goes to the one farther from 0.

triangle 

Weight 1 - |d|.

The half-width is 1, so a sample reaches the two voxels around it.

kaiser_bessel 

Weight I0(beta sqrt(1 - (d / w)^2)) / I0(beta).

The half-width w and the shape beta are those of the window. I0 is the modified Bessel function of the first kind and order 0.

Function Documentation

◆ insert_ctf_slices()

std::pair< array, array > rexlib::em::insert_ctf_slices ( const_array_ref  numerator,
const_array_ref  denominator,
const_array_ref  slices,
const_array_ref  transforms,
const_array_ref  ctf,
const_array_ref  radial_weights,
const gridding_window &  window,
const ctf_optics &  optics,
double  pixel_size,
const execution_context &  context,
array *  numerator_out = nullptr,
array *  denominator_out = nullptr 
)

Insert the spectra of projections into the spectrum of a volume, weighted by their contrast transfer function.

Pass the accumulators as numerator_out and denominator_out to update them in place.

Parameters
numeratorThe complex accumulator of the slices, with the core axes (N, N, N / 2 + 1).
denominatorThe real accumulator of the weights, with the core axes (N, N, N / 2 + 1).
slicesThe half spectra of the projections, with the core axes (n, n / 2 + 1).
transformsThe 3x4 transforms from the volume to each projection.
ctfThe defocus along and across the astigmatism, in angstroms, the angle of the astigmatism and the phase shift, in radians, of each projection, with the core axis (4).
radial_weightsThe weight of each frequency shell, with the core axis (n / 2 + 1).
windowThe window that spreads a sample over the voxels.
opticsThe optics of the microscope.
pixel_sizeThe size of a pixel of the projections, in angstroms.
contextThe execution context used for dispatching.
numerator_outOptional output parameter to be re-used for the numerator.
denominator_outOptional output parameter to be re-used for the denominator.
Returns
std::pair<array, array> The numerator and the denominator.
Exceptions
std::invalid_argumentWhen the pixel size is not finite and positive.
See also
insert_ctf_slices_operation

◆ insert_slices()

std::pair< array, array > rexlib::em::insert_slices ( const_array_ref  numerator,
const_array_ref  denominator,
const_array_ref  slices,
const_array_ref  transforms,
const_array_ref  radial_weights,
const gridding_window &  window,
const execution_context &  context,
array *  numerator_out = nullptr,
array *  denominator_out = nullptr 
)

Insert the spectra of projections into the spectrum of a volume.

Pass the accumulators as numerator_out and denominator_out to update them in place.

Parameters
numeratorThe complex accumulator of the slices, with the core axes (N, N, N / 2 + 1).
denominatorThe real accumulator of the weights, with the core axes (N, N, N / 2 + 1).
slicesThe half spectra of the projections, with the core axes (n, n / 2 + 1).
transformsThe 3x4 transforms from the volume to each projection.
radial_weightsThe weight of each frequency shell, with the core axis (n / 2 + 1).
windowThe window that spreads a sample over the voxels.
contextThe execution context used for dispatching.
numerator_outOptional output parameter to be re-used for the numerator.
denominator_outOptional output parameter to be re-used for the denominator.
Returns
std::pair<array, array> The numerator and the denominator.
See also
insert_slices_operation

◆ insert_weighted_slices()

std::pair< array, array > rexlib::em::insert_weighted_slices ( const_array_ref  numerator,
const_array_ref  denominator,
const_array_ref  slices,
const_array_ref  weights,
const_array_ref  transforms,
const_array_ref  radial_weights,
const gridding_window &  window,
const execution_context &  context,
array *  numerator_out = nullptr,
array *  denominator_out = nullptr 
)

Insert the spectra of projections into the spectrum of a volume, with a denominator weight per frequency.

Pass the accumulators as numerator_out and denominator_out to update them in place.

Parameters
numeratorThe complex accumulator of the slices, with the core axes (N, N, N / 2 + 1).
denominatorThe real accumulator of the weights, with the core axes (N, N, N / 2 + 1).
slicesThe half spectra of the projections, with the core axes (n, n / 2 + 1).
weightsThe real denominator weight of each frequency of the slices, with the core axes (n, n / 2 + 1).
transformsThe 3x4 transforms from the volume to each projection.
radial_weightsThe weight of each frequency shell, with the core axis (n / 2 + 1).
windowThe window that spreads a sample over the voxels.
contextThe execution context used for dispatching.
numerator_outOptional output parameter to be re-used for the numerator.
denominator_outOptional output parameter to be re-used for the denominator.
Returns
std::pair<array, array> The numerator and the denominator.
See also
insert_weighted_slices_operation

◆ standardize_background()

array rexlib::em::standardize_background ( const_array_ref  value,
const_array_ref  key,
span< const std::ptrdiff_t >  axes,
double  radius,
double  lower_bound,
double  upper_bound,
const execution_context &  context,
array *  out = nullptr 
)

Standardize images against the statistics of their background.

Parameters
valueThe images. Their axes are the named ones, and every other axis is a batch axis.
keyThe uint64 keys of the draws replacing elements. It has no image axes and broadcasts against the batch axes of value.
axesThe axes of an image. Negative values refer to axes from the end.
radiusThe radius of the region excluded from the background, in elements.
lower_boundThe lowest standardized value kept, in standard deviations.
upper_boundThe highest standardized value kept, in standard deviations.
contextThe execution context used for dispatching.
outOptional output parameter to be re-used.
Returns
array The standardized images.
See also
standardize_background_operation

◆ standardize_background_2d()

array rexlib::em::standardize_background_2d ( const_array_ref  value,
const_array_ref  key,
double  radius,
double  lower_bound,
double  upper_bound,
const execution_context &  context,
array *  out = nullptr 
)

Standardize images held in the last two axes against the statistics of their background.

Parameters
valueThe images, in its last two axes. Every other axis is a batch axis.
keyThe uint64 keys of the draws replacing elements. It has no image axes and broadcasts against the batch axes of value.
radiusThe radius of the region excluded from the background, in elements.
lower_boundThe lowest standardized value kept, in standard deviations.
upper_boundThe highest standardized value kept, in standard deviations.
contextThe execution context used for dispatching.
outOptional output parameter to be re-used.
Returns
array The standardized images.
Exceptions
std::invalid_argumentWhen value has fewer than two axes.
See also
standardize_background_operation

◆ standardize_background_3d()

array rexlib::em::standardize_background_3d ( const_array_ref  value,
const_array_ref  key,
double  radius,
double  lower_bound,
double  upper_bound,
const execution_context &  context,
array *  out = nullptr 
)

Standardize volumes held in the last three axes against the statistics of their background.

Parameters
valueThe volumes, in its last three axes. Every other axis is a batch axis.
keyThe uint64 keys of the draws replacing elements. It has no volume axes and broadcasts against the batch axes of value.
radiusThe radius of the region excluded from the background, in elements.
lower_boundThe lowest standardized value kept, in standard deviations.
upper_boundThe highest standardized value kept, in standard deviations.
contextThe execution context used for dispatching.
outOptional output parameter to be re-used.
Returns
array The standardized volumes.
Exceptions
std::invalid_argumentWhen value has fewer than three axes.
See also
standardize_background_operation