Skip to main content

InversionConfig

Struct InversionConfig 

Source
pub struct InversionConfig {
Show 23 fields pub algorithm: InversionAlgorithm, pub tkd: TkdParams, pub tsvd: TkdParams, pub tikhonov: TikhonovParams, pub tv: TvParams, pub rts: RtsParams, pub nltv: NltvParams, pub medi: MediParams, pub tfi: TfiParams, pub ilsqr: IlsqrParams, pub star: StarParams, pub tgv: TgvParams, pub qsmart: QsmartParams, pub ndi: NdiParams, pub fansi: FansiParams, pub l1qsm: L1QsmParams, pub whqsm: WhQsmParams, pub hdqsm: HdQsmParams, pub amp_pe: AmpPeParams, pub lsqr: LsqrQsmParams, pub apply_heidi: bool, pub heidi: HeidiParams, pub tile: Option<(usize, usize)>,
}
Expand description

Dipole inversion configuration

Fields§

§algorithm: InversionAlgorithm§tkd: TkdParams§tsvd: TkdParams§tikhonov: TikhonovParams§tv: TvParams§rts: RtsParams§nltv: NltvParams§medi: MediParams§tfi: TfiParams§ilsqr: IlsqrParams§star: StarParams

STAR-QSM (te and b0 are overridden from scan metadata by the dispatcher).

§tgv: TgvParams§qsmart: QsmartParams§ndi: NdiParams§fansi: FansiParams

Shared by the Fansi (nlTV) and FansiTgv (nlTGV) algorithms; the dispatcher sets is_tgv from the selected algorithm.

§l1qsm: L1QsmParams§whqsm: WhQsmParams§hdqsm: HdQsmParams§amp_pe: AmpPeParams

AMP-PE (b0 is overridden from scan metadata by the dispatcher).

§lsqr: LsqrQsmParams

Minimally regularised LSQR (b0 is overridden from scan metadata by the dispatcher). Also HEIDI’s reference seed.

§apply_heidi: bool

HEIDI (Schweser 2012) as streaking reduction after the inversion: its cone fill (crate::inversion::heidi_cone_fill) keeps the well-conditioned k-space of the method’s χ and refills the dipole cone under a field-derived weighted-TV prior. With InversionAlgorithm::Lsqr this is HEIDI as published, run as the authors’ pipeline runs it (crate::inversion::heidi(): the unmasked LSQR seed on LSQR’s grid). Other seeds: see the HEIDI module docs (Any seed), the heidi.* rules and heidi_seed_problem.

§heidi: HeidiParams

HEIDI’s parameters, used with Self::apply_heidi.

§tile: Option<(usize, usize)>

Overlap-tiling for the deep-learning inversions, as (core, halo) in voxels. None (default) runs the net whole-volume; Some runs it patch-by-patch (bounded memory) via the *_tiled variants — an approximation, mainly for memory-constrained targets (e.g. WASM). Stored as a plain tuple so this config type stays available without the onnx feature; the dispatcher converts it to a crate::inversion::TileConfig. Ignored by the natively-patch-based nets (autoqsm/qsmgan) and by non-DL algorithms.

Implementations§

Source§

impl InversionConfig

Source

pub fn input(&self, n_echoes: usize) -> InversionInput

What the selected inversion reconstructs from, for data with n_echoes echoes. See InversionInput.

It is a property of the config rather than of InversionAlgorithm alone, because TGV depends on more than its name:

  • TGV (run_tgv) reconstructs multi-echo data from the field-mapped total field (TgvInput::FieldPpm, expressed as phase at the first echo time) and a single echo from its wrapped phase (TgvInput::WrappedPhase). Either way it does its own background removal.

The other total-field methods are TFI (a total-field method by definition: it inverts the field over the whole FOV under a preconditioner), QSMART (run_qsmart, whose two SDF stages are its background removal), AutoQSM and NeXtQSM (networks with their own background removal). iQSM and iQSM+ (run_iqsm, run_iqsm_plus) take wrapped phase. Every other method, including WH-QSM (which models only a residual harmonic field) and LSQR (a residual-field term), takes the local field.

MEDI takes the local field with every option: plain MEDI, MEDI-SMV (MediParams::smv) and MEDI-mSMV (MediParams::msmv). That is how the MEDI authors run it. MEDI toolbox README.m runs RDF = PDF(iFreq, N_std, Mask, ...) and then MEDI_L1('lambda',1000,'lambda_CSF',100,'merit','smv',5) on RDF, which its naming convention defines as the local field. MEDI_L1 reads iFreq but never uses it. The mSMV paper (Roberts et al. 2024, Eqs. 4 and 13) defines MEDI-SMV as the SMV high-pass of the local field after PDF, and SEPIA passes MEDI its local field. The SMV step removes the residual background that a background removal leaves near the brain edge. It is not a background removal itself. On the total field, MEDI-SMV is a different pipeline. With the default mask shrinking it gives nearly the same χ, but without shrinking it fails (see the MEDI module docs). The authors’ pipeline uses PDF for the background removal (reference_bg_removal).

Source

pub fn cone_fill_after(&self) -> bool

Whether HEIDI’s cone fill runs on the method’s result after the inversion, rather than inside it: Self::apply_heidi with any seed but LSQR, whose reference recipe (crate::inversion::heidi()) run_dipole_inversion runs as one step. run_dipole_inversion applies it either way. A host that combines several inversions (two-pass) instead runs them with apply_heidi off and fills the combined map once with run_heidi_cone_fill, whatever the seed (an LSQR map is then filled as the method’s masked result, as Wrapper_QSM_HEIDI4all fills any seed).

Source

pub fn reference_bg_removal(&self) -> Option<BgRemovalAlgorithm>

The background removal the selected method’s authors run in front of it, for a InversionInput::LocalField method whose authors’ pipeline QSM.rs ports. Hosts can use it as the default background removal for that method.

  • MEDI (with or without SMV or mSMV): BgRemovalAlgorithm::Pdf. The MEDI toolbox’s README.m runs PDF.m (ported as BgRemovalAlgorithm::Pdf, with the same Fit_ppm_complex noise weighting) and gives MEDI_L1 its result. The mSMV paper (Roberts et al. 2024) also runs MEDI-SMV and MEDI-mSMV after PDF.

None when no such pipeline is recorded for the method. It is then the host’s choice.

Trait Implementations§

Source§

impl Clone for InversionConfig

Source§

fn clone(&self) -> InversionConfig

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 InversionConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for InversionConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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.