mrpro.algorithms.total_variation_denoising
- mrpro.algorithms.total_variation_denoising(idata: IData, regularization_dim: Sequence[int], regularization_weight: float | Sequence[float] | Sequence[Tensor], initial_image: Tensor | None = None, max_iterations: int = 100, tolerance: float = 0) IData[source]
- mrpro.algorithms.total_variation_denoising(idata: Tensor, regularization_dim: Sequence[int], regularization_weight: float | Sequence[float] | Sequence[Tensor], initial_image: Tensor | None = None, max_iterations: int = 100, tolerance: float = 0) Tensor
Apply total variation denoising.
This algorithm solves the problem \(min_x \frac{1}{2}||x - y||_2^2 + \\sum_i l_i ||\nabla_i x||_1\) by using the PDHG-algorithm. \(y\) is the given noisy image, \(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\).
- Parameters:
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.initial_image (
Tensor|None, default:None) – Initial image. IfNonethen the target image \(y\) will be used.max_iterations (
int, default:100) – Maximum number of PDHG iterations.tolerance (
float, default:0) – Tolerance of PDHG for relative change of the primal solution; if zero,max_iterationsof PDHG are run.
- Returns:
the denoised image.