get_gridded_trajectory#
- mrinufft.trajectories.display3D.get_gridded_trajectory(trajectory, shape, grid_type='density', osf=1, backend='gpunufft', traj_params=None, turbo_factor=176, elliptical_samp=True, threshold=0.001)[source]#
Compute various trajectory characteristics onto a grid.
This function helps in gridding a k-space sampling trajectory to a desired shape, allowing for easier viewing of the trajectory. The gridding process can be carried out to reflect the sampling density, sampling time, inversion time, k-space holes, gradient strengths, or slew rates. Please check grid_type parameter to know the benefits of each type of gridding. During the gridding process, the values corresponding to various samples within the same voxel get averaged.
- Parameters:
trajectory (ndarray) – The input array of shape (N, M, D), where N is the number of shots and M is the number of samples per shot and D is the dimension of the trajectory (usually 3)
shape (tuple) – The desired shape of the gridded trajectory.
grid_type (str, optional) –
The type of gridded trajectory to compute. Default is “density”. It can be one of the following: “density” : Get the sampling density in closest number of samples per voxel.
Helps understand suboptimal sampling, by showcasing regions with strong oversampling.
- ”time”Showcases when the k-space data is acquired in time.
This is helpful to view and understand off-resonance effects. Generally, lower off-resonance effects occur when the sampling trajectory has smoother k-space sampling time over the k-space.
- ”inversion”Relative inversion time at the sampling location. Needs
turbo_factor to be set. This is useful for analyzing the exact inversion time when the k-space is acquired, for sequences like MP(2)RAGE.
- ”holes”: Show the k-space missing coverage, or holes, within a ellipsoid of the
k-space.
”gradients”: Show the gradient strengths of the k-space trajectory. “slew”: Show the slew rate of the k-space trajectory.
osf (int, optional) – The oversampling factor for the gridded trajectory. Default is 1.
backend (str, optional) – The backend to use for gridding. Default is “gpunufft”. Note that “gpunufft” is anyway used to get the pipe density internally.
traj_params (dict, optional) – The trajectory parameters. Default is None. This is only needed when grid_type is “gradients” or “slew”. The parameters needed include img_size (tuple), FOV (tuple in m), and gamma (float in kHz/T) of the sequence. Generally these values are stored in the header of the trajectory file.
turbo_factor (int, optional) – The turbo factor when sampling is with inversion. Default is 176, which is the default turbo factor for MPRAGE acquisitions at 1mm whole brain acquisitions.
elliptical_samp (bool, optional) – Whether the k-space corners should be expected to be covered or ignored when grid_type is “holes”, i.e. the trajectory is an ellipsoid or a cuboic and whether corners should be considered as potential holes. Ignoring them with True corresponds to trajectories with spherical/elliptical sampling. Default is True.
threshold (float, optional default 1e-3) – The threshold for the k-space holes in number of samples per voxel This value is set heuristically to visualize the k-space hole.
- Returns:
The gridded trajectory of shape shape.
- Return type:
ndarray