Skip to main content

EchoQuality

Struct EchoQuality 

Source
pub struct EchoQuality {
    pub downweighted_fraction: Vec<f64>,
    pub rejected_fraction: Vec<f64>,
    pub median_weight: Vec<f64>,
    pub median_abs_residual_rad: Vec<f64>,
    pub outlier_score: Vec<f64>,
    pub voxels_examined: usize,
    pub flagged: Vec<usize>,
}
Expand description

Per-echo evidence that an echo did not fit the model the others agree on.

Read Self::voxels_examined before trusting a clean report: every statistic here is taken over the mask, so a mask that selects nothing yields a perfect bill of health.

The per-echo fields are one value per echo, in input order. These are diagnostics: the robust fit has already acted on the per-voxel weights these summarise, and nothing here drops an echo or changes a field map. Deciding to re-acquire, exclude an echo and refit, or accept the map is the caller’s.

Fields§

§downweighted_fraction: Vec<f64>

Fraction of in-mask voxels where this echo’s robust weight fell below RobustFitParams::downweight_level.

The headline number. A clean echo sits near the rate the loss produces on pure noise (a few per cent for Huber at the default tuning); a corrupted one is far above it. Read it relative to the other echoes in the same series, not against an absolute threshold — the baseline moves with SNR, echo count and how much real signal departs from a straight line.

§rejected_fraction: Vec<f64>

Fraction of in-mask voxels where the weight reached exactly zero. Always 0 for RobustLoss::Huber, which never rejects; the number that matters for RobustLoss::Tukey, where it is the fraction of the volume that echo contributed nothing to.

§median_weight: Vec<f64>

Median robust weight over the mask. 1.0 means untouched.

§median_abs_residual_rad: Vec<f64>

Median absolute residual over the mask, in radians, at the final fit. Unlike the fractions above this is a physical quantity, so it is comparable between runs.

§outlier_score: Vec<f64>

The quantity flagging is decided on: this echo’s 90th-percentile magnitude-weighted absolute residual at the final fit.

Two choices in that sentence, both of which were measured rather than assumed.

At the final fit, because by then a rejected echo carries almost no weight, so its residual is close to what it would be had the model been fitted without it. An in-fit residual shrinks toward zero for whichever echo is pulling the fit hardest, which is precisely the echo you are trying to catch.

90th percentile rather than the median, because corruption need not cover the volume. An echo wrong over a third of the brain still has a perfectly ordinary median, since its median sits in the two thirds that are fine, and the corrupted echo then scores barely more than its neighbours. A high quantile reaches into the affected part while still ignoring the handful of voxels any echo has trouble with. Swapping this back to a median is caught by the tests, which is the cheapest way to see what it is buying.

§voxels_examined: usize

How many voxels were actually examined — the size of the mask this was run over.

Present so that “nothing was flagged” can be told apart from “nothing was looked at”. Every other field here is a statistic over the mask, so an empty mask produces a flawless report: no echo flagged, no voxel downweighted, every score zero. That is the shape of result a failed brain extraction upstream produces, and it is indistinguishable from a clean series unless something says how much was weighed. Check this before believing a clean report; 0 means the report is vacuous, not good.

§flagged: Vec<usize>

Echoes the series’ own spread of Self::outlier_score says are out of line.

Empty unless the worst score exceeds the best by RobustFitParams::flag_ratio; when it does, this names the worst echo and any other scoring within 80% of it, so a series with two genuinely bad echoes reports both. Nothing is dropped and no field map changes as a result — see the type-level note on these being diagnostics.

Implementations§

Source§

impl EchoQuality

Source

pub fn len(&self) -> usize

Number of echoes described.

Source

pub fn is_empty(&self) -> bool

Whether no echoes are described.

Source

pub fn worst(&self) -> Option<(usize, f64)>

The echo with the largest Self::downweighted_fraction, and that fraction.

On a clean series this still names an echo — one of them has to be the worst. Compare it against the rest before reading anything into it.

Trait Implementations§

Source§

impl Clone for EchoQuality

Source§

fn clone(&self) -> EchoQuality

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EchoQuality

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.