[−][src]Trait nifti::volume::element::LinearTransform
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.
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.
Implementors
impl<T> LinearTransform<T> for LinearTransformViaF32 where
T: AsPrimitive<f32>,
f32: AsPrimitive<T>,
[src]
T: AsPrimitive<f32>,
f32: AsPrimitive<T>,
pub fn linear_transform(value: T, slope: f32, intercept: f32) -> T
[src]
impl<T> LinearTransform<T> for LinearTransformViaF64 where
T: 'static + Copy + AsPrimitive<f64>,
f64: AsPrimitive<T>,
[src]
T: 'static + Copy + AsPrimitive<f64>,
f64: AsPrimitive<T>,
pub fn linear_transform(value: T, slope: f32, intercept: f32) -> T
[src]
impl<T> LinearTransform<T> for LinearTransformViaOriginal where
T: 'static + DataElement + Mul<Output = T> + Add<Output = T> + Copy,
f32: AsPrimitive<T>,
[src]
T: 'static + DataElement + Mul<Output = T> + Add<Output = T> + Copy,
f32: AsPrimitive<T>,