mrpro.algorithms.reconstruction.TotalVariationRegularizedReconstruction
- class mrpro.algorithms.reconstruction.TotalVariationRegularizedReconstruction[source]
Bases:
DirectReconstructionTV-regularized reconstruction.
This algorithm solves the problem \(min_x \frac{1}{2}||Ax - y||_2^2 + \sum_i l_i ||\nabla_i x||_1\) by using the PDHG-algorithm. \(A\) is the acquisition model (coil sensitivity maps, Fourier operator, k-space sampling), \(y\) is the acquired k-space data, \(l_i\) are the strengths of the regularization along the different dimensions and \(\nabla_i\) is the finite difference operator applied to \(x\) along different dimensions \(i\).
- __init__(kdata: KData | None = None, fourier_op: LinearOperator | None = None, csm: Callable | CsmData | None = CsmData.from_idata_walsh, noise: KNoise | None = None, dcf: DcfData | None = None, *, max_iterations: int = 100, tolerance: float = 0, regularization_dim: Sequence[int], regularization_weight: float | Sequence[float] | Sequence[Tensor]) None[source]
Initialize TotalVariationRegularizedReconstruction.
- Parameters:
kdata (
KData|None, default:None) – KData. Ifkdatais provided andfourier_opordcfareNone, thenfourier_opanddcfare estimated based onkdata. Otherwisefourier_opanddcfare used as provided.fourier_op (
LinearOperator|None, default:None) – Instance of theFourierOpused for reconstruction. IfNone, set up based onkdata.csm (
Callable|CsmData|None, default:CsmData.from_idata_walsh) – Sensitivity maps for coil combination. IfNone, no coil combination is carried out, i.e. images for each coil are returned. If aCallableis provided, coil images are reconstructed using the adjoint of theFourierOp(including density compensation) and then sensitivity maps are calculated using theCallable. For this,kdataneeds also to be provided. For examples have a look at themrpro.data.CsmDataclass e.g.from_idata_walshorfrom_idata_inati.noise (
KNoise|None, default:None) – KNoise used for prewhitening. IfNone, no prewhitening is performeddcf (
DcfData|None, default:None) – K-space sampling density compensation. IfNone, set up based onkdata. Thedcfis only used to calculate a starting estimate for PDHG.max_iterations (
int, default:100) – Maximum number of PDHG iterationstolerance (
float, default:0) – Tolerance of PDHG for relative change of the primal solution; if zero,max_iterationsof PDHG are run.regularization_dim (
Sequence[int]) – Dimensions along which the total variation reguarization is applied (\(i\)).regularization_weight (
float|Sequence[float] |Sequence[Tensor]) – Strengths of the regularization (\(l_i\)). If a single values is given, it is applied to all dimensions. If a sequence is given, it must have the same length asregularization_dim.
- Raises:
ValueError – If the
kdataandfourier_opareNoneor ifcsmis aCallablebutkdataisNone.ValueError – If
regularization_dimcontains repeated values.ValueError – If the length of
regularization_dimandregularization_weightdo not match
- max_iterations: int
Maximum number of PDHG iterations.
- tolerance: float
Tolerance of PDHG for relative change of the primal solution.
- regularization_dim: Sequence[int]
Dimensions along which the total variation reguarization is applied \(i\).
- regularization_weight: torch.Tensor
Strengths of the regularization along different dimensions \(l_i\).
- dcf: DcfData | None
Density Compensation Data.
- csm: CsmData | None
Coil Sensitivity Data.
- noise: KNoise | None
Noise Data used for prewhitening.
- fourier_op: LinearOperator
Fourier Operator.
- forward(kdata: KData) IData[source]
Apply the reconstruction.
- Parameters:
kdata (
KData) – k-space data to reconstruct.- Returns:
the reconstruced image.
- direct_reconstruction(kdata: KData) 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\). \(S\) and \(W\) are optional: If they have not been set in this instance, no coil combination or density compensation, respectively, will be performed.
- Parameters:
kdata (
KData) – k-space data- Returns:
image data
- recalculate_csm(kdata: KData, csm_calculation: Callable[[IData], CsmData] = CsmData.from_idata_walsh, noise: KNoise | None | Literal[False] = None) Self[source]
Update (in place) the CSM from KData.
- 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 theCsmData.noise (
Union[KNoise,None,Literal[False]], default:None) – Noise measurement for prewhitening. IfNone,self.noise(if previously set) is used. IfFalse, no prewithening is performed even ifself.noiseis set. Use this if thekdatais already prewhitened.