pub struct FeatureView<'a> { /* private fields */ }Expand description
Named view over a flat feature vector.
Provides ergonomic access to features by name, scale, and channel without changing the underlying storage format.
let result = z.compute_all_features(&src, &dst)?;
let view = FeatureView::new(result.features(), 4)?;
let ssim_mean_s0_y = view.ssim_mean(0, 1);
let ssim_max_s2_x = view.ssim_max(0, 2).unwrap();Implementations§
Source§impl<'a> FeatureView<'a>
impl<'a> FeatureView<'a>
Sourcepub fn new(features: &'a [f64], n_scales: usize) -> Option<Self>
pub fn new(features: &'a [f64], n_scales: usize) -> Option<Self>
Create a view over a feature vector.
Automatically detects the tier (peaks/extended) from length.
Returns None if the length doesn’t match any valid layout.
Peaks are always present (basic-only 156-element vectors are no longer generated).
Sourcepub fn has_masked(&self) -> bool
pub fn has_masked(&self) -> bool
Whether masked features are present.
Sourcepub fn hf_energy_loss(&self, scale: usize, ch: usize) -> f64
pub fn hf_energy_loss(&self, scale: usize, ch: usize) -> f64
High-frequency energy loss ratio.
Sourcepub fn hf_mag_loss(&self, scale: usize, ch: usize) -> f64
pub fn hf_mag_loss(&self, scale: usize, ch: usize) -> f64
High-frequency magnitude loss ratio.
Sourcepub fn hf_energy_gain(&self, scale: usize, ch: usize) -> f64
pub fn hf_energy_gain(&self, scale: usize, ch: usize) -> f64
High-frequency energy gain ratio.
Sourcepub fn det_max(&self, scale: usize, ch: usize) -> Option<f64>
pub fn det_max(&self, scale: usize, ch: usize) -> Option<f64>
Edge detail lost, pixel-wise max.
Sourcepub fn ssim_l8(&self, scale: usize, ch: usize) -> Option<f64>
pub fn ssim_l8(&self, scale: usize, ch: usize) -> Option<f64>
SSIM error, L8 norm (Σd⁸/N)^(1/8).
Sourcepub fn masked_ssim_mean(&self, scale: usize, ch: usize) -> Option<f64>
pub fn masked_ssim_mean(&self, scale: usize, ch: usize) -> Option<f64>
Masked SSIM error, mean pooling.
Sourcepub fn masked_ssim_4th(&self, scale: usize, ch: usize) -> Option<f64>
pub fn masked_ssim_4th(&self, scale: usize, ch: usize) -> Option<f64>
Masked SSIM error, L4 norm.
Sourcepub fn masked_ssim_2nd(&self, scale: usize, ch: usize) -> Option<f64>
pub fn masked_ssim_2nd(&self, scale: usize, ch: usize) -> Option<f64>
Masked SSIM error, L2 norm.
Sourcepub fn masked_art_4th(&self, scale: usize, ch: usize) -> Option<f64>
pub fn masked_art_4th(&self, scale: usize, ch: usize) -> Option<f64>
Masked edge artifact, L4 norm.
Sourcepub fn masked_det_4th(&self, scale: usize, ch: usize) -> Option<f64>
pub fn masked_det_4th(&self, scale: usize, ch: usize) -> Option<f64>
Masked edge detail lost, L4 norm.
Sourcepub fn scored_features(&self) -> &[f64]
pub fn scored_features(&self) -> &[f64]
Get the scored features slice (first N features, WEIGHTS-compatible).
Sourcepub fn peak_features(&self) -> Option<&[f64]>
pub fn peak_features(&self) -> Option<&[f64]>
Get the peak features slice, if present.
Sourcepub fn masked_features(&self) -> Option<&[f64]>
pub fn masked_features(&self) -> Option<&[f64]>
Get the masked features slice, if present.
Trait Implementations§
Source§impl<'a> Clone for FeatureView<'a>
impl<'a> Clone for FeatureView<'a>
Source§fn clone(&self) -> FeatureView<'a>
fn clone(&self) -> FeatureView<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for FeatureView<'a>
impl<'a> RefUnwindSafe for FeatureView<'a>
impl<'a> Send for FeatureView<'a>
impl<'a> Sync for FeatureView<'a>
impl<'a> Unpin for FeatureView<'a>
impl<'a> UnsafeUnpin for FeatureView<'a>
impl<'a> UnwindSafe for FeatureView<'a>
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,
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