apply_girf#
- mrinufft.trajectories.apply_girf(*, girf: NDArray, freqs: NDArray, gradients: NDArray | None = None, trajectory: NDArray | None = None, acq: Acquisition | None = None, girf_affine: NDArray | None = None, delay: float = 0.0, t_start: float = -0.001) tuple[NDArray, NDArray][source]#
Predict the encoding actually played, using a GIRF.
Exactly one of
gradientsortrajectorymust be provided. The gradients or trajectory played are returned in the same form as the input, along with the deviations of all the field terms from the nominal encoding. These are expanded on spherical harmonics in the frame of the image: on its axes, in m, from its voxelacq.img_size // 2. See Gradient Impulse Response Function (GIRF) for the model and its conventions.- Parameters:
girf (NDArray) – Gradient impulse response function, with shape
(3, n_terms, n_freqs):girf[i, j]is the transfer function from the gradient axisito the field termj, given byspherical_harmonics().n_termsis 4, 9 or 16, for complete orders up to 1, 2 or 3.freqs (NDArray) – Frequencies of
girfin Hz, uniformly spaced from 0. The response is taken as zero abovefreqs[-1].gradients (NDArray, optional) – Nominal gradients in T/m on the axes of the image, with shape
(n_shots, n_samples, dim),dimbeing 2 or 3.trajectory (NDArray, optional) – Nominal normalized trajectory, with shape
(n_shots, n_samples, dim).acq (Acquisition, optional) – Acquisition configuration, providing the sampling interval of the inputs (
acq.raster_time), the gyromagnetic ratio, the normalization oftrajectory, and the position and orientation of the image (acq.affine). If None, the default acquisition is used.girf_affine (NDArray, optional) – Affine
(4, 4)from the physical coordinates ofacq.affineto the coordinates of the GIRF: the axes of the gradient coils, from the origin of the field measurement. If None, they are the same.delay (float, optional) – Extra delay applied to the responses, in s. The default is 0.
t_start (float, optional) – Time in s at which the impulse responses start, in
(-1/df, 0]withdfthe step offreqs. They are taken as zero outside of[t_start, t_start + 1/df). The default is -1 ms.
- Returns:
gradients (NDArray) – If
gradientsis provided, the gradients played at the centre of the image in T/m, with the same shape and axes as the input.trajectory (NDArray) – If
trajectoryis provided, the normalized trajectory played, wrapped into[-acq.norm_factor, acq.norm_factor), with the same shape and axes as the input.fields (NDArray) – Deviations of the field terms from the nominal encoding, in T/m^l for a term of order l, at the gradient raster: shape
(n_shots, n_samples, n_terms)forgradients, and(n_shots, n_samples - 1, n_terms), between the samples, fortrajectory.
- Raises:
ValueError – If none or both of
gradientsandtrajectoryare provided, ifgirfandfreqsare inconsistent, ift_startis out of range, or if the affines are not rigid.- Return type:
tuple[NDArray, NDArray]
Notes
The data are compensated for the phase accrued by the zeroth order, and the higher orders are included in the reconstruction with
mrinufft.extras.compute_girf_interpolators(). Gradients are taken as zero outside of the input: as the response to the pre-phasers leaks into the readout, they should be included in the input and cropped from the output.