taylor_method

Python port of Merry’s bSSFP parameter mapping code.

This is an alternative to PLANET.

mr_utils.recon.ssfp.merry_param_mapping.taylor_method.optim_wrapper(idx, Is, TR, dphis, offres_est, alpha)[source]

Wrapper for parallelization.

Parameters:
  • idx (array_like) – Indices of current pixels, must be provided as parallelization is non- sequential
  • Is (array_like) – Array of phase-cycled images, (dphi, x, y).
  • TR (float) – Repetition time (in sec).
  • dphis (array_like) – Phase-cycles (in radians).
  • offres_est (array_like) – Off-resonance map estimation (in Hz).
  • alpha (array_like) – Flip angle map (in rad).
Returns:

  • ii (int) – Row index
  • jj (int) – Column index
  • xopt (array_like) – Optimized parameters: [T1, T2, offres, M0]

mr_utils.recon.ssfp.merry_param_mapping.taylor_method.taylor_method(Is, dphis, alpha, TR, mask=None, chunksize=10, unwrap_fun=None, disp=False)[source]

Parameter mapping for multiple phase-cycled bSSFP.

Parameters:
  • Is (array_like) – Array of phase-cycled images, (dphi, x, y).
  • dphis (array_like) – Phase-cycles (in radians).
  • alpha (array_like) – Flip angle map (in rad).
  • TR (float) – Repetition time (in sec).
  • mask (array_like, optional) – Locations to compute map estimates.
  • chunksize (int, optional) – Chunk size to use for parallelized loop.
  • unwrap_fun (callable) – Function to do 2d phase unwrapping. If None, will use skimage.restoration.unwrap_phase().
  • disp (bool, optional) – Show debugging plots.
Returns:

  • t1map (array_like) – T1 map estimation (in sec)
  • t2map (array_like) – T2 map estimation (in sec)
  • offresmap (array_like) – Off-resonance map estimation (in Hz)
  • m0map (array_like) – Proton density map estimation

Raises:

AssertionError – If number of phase-cycles is not divisible by 4.

Notes

mask=None computes maps for all points. Note that Is must be given as a list.

Objective function wrapper used with MATLAB, unnecessary.

mr_utils.recon.ssfp.merry_param_mapping.optimize.optimize(I, TR, phasecycles, offres, M0, alpha, T1, T2)[source]

Optimization driver to find T1, T2, offres, and M0 estimates.

Parameters:
  • I (list) – List of phase-cycled images.
  • TR (float) – Repetition time (in sec).
  • phasecycles (array_like) – Phase-cycles (in radians).
  • offres (array_like) – Off-resonance map estimation (in Hz).
  • M0 (float) – Initial guess for M0.
  • alpha (float) – Flip angle (in rad).
  • T1 (float) – Inital guess for T1 (in sec).
  • T2 (float) – Initial guess for T2 (in sec).
Returns:

  • array_like – Optimized values for [T1 (sec), T2 (sec), offres (Hz), M0].
  • float – Final objective function value.

Calculates residuals for least_squares fit.

mr_utils.recon.ssfp.merry_param_mapping.elliptical_fit.ellipticalfit(Ireal, TR, dphis, offres, M0, alpha, T1, T2)[source]

ELLIPTICALFIT

Parameters:
  • Ireal (array_like) – Hermtian transposed phase-cycle values for single pixel.
  • TR (float) – Repetition time (in sec).
  • M0 – Estmated proton density from the band reduction algorithm.
  • phasecycles – Phase-cycles (in rad).
  • offres – Off-resonance estimation (in Hz).
Returns:

J – Real part of difference concatenated with imaginary part of difference

Return type:

array_like

Plot an ellipse based on MR parameters.

mr_utils.recon.ssfp.merry_param_mapping.plot_ellipse.plotEllipse(T1, T2, TR, alpha, offres, M0, dphi)[source]

Compute (x, y) coordinates for ellipse described by MR parameters.

Parameters:
  • T1 (float) – Longitudinal relaxation constant (in sec).
  • T2 (float) – Transverse relaxation constant (in sec).
  • TR (float) – Repetition time (in sec).
  • alpha (float) – Flip angle (in rad).
  • offres (float) – Off-resonance (in Hz).
  • M0 (float) – Proton density.
  • dphi (float or bool) – Phase-cycle value (in rad). dphi=True means use fixed linspace for dphi set, else, use the list of dphis provided.
Returns:

  • x (array_like) – x coordinate values of ellipse.
  • y (array_like) – y coordinate values of ellipse.