OCTOPUS.recon subpackage

OCTOPUS.recon.imtransforms module

Methods to do k-space to image and image to k-space for both Cartesian and non-cartesian data

Author: Marina Manso Jimeno

Last updated: 10/07/2020

OCTOPUS.recon.imtransforms.im2ksp(M, cartesian_opt, NufftObj=None, params=None)

Image to k-space transformation

Parameters:
  • M (numpy.ndarray) – Image data
  • cartesian_opt (int) – Cartesian = 1, Non-Cartesian = 0.
  • NufftObj (pynufft.linalg.nufft_cpu.NUFFT_cpu) – Non-uniform FFT Object for non-cartesian transformation. Default is None.
  • params (dict) – Sequence parameters. Default is None.
Returns:

kspace – k-space data

Return type:

numpy.ndarray

OCTOPUS.recon.imtransforms.ksp2im(ksp, cartesian_opt, NufftObj=None, params=None)

K-space to image transformation

Parameters:
  • ksp (numpy.ndarray) – K-space data
  • cartesian_opt (int) – Cartesian = 1, Non-Cartesian = 0.
  • NufftObj (pynufft.linalg.nufft_cpu.NUFFT_cpu) – Non-uniform FFT Object for non-cartesian transformation. Default is None.
  • params (dict) – Sequence parameters. Default is None.
Returns:

im – Image data

Return type:

numpy.ndarray

OCTOPUS.recon.imtransforms.nufft_init(kt, params)

Initializes the Non-uniform FFT object

Parameters:
  • kt (numpy.ndarray) – K-space trajectory
  • params (dict) – Sequence parameters.
Returns:

NufftObj – Non-uniform FFT Object for non-cartesian transformation

Return type:

pynufft.linalg.nufft_cpu.NUFFT_cpu

OCTOPUS.recon.rawdata_recon module

Methods to reconstruct a field map and spiral images from raw data.

Author: Marina Manso Jimeno

Last modified: 07/16/2020

OCTOPUS.recon.rawdata_recon.fmap_recon(data, dTE, method='HP', save=0, plot=0, dst_folder=None)

Frequency map reconstruction from dual echo raw data

Parameters:
  • data (str or np.ndarray) – Path containing the field map file or array containing the field map data
  • dTE (float) – Difference in TE between the two echoes in seconds
  • method (str) – Method for channel combination. Options are ‘HP’ or ‘SC’. Default is ‘HP’.
  • plot (bool, Optional) – Plotting a slice of the reconstructed frequency map option. Default is 0 (not plot).
  • save (bool, Optional) – Saving the data in a .npy file option. Default is 0 (not save).
  • dst_folder (str, Optional) – Path to the folder where the reconstructed field map is saved. Default is None.
Returns:

fmap – Frequency map in Hz

Return type:

np.ndarray

OCTOPUS.recon.rawdata_recon.hermitian_product(echo1, echo2, dTE)

Calculates the phase difference and frequency map given two echo data and deltaTE between them. Channels are combined using the hermitian product as described by: Robinson, S., & Jovicich, J. (2011). B0 mapping with multi-channel RF coils at high field. Magnetic resonance in medicine, 66(4), 976–988. https://doi.org/10.1002/mrm.22879

Parameters:
  • echo1 (np.ndarray) – Complex image corresponding to the first echo with dimensions [N, N, Nslices, Nchannels]
  • echo2 (np.ndarray) – Complex image corresponding to the second echo with same dimensions as echo1
  • dTE (float) – TE difference between the two echos in seconds.
Returns:

fmap – Frequency map in Hz with dimensions [N, N, Nslices]

Return type:

np.ndarray

OCTOPUS.recon.rawdata_recon.mask_by_threshold(im)

Masks a magnitude image by thresholding according to: Jenkinson M. (2003). Fast, automated, N-dimensional phase-unwrapping algorithm. Magnetic resonance in medicine, 49(1), 193–197. https://doi.org/10.1002/mrm.10354

Parameters:im (np.ndarray) – Magnitude image
Returns:mask – Binary image for background segmentation
Return type:np.ndarray
OCTOPUS.recon.rawdata_recon.separate_channels(echo1, echo2, dTE)

Calculates the phase difference and frequency map given two echo data and deltaTE between them. Channels are combined using a trimmed average method inspired by the separate channels method described by: Robinson, S., & Jovicich, J. (2011). B0 mapping with multi-channel RF coils at high field. Magnetic resonance in medicine, 66(4), 976–988. https://doi.org/10.1002/mrm.22879

Parameters:
  • echo1 (np.ndarray) – Complex image corresponding to the first echo with dimensions [N, N, Nslices, Nchannels]
  • echo2 (np.ndarray) – Complex image corresponding to the second echo with same dimensions as echo1
  • dTE (float) – TE difference between the two echos in seconds.
Returns:

fmap_chcomb – Frequency map in Hz with dimensions [N, N, Nslices]

Return type:

np.ndarray

OCTOPUS.recon.rawdata_recon.spiral_recon(data, ktraj, N, plot=0, save=0, dst_folder=None)

Spiral image reconstruction from raw data

Parameters:
  • data (str or np.ndarray) – Path containing the raw data file of array containing the raw data
  • ktraj (np.ndarray) – k-space trajectory coordinates with dimensions [Npoints, Nshots]
  • N (int) – Matrix size of the reconstructed image
  • plot (bool, Optional) – Plotting a slice of the reconstructed image option. Default is 0 (not plot).
  • save (bool, Optional) – Saving the data in a .npy file option. Default is 0 (not save).
  • dst_folder (str, Optional) – Path to the folder where the reconstructed image is saved. Default is None.