Utilities#

A collection of helper functions that may be useful for testing code, building examples, or to construct new models.

Real data#

fetch(dataset)

Fetch a dataset included in dcmri

Synthetic data#

fake_aif([tacq, dt, BAT, field_strength, ...])

Synthetic AIF signal with noise.

fake_brain([n, tacq, dt, BAT, Tav, ...])

Synthetic brain images data generated using Parker's AIF, the Shepp-Logan phantom and a two-compartment exchange tissue.

fake_tissue([tacq, dt, BAT, Fb, vb, PS, vi, ...])

Synthetic data generated using Parker's AIF and a two-compartment exchange tissue.

fake_liver([tacq, dt, BAT, Tg, H, ve, Fp, ...])

Synthetic data for liver tissue.

fake_kidney([tacq, dt, BAT, Fp, Eg, fc, Tg, ...])

Synthetic data generated using Parker's AIF, and a multicompartment kidney model.

fake_tissue2scan([tacq, tbreak, dt, BAT, ...])

Synthetic data generated using Parker's AIF, a two-compartment exchange tissue and a steady-state sequence.

Synthetic images#

shepp_logan(*params[, n, B0])

Modified Shepp-Logan phantom mimicking an axial slice through the brain.

Input functions#

aif_parker(t[, BAT])

Population AIF model as defined by Parker et al (2006)

aif_tristan(t[, agent, dose, rate, BAT, ...])

Arterial input function with default parameters for young healthy volunteers.

aif_tristan_rat(t[, BAT, duration])

Population AIF model for rats measured with a standard dose of gadoxetate.

ca_injection(t, weight, conc, dose, rate, t0)

Contrast agent flux (mmol/sec) generated by step injection.

Useful constants#

ca_conc(agent)

Contrast agent concentration

ca_std_dose(agent)

Standard injection volume (dose) in mL per kg body weight.

relaxivity([field_strength, tissue, agent, type])

Contrast agent relaxivity values in units of Hz/M

T1([field_strength, tissue, Hct])

T1 value of selected tissue types.

T2([field_strength, tissue])

T2 value of selected tissue types.

PD([tissue])

Relative proton density (PD) value of selected tissue types.

perfusion([parameter, tissue])

perfusion parameters of selected tissue types.

Convolution#

Convolution is an essential mathematical tool for solving linear and stationary compartment models. Explicit numerical convolution is slow, and dcmri includes apart from a generic convolution method also some faster and more accurate functions for use in special cases where one or both of the factors have a known form.

conv(f, h[, t, dt, solver])

Convolve two 1D-arrays.

expconv(f, T[, t, dt])

Convolve a 1D-array with a normalised exponential.

biexpconv(T1, T2, t)

Convolve two normalised exponentials analytically.

nexpconv(n, T, t)

Convolve n identical normalised exponentials analytically

stepconv(f, T, D[, t, dt])

Convolve a 1D-array with a normalised step function.

Helper functions#

sample(t, tp, Sp[, dt])

Sample a signal at given time points.

add_noise(signal, sdev)

Add noise to an MRI magnitude signal.

interp(y, x[, pos, floor])

Interpolate uniformly sampled data.