[][src]Trait nifti::volume::element::LinearTransform

pub trait LinearTransform<T: 'static + Copy> {
    pub fn linear_transform(value: T, slope: f32, intercept: f32) -> T;

    pub fn linear_transform_many(
        value: &[T],
        slope: f32,
        intercept: f32
    ) -> Vec<T> { ... }
pub fn linear_transform_many_inline(
        value: &mut [T],
        slope: f32,
        intercept: f32
    ) { ... } }

Interface for linear (affine) transformations to values. Multiple implementations are needed because the original type T may not have enough precision to obtain an appropriate outcome. For example, transforming a u8 is always done through f32, but an f64 is instead manipulated through its own type by first converting the slope and intercept arguments to f64.

Required methods

pub fn linear_transform(value: T, slope: f32, intercept: f32) -> T

Linearly transform a value with the given slope and intercept.

Loading content...

Provided methods

pub fn linear_transform_many(value: &[T], slope: f32, intercept: f32) -> Vec<T>

Linearly transform a sequence of values with the given slope and intercept into a vector.

pub fn linear_transform_many_inline(value: &mut [T], slope: f32, intercept: f32)

Linearly transform a sequence of values inline, with the given slope and intercept.

Loading content...

Implementors

impl<T> LinearTransform<T> for LinearTransformViaF32 where
    T: AsPrimitive<f32>,
    f32: AsPrimitive<T>, 
[src]

impl<T> LinearTransform<T> for LinearTransformViaF64 where
    T: 'static + Copy + AsPrimitive<f64>,
    f64: AsPrimitive<T>, 
[src]

impl<T> LinearTransform<T> for LinearTransformViaOriginal where
    T: 'static + DataElement + Mul<Output = T> + Add<Output = T> + Copy,
    f32: AsPrimitive<T>, 
[src]

Loading content...