|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Standardize images against the statistics of their background. More...
#include <rexlib/em/ops/preprocessing/standardize_background_operation.hpp>
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 |
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:
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.
| 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.
| axes | The axes of an image. |
| radius | The radius of the region excluded from the background, in elements. |
| lower_bound | The lowest standardized value kept, in standard deviations. Minus infinity keeps every value below the mean. |
| upper_bound | The highest standardized value kept, in standard deviations. Infinity keeps every value above the mean. |
| std::invalid_argument | When an axis is repeated, when the radius is negative or NaN, or when the bounds do not lie on either side of 0. |
|
noexcept |
Get the lowest standardized value kept.
|
noexcept |
Get the radius of the region excluded from the background.
|
noexcept |
Get the highest standardized value kept.