Skip to content

cornucopia.qmri

This module contains transforms that implement physics-based forward models of MR image formation.

RandomSusceptibilityMixtureTransform

RandomSusceptibilityMixtureTransform(mu_tissue=Uniform(9, 10), sigma_tissue=0.01, mu_bone=Uniform(12, 13), sigma_bone=0.1, fwhm=2, label_air=0, label_bone=None, dtype=None, *, shared='channels', **kwargs)

Bases: NonFinalTransform

A RandomGaussianMixtureTransform tailored to susceptibility maps.

This transform returns a delta susceptibility map (with respect to air), in ppm.

Parameters:

Name Type Description Default
mu_tissue float or Sampler

Distribution of negative susceptibility offsets (in ppm) of soft tissues with respect to air. Will be negated (air susceptibility is larger than all tissues). If float: upper bound.

Uniform(9, 10)
sigma_tissue float or Sampler

Standard deviation of susceptibility offsets, within class. If float: uper bound.

0.01
mu_bone float or Sampler

Distribution of negative susceptibility offsets (in ppm) of hard tissues with respect to air. Will be negated (air susceptibility is larger than all tissues). If float: upper bound.

Uniform(12, 13)
sigma_bone

Standard deviation of susceptibility offsets, within class. If float: upper bound.

0.1
fwhm Sampler or [list of] float

Sampling function for smoothing width. If float: upper bound.

2
label_air [list of] int

Labels corresponding to air.

0
label_bone [list of] int

Labels corresponding to bone and teeth.

None

SusceptibilityToFieldmapTransform

SusceptibilityToFieldmapTransform(axis=-1, field_strength=3, larmor=42576000.0, s0=0.4, s1=-9.5, voxel_size=1, mask_air=False, **kwargs)

Bases: FinalTransform

Convert a susceptibiity map (in ppm) into a field map (in Hz)

Parameters:

Name Type Description Default
axis int

Readout dimension

-1
field_strength float

Strength of the main magnetic field, in Tesla. If None, return a fieldmap in ppm.

3
larmor float

Larmor frequency (default: Larmor frequency of water)

42576000.0
s0 float

Susceptibility of air (ppm)

0.4
s1 float

Susceptibility of tissue minus susceptiblity of air (ppm) (only used if ds is a boolean mask)

-9.5
voxel_size [list of] float

Voxel size

1
mask_air bool

Mask air (where delta susceptibility == 0) from resulting fieldmap.

False

ShimTransform

ShimTransform(linear=None, quadratic=None, isocenter=None, **kwargs)

Bases: FinalTransform

Parameters:

Name Type Description Default
linear (3 or 1) tensor or list of float

Linear components (3D: [XY, XZ, YX], 2D: [XY])

None
quadratic (2 or 1) tensor or list of float

Quadratic components (3D: [XXYY, XXZZ], 2D: [XXYY])

None
isocenter (3 or 2) tensor or list of float

Coordinates of the isocenter, in voxels

None

Other Parameters:

Name Type Description
returns [list or dict of] {'input', 'output', 'shim'}

OptimalShimTransform

OptimalShimTransform(max_order=2, lam_abs=1, lam_grad=10, mask=True, **kwargs)

Bases: NonFinalTransform

Compute a linear combination of spherical harmonics that flattens the input field map

Parameters:

Name Type Description Default
max_order int

Maximum order of spherical basis functions

2
lam_abs float

Regularization factor for absolute values

1
lam_grad float

Regularization factor for first order gradients

10
mask bool

Mask zeros/NaNs from objective functions

True

Other Parameters:

Name Type Description
returns [list or dict of] {'input', 'output', 'shim'}

RandomShimTransform

RandomShimTransform(coefficients=5, max_order=2, shared=False, **kwargs)

Bases: NonFinalTransform

Sample a random (imperfect) shim.

This function randomly samples the coefficients of a field encoded by spherical harmonics.

Parameters:

Name Type Description Default
coefficients int or Sampler

Sampler for spherical harmonics coefficients (or upper bound)

5
max_order int or Sampler

Sampler for spherical harmonics order (or upper bound)

2

Other Parameters:

Name Type Description
returns [list or dict of] {'input', 'output', 'shim'}
shared (channels, tensors, channels + tensors, '')

HertzToPhaseTransform

HertzToPhaseTransform(te=0, **kwargs)

Bases: FinalTransform

Converts a ΔB0 field (in Hz) into a Phase shift field Δφ (in rad)

Parameters:

Name Type Description Default
te float

Echo time, in sec.

0

GradientEchoTransform

GradientEchoTransform(tr=0.025, te=0.007, alpha=20, pd=None, t1=None, t2=None, b1=1, mt=0, **kwargs)

Bases: FinalTransform

Spoiled Gradient Echo forward model

Parameters:

Name Type Description Default
tr float

Repetition time, in sec

0.025
te float

Echo time, in sec

0.007
alpha float

Nominal flip angle, in degree

20
pd float

Proton density (PD). If None, the first input channel is PD.

None
t1 float

Longitudinal relaxation time (T1), in sec. If None, the second input channel is T1.

None
t2 float

Apparent transverse relaxation time (T2), in sec. If None, the third input channel is T2.

None
b1 float

Transmit efficiency (B1+). 1 means 100% efficiency. If None, the fourth input channel is B1+.

1
mt float

Magnetization transfer saturation (MTsat). If None, the fifth input channel is MTsat.

0

xform

xform(x)

Parameters:

Name Type Description Default
x (K, *spatial)

Parameters that were not set during class instantiation (i.e., whose value was None), in the order:

- pd: Proton density
- t1: Longitudinal relaxation time (T1), in sec.
- t2: Apparent transverse relaxation time (T2*), in sec.
- b1: Transmit efficiency (B1+). `1` means 100% efficiency.
- mt: Magnetization transfer saturation (MTsat).
required

RandomGMMGradientEchoTransform

RandomGMMGradientEchoTransform(tr=0.05, te=0.05, alpha=90, pd=1, t1=10, t2=100, mt=0.1, b1=RandomMulFieldTransform(vmax=1.5), sigma=0.2, fwhm=2, **kwargs)

Bases: NonFinalTransform

Generate a Spoiled Gradient Echo image from synthetic PD/T1/T2 maps.

Parameters:

Name Type Description Default
tr Sampler or float

Random sampler for repetition time, or upper bound

0.05
te Sampler or float

Random sampler for echo time, or upper bound

0.05
alpha Sampler or float

Random sampler for nominal flip angle, or upper bound

90
pd Sampler or float

Random sampler for proton density, or upper bound

1
t1 Sampler or float

Random sampler for longitudinal relaxation, or upper bound

10
t2 Sampler or float

Random sampler for apparent transverse relaxation, or upper bound

100
mt Sampler or float

Random sampler for magnetization transfer saturation, or upper bound

0.1
b1 Transform

A transformation that samples a smooth multiplicative field

RandomMulFieldTransform(vmax=1.5)
sigma Sampler or float

Random sampler for intra-class standard deviation (in percent), or upper bound

0.2
fwhm Sampler or float

Random sampler for intra-class smoothing (in voxels), or upper bound

2

GREParameters

GREParameters(param, **kwargs)

Bases: FinalTransform

Store parameter maps

Final

Final(prm, fwd, mask, **kwargs)

Bases: FinalTransform

Apply GRE forward model to parameters, then mask