mr2.algorithms.reconstruction.PlugAndPlayReconstruction

class mr2.algorithms.reconstruction.PlugAndPlayReconstruction[source]

Bases: DirectReconstruction

Reconstruct with a callable image denoiser and quadratic data consistency.

Uses admm_l2 for iteration and DirectReconstruction for acquisition setup. The initial image is the adjoint reconstruction, including density compensation if available, without an additional normalization. Choose denoiser strength for the reconstruction’s complex image convention and intensity scale. Density compensation only affects initialization. An arbitrary denoiser need not define a regularization objective or guarantee convergence.

Based on the reconstruction proposed in PTB-MR/mrpro PR #1013.

__init__(kdata: KData | None = None, fourier_op: LinearOperator | None = None, csm: Callable[[IData], CsmData] | CsmData | SensitivityOp | None = CsmData.from_idata_walsh, noise: KNoise | None = None, dcf: DcfData | DensityCompensationOp | None = None, *, denoiser: Callable[[Tensor], Tensor], tau: float | Tensor, max_iterations: int = 128, tolerance: float = 0.0, cg_max_iterations: int = 128, cg_tolerance: float = 1e-6, callback: Callable[[ADMML2Status], bool | None] | None = None) → None[source]

Initialize the acquisition model and solver controls.

Parameters:
  • kdata (KData | None, default: None) – Data used to estimate missing Fourier operator, DCF and callable CSM.

  • fourier_op (LinearOperator | None, default: None) – Fourier operator. If None, estimated from kdata. With noise prewhitening, it must apply the same transform independently to each coil.

  • csm (Callable[[IData], CsmData] | CsmData | SensitivityOp | None, default: CsmData.from_idata_walsh) – Coil sensitivity maps, operator, or estimation callable. None disables coil combination. Explicit maps must be in the original coil basis; they are whitened when noise is supplied. Callable estimates already use whitened data. See DirectReconstruction for setup details.

  • noise (KNoise | None, default: None) – Optional noise data for prewhitening, including CSM estimation.

  • dcf (DcfData | DensityCompensationOp | None, default: None) – Density compensation used only for the initial adjoint reconstruction. If None and kdata is provided, estimated from its trajectory.

  • denoiser (Callable[[Tensor], Tensor]) – Tensor callable preserving image shape, dtype and device.

  • tau (float | Tensor) – Positive finite scalar inverse ADMM penalty, as in admm_l2. A penalty rho in the upstream reconstruction corresponds to tau=1/rho.

  • max_iterations (int, default: 128) – Maximum ADMM iterations.

  • tolerance (float, default: 0.0) – Relative primal and dual residual tolerance; zero disables stopping.

  • cg_max_iterations (int, default: 128) – Maximum CG iterations per ADMM update.

  • cg_tolerance (float, default: 1e-6) – Nonnegative finite absolute CG residual tolerance.

  • callback (Callable[[ADMML2Status], bool | None] | None, default: None) – Optional callback receiving ADMML2Status after each iteration.

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.

__call__(kdata: KData) → IData[source]

Apply the reconstruction.

forward(kdata: KData) → IData[source]

Reconstruct k-space data, returning the data-consistent iterate as IData.

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 data

  • csm (Union[CsmData, Literal[False], None], default: None) – Coil sensitivity maps used for coil combination. If None, self.csm_op is used. If False, no coil combination is performed.

  • noise (Union[KNoise, Literal[False], None], default: None) – Noise measurement for prewhitening. If None, self.noise is used. If False, no prewhitening is performed.

Returns:

image data

recalculate_csm(kdata: KData, csm_calculation: Callable[[IData], CsmData] = CsmData.from_idata_walsh, noise: KNoise | Literal[False] | None = None) → Self[source]

Update (in place) the CSM from KData.

Performs a direct reconstruction without coil combination and estimates coil sensitivity maps from the result.

Parameters:
  • kdata (KData) – k-space data used for adjoint reconstruction (including DCF-weighting if available), which is then used for CSM estimation.

  • csm_calculation (Callable[[IData], CsmData], default: CsmData.from_idata_walsh) – Function to calculate csm expecting idata as input and returning csmdata. For examples have a look at the CsmData.

  • noise (Union[KNoise, Literal[False], None], default: None) – Noise measurement for prewhitening. If None, self.noise (if previously set) is used. If False, no prewhitening is performed even if self.noise is set. Use this if the kdata is already prewhitened.

recalculate_fourierop(kdata: KData) → Self[source]

Update (in place) the Fourier Operator, e.g. for a new trajectory.

Also recalculates the DCF.

Parameters:

kdata (KData) – k-space data to determine trajectory and recon/encoding matrix from.