rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::em::standardize_background_operation Class Referencefinal

Standardize images against the statistics of their background. More...

#include <rexlib/em/ops/preprocessing/standardize_background_operation.hpp>

Inheritance diagram for rexlib::em::standardize_background_operation:
rexlib::parametric_operation< standardize_background_operation, standardize_background_operation_traits > rexlib::basic_operation< Derived, Traits > rexlib::operation

Public Member Functions

 standardize_background_operation (ops::axis_list axes, double radius, double lower_bound, double upper_bound)
 Construct a standardization of the images along some axes.
 
double get_radius () const noexcept
 Get the radius of the region excluded from the background.
 
double get_lower_bound () const noexcept
 Get the lowest standardized value kept.
 
double get_upper_bound () const noexcept
 Get the highest standardized value kept.
 
- Public Member Functions inherited from rexlib::parametric_operation< standardize_background_operation, standardize_background_operation_traits >
 parametric_operation (Args &&... args)
 Construct the operation by constructing its parameters.
 
const parameters_type & get_parameters () const noexcept
 Get the parameters of the operation.
 
const operation_signature & get_signature () const noexcept override
 Get the signature deciding the shape and data type of the operands of this operation.
 
- Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
const operation_descriptor & get_descriptor () const noexcept override
 Get the description of this operation.
 
operation_id get_id () const noexcept override
 Get the identifier of Derived.
 
- Public Member Functions inherited from rexlib::operation
 operation (const operation &other)=delete
 
 operation (operation &&other)=delete
 
operation & operator= (const operation &other)=delete
 
operation & operator= (operation &&other)=delete
 

Additional Inherited Members

- Public Types inherited from rexlib::parametric_operation< standardize_background_operation, standardize_background_operation_traits >
using parameters_type = typename Traits::parameters_type
 
using signature_type = rule_signature< shape_rule_type, type_rule_type, parameters_type >
 
- Public Types inherited from rexlib::basic_operation< Derived, Traits >
using traits_type = Traits
 
using shape_rule_type = typename Traits::shape_rule_type
 
using type_rule_type = typename Traits::type_rule_type
 
- Static Public Member Functions inherited from rexlib::basic_operation< Derived, Traits >
static const operation_descriptor & get_static_descriptor () noexcept
 Get the description shared by every instance.
 
- Static Public Attributes inherited from rexlib::basic_operation< Derived, Traits >
static REXLIB_CONST_CONSTEXPR std::size_t output_operand_count
 
static REXLIB_CONST_CONSTEXPR std::size_t input_operand_count
 

Detailed Description

Standardize images against the statistics of their background.

An image is the part of the value along the named axes, and every other axis is a batch axis. The centre of an image is the element at index n / 2, rounded down, along each named axis. Its background holds the elements whose squared distance from the centre, in elements, exceeds the square of the radius. Images need not be square.

Each image is standardized in three steps:

  1. The mean and the standard deviation of the finite background elements are computed. The standard deviation is that of the population.
  2. They are computed again, over the finite background elements whose standardized value lies within the bounds.
  3. Each element is standardized with the second statistics. An element that is not finite, or whose standardized value lies outside the bounds, is replaced by a draw from the standard normal distribution.

Every element of the result is therefore either a standardized value within the bounds or a draw. An image without a finite background element has a mean of 0 and a standard deviation of 1. An image whose standard deviation is 0 has its mean subtracted and is not scaled.

The key is a uint64 array without core axes. It broadcasts against the batch axes of the value, so one key may serve every image or each image may have its own. A key gives one stream of draws over every element of the result it covers, so images sharing a key draw different values. The draw of an element depends only on its key and on its counter, which is the row-major position of the element among the elements of the result sharing its key. Images with keys of their own therefore draw the same values however they are batched.

The draw for counter c is a Box-Muller deviate of the Philox4x32-10 block keyed by the key. Words 0 and 1 of the block counter are the low and the high half of c / 2, rounded down, and words 2 and 3 are 0. The draw is the cosine branch when c is even, and the sine branch when c is odd.

Constructor & Destructor Documentation

◆ standardize_background_operation()

rexlib::em::standardize_background_operation::standardize_background_operation ( ops::axis_list  axes,
double  radius,
double  lower_bound,
double  upper_bound 
)

Construct a standardization of the images along some axes.

Parameters
axesThe axes of an image.
radiusThe radius of the region excluded from the background, in elements.
lower_boundThe lowest standardized value kept, in standard deviations. Minus infinity keeps every value below the mean.
upper_boundThe highest standardized value kept, in standard deviations. Infinity keeps every value above the mean.
Exceptions
std::invalid_argumentWhen an axis is repeated, when the radius is negative or NaN, or when the bounds do not lie on either side of 0.

Member Function Documentation

◆ get_lower_bound()

double rexlib::em::standardize_background_operation::get_lower_bound ( ) const
noexcept

Get the lowest standardized value kept.

Returns
double The bound, in standard deviations.

◆ get_radius()

double rexlib::em::standardize_background_operation::get_radius ( ) const
noexcept

Get the radius of the region excluded from the background.

Returns
double The radius, in elements.

◆ get_upper_bound()

double rexlib::em::standardize_background_operation::get_upper_bound ( ) const
noexcept

Get the highest standardized value kept.

Returns
double The bound, in standard deviations.

The documentation for this class was generated from the following file: