Menu

Python Sparse data Analysis Package external MRI plugin.

Common tools for MRI image reconstruction.

mri.operators.fourier.utils.check_if_fourier_op_uses_sense(fourier_op)[source]

Utils function to check if fourier operator uses SENSE recon

Parameters

fourier_op: object of class FFT, NonCartesianFFT or Stacked3DNFFT in

mri.operators

the fourier operator for which we want to check if SENSE is supported

Returns

bool

True if SENSE recon is being used

mri.operators.fourier.utils.convert_locations_to_mask(samples_locations, img_shape)[source]

Return the converted the sampling locations as Cartesian mask.

Parameters

samples_locations: np.ndarray

samples locations between [-0.5, 0.5[.

img_shape: tuple of int

shape of the desired mask, not necessarly a square matrix.

Returns

mask: np.ndarray, {0,1}

2D matrix, not necessarly a square matrix.

mri.operators.fourier.utils.convert_mask_to_locations(mask)[source]

Return the converted Cartesian mask as sampling locations.

Parameters

mask: np.ndarray, {0,1}

ND matrix, not necessarly a square matrix.

Returns

samples_locations: np.ndarray

samples location between [-0.5, 0.5[ of shape MxN where M is the number of 1 values in the mask.

mri.operators.fourier.utils.estimate_density_compensation(kspace_loc, volume_shape, num_iterations=10)[source]

Utils function to obtain the density compensator for a given set of kspace locations.

Parameters

kspace_loc: np.ndarray

the kspace locations

volume_shape: np.ndarray

the volume shape

num_iterations: int default 10

the number of iterations for density estimation

mri.operators.fourier.utils.get_stacks_fourier(kspace_loc, volume_shape)[source]

Function that splits an incoming 3D stacked k-space samples into a 2D non-Cartesian plane and the vector containing the z k-space values of the stacks acquiered and converts to stacks of 2D. This function also checks for any issues of the incoming k-space pattern and if the stack property is not satisfied. Stack Property: The k-space locations originate from a stack of 2D samples.

Parameters

kspace_loc: np.ndarray

Acquired 3D k-space locations : stacks of same non-Cartesian samples, while Cartesian under-sampling on the stacks direction.

volume_shape: tuple

Reconstructed volume shape

Returns

———-

kspace_plane_loc: np.ndarray

A 2D array of samples which when stacked gives the 3D samples

z_sample_loc: np.ndarray

A 1D array of z-sample locations

sort_pos: np.ndarray

The sorting positions for opertor and inverse for incoming data

idx_mask_z: np.ndarray

contains the indices of the acquired Fourier planes (z direction)

mri.operators.fourier.utils.gridded_inverse_fourier_transform_nd(kspace_loc, kspace_data, grid, method)[source]

This function calculates the gridded Inverse fourier transform from Interpolated non-Cartesian data into a cartesian grid

Parameters

kspace_loc: np.ndarray

The N-D k_space locations of size [M, N]

kspace_data: np.ndarray

The k-space data corresponding to k-space_loc above

grid: np.ndarray

The Gridded matrix for which you want to calculate k_space Smaps

method: {‘linear’, ‘nearest’, ‘cubic’}

Method of interpolation for more details see scipy.interpolate.griddata documentation

Returns

np.ndarray

The gridded inverse fourier transform of given kspace data

mri.operators.fourier.utils.gridded_inverse_fourier_transform_stack(kspace_data_sorted, kspace_plane_loc, idx_mask_z, grid, volume_shape, method)[source]

This function calculates the gridded Inverse fourier transform from Interpolated non-Cartesian data into a cartesian grid. However, the IFFT is done similar to Stacked Fourier transform. We expect the kspace data to be limited to a grid on z, we calculate the inverse fourier transform by- 1) Grid data in each plane (for all points in a plane) 2) Interpolate data along z, if we have undersampled data along z 3) Apply an IFFT on the 3D data that was gridded and interpolated in z.

Parameters

kspace_data_sorted: np.ndarray

The sorted k-space data corresponding to kspace_plane_loc above

kspace_plane_loc: np.ndarray

The N-D k_space locations of size [M, N]. These hold locations only in plane, extracted using get_stacks_fourier function

idx_mask_z: np.ndarray

contains the indices of the acquired Fourier plane. Extracted using get_stacks_fourier function

grid: tuple

The Gridded matrix for which you want to calculate k_space Smaps. Should be given as a tuple of ndarray

volume_shape: tuple

Reconstructed volume shape

method: {‘linear’, ‘nearest’, ‘cubic’}, optional

Method of interpolation for more details see scipy.interpolate.griddata documentation

Returns

np.ndarray

The gridded inverse fourier transform of given kspace data

mri.operators.fourier.utils.normalize_frequency_locations(samples, Kmax=None)[source]

This function normalize the samples locations between [-0.5; 0.5[ for the non-cartesian case

Parameters

samples: np.ndarray

Unnormalized samples

Kmax: int, float, array-like or None

Maximum Frequency of the samples locations is supposed to be equal to base Resolution / (2* Field of View)

Returns

normalized_samples: np.ndarray

Same shape as the parameters but with values between [-0.5; 0.5[

Follow us

© 2019, Antoine Grigis Samuel Farrens Jean-Luc Starck Philippe Ciuciu .
Inspired by AZMIND template.