pub trait ImageArray<P: Pixel, ImageContainer> {
// Required methods
fn as_ndarray<'a>(&'a self) -> ArrayView3<'a, ImageContainer>;
fn as_ndarray_mut<'a>(&'a mut self) -> ArrayViewMut3<'a, ImageContainer>;
fn to_ndarray(self) -> Array3<ImageContainer>;
fn from_ndarray<D: Dimension>(
array: Array<ImageContainer, D>,
) -> Result<ImageBuffer<P, Vec<ImageContainer>>, Error>;
}Expand description
Conversion methods for working with ndarrays.
All methods work without copying any data.
Required Methods§
Sourcefn as_ndarray<'a>(&'a self) -> ArrayView3<'a, ImageContainer>
fn as_ndarray<'a>(&'a self) -> ArrayView3<'a, ImageContainer>
Cast the ImageBuffer as an ArrayView3.
Yindex is the rowXindex is the columnsZindex is the channel
So when referencing:
array[[y, x, z]]
This does not copy the data, as it is a reference to the actual data in the buffer.
Sourcefn as_ndarray_mut<'a>(&'a mut self) -> ArrayViewMut3<'a, ImageContainer>
fn as_ndarray_mut<'a>(&'a mut self) -> ArrayViewMut3<'a, ImageContainer>
Cast the ImageBuffer as an ArrayViewMut3.
Yindex is the rowXindex is the columnsZindex is the channel
So when referencing:
array[[y, x, z]]
This does not copy the data, as it is a reference to the actual data in the buffer.
Sourcefn to_ndarray(self) -> Array3<ImageContainer>
fn to_ndarray(self) -> Array3<ImageContainer>
Interpret the ImageBuffer as an Array3.
Yindex is the rowXindex is the columnsZindex is the channel
So when referencing:
array[[y, x, z]]
This does not copy the data, but it does consume the buffer.
Sourcefn from_ndarray<D: Dimension>(
array: Array<ImageContainer, D>,
) -> Result<ImageBuffer<P, Vec<ImageContainer>>, Error>
fn from_ndarray<D: Dimension>( array: Array<ImageContainer, D>, ) -> Result<ImageBuffer<P, Vec<ImageContainer>>, Error>
Convert the provided array into the ImageBuffer
Yindex is the rowXindex is the columnsZindex is the channel
So when referencing:
array[[y, x, z]]
This does not copy the data, but it does consume the buffer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<P, C> ImageArray<P, C> for ImageBuffer<P, Vec<C>>
Available on crate feature image only.
impl<P, C> ImageArray<P, C> for ImageBuffer<P, Vec<C>>
image only.