mr2.algorithms.prepare_acs
- mr2.algorithms.prepare_acs(kdata: KData, size: int | SpatialDimension[int] | None = None) Tensor[source]
Prepare centered Cartesian calibration k-space.
- Parameters:
kdata (
KData) – Acquired data and trajectory, in encoding-grid coordinate units. Samples must already use the coil basis intended for reconstruction, including any prewhitening. Batches are processed separately and are never averaged.size (
Union[int,SpatialDimension[int],None], default:None) – Calibration widths in z, y, x. An integer requests a square or cube on active encoding axes, with singleton axes unchanged. If omitted, choose the largest centered square or cube supported in every batch.
- Returns:
torch.Tensor – Centered Cartesian calibration data, shape
(..., coils, kz, ky, kx). Frequency spacing corresponds to the encoding FOV, not the reconstruction matrix. Cartesian samples are extracted exactly. Non-Cartesian samples are approximately gridded using a density-compensated adjoint and FFT.
Notes
Automatic non-Cartesian sizing rounds samples to the nearest encoding-grid bin and chooses the largest centered square or cube with no empty bins in any trajectory batch. Repeated samples do not improve occupancy. This is an alignment-sensitive heuristic and can underestimate useful calibration size; it does not guarantee calibration quality. Explicit non-Cartesian sizes skip this estimate and are only checked against the encoding matrix. A single Voronoi density calculation supplies weights for the full-trajectory adjoint.
- Raises:
ValueError – If the size or trajectory is invalid, automatic sizing finds no covered center, or an explicit Cartesian block has missing or repeated samples.