use crate::linalg::{Matrix, Scalar};
#[cfg(feature = "arrayfire")]
pub mod arrayfire_image;
#[cfg(feature = "arrayfire")]
pub type Image = arrayfire_image::Image;
#[cfg(all(feature = "nalgebra", not(feature = "arrayfire")))]
pub mod nalgebra_image;
#[cfg(all(feature = "nalgebra", not(feature = "arrayfire")))]
pub type Image = nalgebra_image::Image;
#[cfg(all(feature = "ndarray", not(feature = "arrayfire"), not(feature = "nalgebra")))]
pub mod ndarray_image;
#[cfg(all(feature = "ndarray", not(feature = "arrayfire"), not(feature = "nalgebra")))]
pub type Image = ndarray_image::Image;
pub trait ImageTrait {
fn zeros(nrow: usize, ncol: usize, nchan: usize, samples: usize) -> Self;
fn constant(nrow: usize, ncol: usize, nchan: usize, samples: usize, value: Scalar) -> Self;
fn random_uniform(
nrow: usize,
ncol: usize,
nchan: usize,
samples: usize,
min: Scalar,
max: Scalar,
) -> Self;
fn random_normal(
nrow: usize,
ncol: usize,
nchan: usize,
samples: usize,
mean: Scalar,
stddev: Scalar,
) -> Self;
fn from_fn<F>(nrows: usize, ncols: usize, nchan: usize, samples: usize, f: F) -> Self
where
F: FnMut(usize, usize, usize, usize) -> Scalar;
fn from_samples(samples: &Matrix, channels: usize) -> Self;
fn component_add(&self, other: &Self) -> Self;
fn component_sub(&self, other: &Self) -> Self;
fn component_mul(&self, other: &Self) -> Self;
fn component_div(&self, other: &Self) -> Self;
fn scalar_add(&self, scalar: Scalar) -> Self;
fn scalar_sub(&self, scalar: Scalar) -> Self;
fn scalar_mul(&self, scalar: Scalar) -> Self;
fn scalar_div(&self, scalar: Scalar) -> Self;
fn cross_correlate(&self, kernels: &Self) -> Self;
fn convolve_full(&self, kernels: &Self) -> Self;
fn flatten(&self) -> Matrix;
fn image_dims(&self) -> (usize, usize, usize);
fn channels(&self) -> usize;
fn samples(&self) -> usize;
fn get_sample(&self, sample: usize) -> Self;
fn get_channel(&self, channel: usize) -> Self;
fn get_channel_across_samples(&self, channel: usize) -> Self;
fn sum_samples(&self) -> Self;
fn join_channels(channels: Vec<Self>) -> Self
where
Self: Sized;
fn join_samples(samples: Vec<Self>) -> Self
where
Self: Sized;
fn wrap(&self, ox: usize, oy: usize, wx: usize, wy: usize, sx: usize, sy: usize, px: usize, py: usize) -> Self;
fn unwrap(&self, wx: usize, wy: usize, sx: usize, sy: usize, px: usize, py: usize) -> Self;
fn tile(&self, repetitions_row: usize, repetitions_col: usize, repetitions_chan: usize, repetition_sample: usize) -> Self;
fn square(&self) -> Self;
fn sum(&self) -> Scalar;
fn mean(&self) -> Scalar;
fn mean_along(&self, dim: usize) -> Self;
fn exp(&self) -> Self;
fn maxof(&self, other: &Self) -> Self;
fn sign(&self) -> Self;
fn minof(&self, other: &Self) -> Self;
fn sqrt(&self) -> Self;
}