mr2.algorithms.reconstruction.GrappaReconstruction
- class mr2.algorithms.reconstruction.GrappaReconstruction[source]
Bases:
ReconstructionCalibrate GRAPPA, interpolate Cartesian k-space and reconstruct coil images.
- __init__(kdata: KData, acs: Tensor, kernel_size: tuple[int, int, int], *, regularization: float = 0.01, csm: Callable[[IData], CsmData] | CsmData | SensitivityOp | None = CsmData.from_idata_walsh) None[source]
Initialize the reconstruction and calibrate reusable kernels.
- Parameters:
kdata (
KData) – Cartesian acquisition defining the encoding grid and sampling pattern. All batches must share the same pattern. Samples must not repeat.acs (
Tensor) – Fully sampled Cartesian calibration tensor(..., coils, kz, ky, kx). Must use the same coil basis and frequency spacing askdata; its batch dimensions broadcast to the acquired data.kernel_size (
tuple[int,int,int]) – Positive odd neighborhood widths in z, y, x. Use a z width of one for 2D acquisitions. At boundaries, only in-grid acquired sources enter the fit. Every missing point needs an acquired neighbor.regularization (
float, default:0.01) – Relative ridge strength passed tocalibrate.csm (
Callable[[IData],CsmData] |CsmData|SensitivityOp|None, default:CsmData.from_idata_walsh) – Coil combination maps, operator or calculation from completed coil images, followingDirectReconstruction. Set to None to return separate coil images. For differentiable reconstruction, construct on the target device.
- dcf_op: DensityCompensationOp | None
Density Compensation Operator.
- csm_op: SensitivityOp | None
Coil Sensitivity Operator.
- noise: KNoise | None
Noise Data used for prewhitening.
- fourier_op: LinearOperator
Fourier Operator.
- forward(kdata: KData) IData[source]
Interpolate and reconstruct data with the calibrated sampling pattern.
- Parameters:
kdata (
KData) – Data with the trajectory and coil basis used during initialization.- Returns:
Reconstructed image data, optionally combined using coil sensitivities.
- static calibrate(acs: Tensor, source_pattern: Tensor, *, regularization: float = 0.01) Tensor[source]
Fit a GRAPPA kernel from fully sampled Cartesian calibration data.
- Parameters:
acs (
Tensor) – Fully sampled Cartesian ACS, shape(..., coils, kz, ky, kx). Leading batch dimensions are calibrated independently.source_pattern (
Tensor) – Boolean 3D neighborhood with positive odd widths. True selects an acquired source offset; the center is the target and must be False. Only complete ACS windows are used.regularization (
float, default:0.01) – Nonnegative ridge strength, relative to the mean diagonal ofS.H @ Sfor source matrix S. Zero uses a minimum-norm pseudoinverse. Batches with zero source energy return zero kernels.
- Returns:
Complex kernel with shape
(..., coils_out, coils_in, *kernel_size). Unused offsets are zero.
- interpolate(kdata: KData) Tensor[source]
Fill the encoded Cartesian grid, preserving acquired samples exactly.
- Parameters:
kdata (
KData) – Data with the trajectory and coil basis used during initialization.- Returns:
Completed k-space tensor, shape
(..., coils, kz, ky, kx).
- recalculate_csm(kdata: KData, csm_calculation: Callable[[IData], CsmData] = CsmData.from_idata_walsh, noise: KNoise | Literal[False] | None = None) Self[source]
Update coil sensitivities from GRAPPA-completed images.
- Parameters:
kdata (
KData) – Acquisition with the trajectory and coil basis used for calibration.csm_calculation (
Callable[[IData],CsmData], default:CsmData.from_idata_walsh) – Sensitivity calculation receiving the completed coil images.noise (
Union[KNoise,Literal[False],None], default:None) – Must be None or False. For prewhitening, transform acquisition and ACS together before calibrating GRAPPA kernels.
- recalculate_fourierop(kdata: KData) Self[source]
Update the Cartesian sampling operators and recalibrate from stored ACS.
- Parameters:
kdata (
KData) – Acquisition defining the new encoding grid and sampling pattern.
- direct_reconstruction(kdata: KData, *, csm: CsmData | Literal[False] | None = None, noise: KNoise | Literal[False] | None = None) IData[source]
Direct reconstruction of the MR acquisition.
Here we use \(S^H F^H W\) to calculate the image data using the coil sensitivity operator \(S\), the Fourier operator \(F\), and the density compensation operator \(W\).
- Parameters:
kdata (
KData) – k-space datacsm (
Union[CsmData,Literal[False],None], default:None) – Coil sensitivity maps used for coil combination. IfNone,self.csm_opis used. IfFalse, no coil combination is performed.noise (
Union[KNoise,Literal[False],None], default:None) – Noise measurement for prewhitening. IfNone,self.noiseis used. IfFalse, no prewhitening is performed.
- Returns:
image data