pub struct FourierCrop {
pub start_row: usize,
pub start_col: usize,
pub height: usize,
pub width: usize,
}Expand description
Integer rectangular region within a centered high-resolution Fourier array.
Fields§
§start_row: usizeZero-based first row in the high-resolution spectrum.
start_col: usizeZero-based first column in the high-resolution spectrum.
height: usizeNumber of rows, normally equal to the low-resolution image height.
width: usizeNumber of columns, normally equal to the low-resolution image width.
Implementations§
Source§impl FourierCrop
impl FourierCrop
Sourcepub fn new(
start_row: usize,
start_col: usize,
height: usize,
width: usize,
) -> Self
pub fn new( start_row: usize, start_col: usize, height: usize, width: usize, ) -> Self
Creates an unchecked integer crop; call Self::validate_inside before use.
Sourcepub fn validate_inside(&self, shape: (usize, usize)) -> Result<()>
pub fn validate_inside(&self, shape: (usize, usize)) -> Result<()>
Checks non-zero crop dimensions and containment in (height, width) shape.
Sourcepub fn extract<T: Copy>(
&self,
source: ArrayView2<'_, T>,
destination: &mut [T],
) -> Result<()>
pub fn extract<T: Copy>( &self, source: ArrayView2<'_, T>, destination: &mut [T], ) -> Result<()>
Extracts from a C-contiguous standard row-major view without copying the input. Nonstandard views are rejected.
Sourcepub fn validate_subpixel_inside(
&self,
shape: (usize, usize),
offset: FourierOffset,
) -> Result<()>
pub fn validate_subpixel_inside( &self, shape: (usize, usize), offset: FourierOffset, ) -> Result<()>
Checks that a bilinear stencil for offset remains inside (height, width) shape.
Sourcepub fn extract_subpixel(
&self,
source: ArrayView2<'_, Complex64>,
destination: &mut [Complex64],
offset: FourierOffset,
) -> Result<()>
pub fn extract_subpixel( &self, source: ArrayView2<'_, Complex64>, destination: &mut [Complex64], offset: FourierOffset, ) -> Result<()>
Bilinearly samples a potentially fractional crop from source.
This is a local Fourier-grid interpolation, not a bandlimited shift operator. Its approximation error grows with grid-frequency content and fractional displacement; low-bandwidth objects are the intended regime.
Sourcepub fn insert_subpixel_adjoint(
&self,
destination: ArrayViewMut2<'_, Complex64>,
update: &[Complex64],
scale: f64,
offset: FourierOffset,
) -> Result<()>
pub fn insert_subpixel_adjoint( &self, destination: ArrayViewMut2<'_, Complex64>, update: &[Complex64], scale: f64, offset: FourierOffset, ) -> Result<()>
Adds the exact adjoint of Self::extract_subpixel to destination.
Trait Implementations§
Source§impl Clone for FourierCrop
impl Clone for FourierCrop
Source§fn clone(&self) -> FourierCrop
fn clone(&self) -> FourierCrop
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FourierCrop
impl Debug for FourierCrop
Source§impl<'de> Deserialize<'de> for FourierCrop
impl<'de> Deserialize<'de> for FourierCrop
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FourierCrop
impl PartialEq for FourierCrop
Source§fn eq(&self, other: &FourierCrop) -> bool
fn eq(&self, other: &FourierCrop) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for FourierCrop
impl Serialize for FourierCrop
impl Copy for FourierCrop
impl Eq for FourierCrop
impl StructuralPartialEq for FourierCrop
Auto Trait Implementations§
impl Freeze for FourierCrop
impl RefUnwindSafe for FourierCrop
impl Send for FourierCrop
impl Sync for FourierCrop
impl Unpin for FourierCrop
impl UnsafeUnpin for FourierCrop
impl UnwindSafe for FourierCrop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more