Skip to main content

Problem

Struct Problem 

Source
struct Problem {
Show 16 fields dims: (usize, usize, usize), n: usize, dims0: (usize, usize, usize), pad: [usize; 3], vs: [f64; 3], m: Vec<u8>, inside: Support, drp: f64, drn: f64, d: Kernel, w_i: Vec<f64>, b1: Vec<f64>, xm: BoxVol, rm: BoxVol, wg_thr: [[(f64, f64); 3]; 2], cone: Support,
}
Expand description

The arrays of one run, on the padded grid. What is fixed across the NNLS iterations is kept in the least memory that gives the same numbers (see Performance in the module docs).

Fields§

§dims: (usize, usize, usize)§n: usize§dims0: (usize, usize, usize)

input grid and padding

§pad: [usize; 3]§vs: [f64; 3]§m: Vec<u8>

mask (0/1)

§inside: Support

the mask’s voxels

§drp: f64

D_r,± in ppm

§drn: f64§d: Kernel

dipole kernel (dipole_kernel(..., 'kspace'))

§w_i: Vec<f64>

step 1’s data weight W_I at the mask’s voxels: w_mag = W_I.*m there, 0 elsewhere, and w_phs = 2π·w_mag

§b1: Vec<f64>

step 1’s right-hand side, [b+; b−]

§xm: BoxVol

step 2’s gradient weights are recomputed where used from the masked fast QSM and smoothed R2′ (zero outside the mask, so kept on its bounding box) and their percentiles (lo, hi) per source and axis

§rm: BoxVol§wg_thr: [[(f64, f64); 3]; 2]§cone: Support

step 2’s cone |D| < D2_thr

Implementations§

Source§

impl Problem

Source

fn new( inputs: &ChiSepIlsqrInputs<'_>, grid: &Grid, bdir: (f64, f64, f64), params: &ChiSepIlsqrParams, ) -> (Self, Workspace, Vec<f64>)

The problem, the FFT workspace, and R2′ (ppm, clamped) on the padded grid for the start.

Source

fn pad_input<T: Copy + Default>(&self, a: &[T]) -> Vec<T>

padarray(a, pad, 0, 'both') of an input-grid volume

Source

fn on_mask(&self, x: &[f64], clamp: bool) -> Vec<f64>

[x+; x−] of a padded [x+; x−] at the mask’s voxels, with a.*(a > 0) if clamp

Source

fn padded_from_mask(&self, v: &[f64], x: &mut [f64])

The padded [x+.*m; x−.*m] of [x+; x−] at the mask’s voxels, into x

Source

fn crop_from_mask(&self, v: &[f64]) -> (Vec<f64>, Vec<f64>)

(χ+, χ−) on the input grid from [x+; x−] at the mask’s voxels (χ− = −x−)

Source

fn zero_ring(&self, a: &mut [f64])

Zero the padding ring (the toolbox crops each step’s output and pads the next step’s input)

Source

fn load_w( &self, c: &mut [Complex64], f: impl Fn(usize, f64) -> f64 + Sync + Send, )

c ← f(l, w) as a real volume, with w = W_I at the mask’s voxels and 0 elsewhere (the value of w_mag there)

Source

fn kmul(&self, c: &mut [Complex64])

c ← D.*c

Source

fn dc_raw(&self, ws: &mut Workspace)

c ← ifftn(D.*fftn(c))

Source

fn dc_c(&self, ws: &mut Workspace)

c ← Dc(c), c holding a real volume: real(ifftn(D.*fftn(c))), as a real volume

Source

fn dc_out(&self, ws: &mut Workspace, out: &mut [f64])

out ← Dc(c), c holding a real volume

Source

fn af_c(&self, ws: &mut Workspace)

c ← Af(c) = Dc(w_phs.*Dc(c)), c holding a real volume

Source

fn a1(&self, ws: &mut Workspace, x: &[f64], out: &mut [f64])

Step 1’s normal operator on [x+; x−]

Source

fn step1( &self, ws: &mut Workspace, start: Start<'_, f64>, tol: f64, maxit: usize, ) -> Vec<f64>

Step 1: pcg from start; returns the solution with the padding ring zeroed.

Source

fn cone_ifft(&self, ws: &mut Workspace, y: &[Complex64], out: &mut [f64])

out ← real(ifftn(M_ic.*y)), y on the cone’s voxels

Source

fn g_pm(&self, s: usize, c: usize, p: [usize; 3]) -> f64

The fgrad component c (voxel size vs) of the masked fast QSM and smoothed R2′ at p, combined into |g+| (s = 0) or |g−| (s = 1)

Source

fn wg2(&self, s: usize, c: usize, p: [usize; 3], l: usize) -> f64

W_G² of source s, axis c at voxel p (l): conj(W).*W with W = W_G.*M

Source

fn cone_fft_reg( &self, ws: &mut Workspace, s: usize, x: &[f64], out: &mut [Complex64], )

out ← M_ic.*fftn(gT(W_G².*fgrad(x, 1), 1)) on the cone’s voxels, for source s

Source

fn step2(&self, ws: &mut Workspace, x: &mut [f64], params: &ChiSepIlsqrParams)

Step 2 on step 1’s [x+; x−], in place: each source minus its streaking component, masked.

Source

fn fast_qsm(&self, ws: &mut Workspace, f: Vec<f64>, vs: [f64; 3]) -> Vec<f64>

The fast QSM of step 2 (see the module docs), on the padded grid.

Source

fn tukey_lpf(&self, ws: &mut Workspace, r: &[f64]) -> Vec<f64>

R2′ (ppm) smoothed by a Tukey window in k-space: real(ifftn(fftshift(ifftshift(fftn(r)).*w)))

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> 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> 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, 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.