bartorch.estimate_density#
- bartorch.estimate_density()#
Pipe-Menon density compensation weights for a trajectory.
The fixed point \(w \leftarrow w / (C * w)\) of Pipe and Menon [1] is iterated from \(w = 1\), with the convolution \(C * w\) evaluated at the samples by the non-uniform transforms of this package (
bartorch.linop.NUFFT). The kernel \(C\) is the squared Dirichlet kernel of the gridshape, the squared point spread function of its field of view: a non-negative kernel one grid cell wide. It is applied as a triangle window on a grid of twiceshape. The weights are then scaled so that the density-compensated adjoint of the transform of a uniform image has unit mean modulus.- Parameters:
traj (torch.Tensor) – Trajectory
(*frames, samples, ndim)in grid units ofshape,kx, ky[, kz]withkxalong the last image axis, as fornufft(). Each frame is a trajectory of its own and receives its own weights.shape (tuple of int) – Image grid,
(y, x)or(z, y, x), relative to which the density is estimated.iterations (int, default=20) – Fixed-point iterations.
- Returns:
Real, non-negative weights of shape
traj.shape[:-1], for theweightsofnufft_adjoint()orbartorch.linop.NUFFT, or thedensityofbartorch.tools.reconstruct_navigator().- Return type:
torch.Tensor
- Raises:
ValueError – If the trajectory does not match the grid’s dimensionality or leaves \(\pm n/2\) along an axis.
References
Examples
>>> weights = estimate_density(traj, (64, 64)) # traj (spokes * samples, 2)