[][src]Trait nshare::MutNdarray3

pub trait MutNdarray3 {
    type Out;
    pub fn mut_ndarray3(self) -> Self::Out;
}

Mutably borrows a 3d type to a ndarray 2d array type.

Coordinates are in (channel, row, col), where channel is typically a color channel, or they are in (z, y, x).

This uses an associated type to avoid ambiguity for the compiler. By calling this, the compiler always knows the returned type.

Associated Types

Loading content...

Required methods

pub fn mut_ndarray3(self) -> Self::Out[src]

Loading content...

Implementations on Foreign Types

impl<'a, P> MutNdarray3 for &'a mut ImageBuffer<P, Vec<P::Subpixel>> where
    P: Pixel + 'static, 
[src]

use image::{RgbImage, Rgb};
use nshare::MutNdarray3;
use ndarray::s;

let mut vals = RgbImage::new(2, 4);
// Set all the blue channel to 255.
vals.mut_ndarray3().slice_mut(s![2, .., ..]).fill(255);
assert_eq!(vals[(0, 0)], Rgb([0, 0, 255]));

type Out = ArrayViewMut3<'a, P::Subpixel>

Loading content...

Implementors

Loading content...