tomobar.regularisersCuPy

tomobar.regularisersCuPy#

tomobar.regularisersCuPy.PD_TV_cupy(data: <cp.ndarray>, regularisation_parameter: float = 1e-05, iterations: int = 1000, methodTV: int = 0, nonneg: int = 0, lipschitz_const: float = 8.0, gpu_id: int = 0, half_precision: bool = False) <cp.ndarray>[source]#
Primal Dual algorithm for non-smooth convex Total Variation functional.

Ref: Chambolle, Pock, “A First-Order Primal-Dual Algorithm for Convex Problems with Applications to Imaging”, 2010.

Parameters:
  • data (cp.ndarray) – A 2d or 3d CuPy array.

  • regularisation_parameter (float) – Regularisation parameter to control the level of smoothing. Defaults to 1e-05.

  • iterations (int) – The number of iterations. Defaults to 1000.

  • methodTV (int) – Choose between isotropic (0) or anisotropic (1) case for TV norm.

  • nonneg (int) – Enable non-negativity in updates by selecting 1. Defaults to 0.

  • lipschitz_const (float) – Lipschitz constant to control convergence.

  • gpu_id (int) – A GPU device index to perform operation on. Defaults to 0.

  • half_precision (bool) – Perform some computations in half-precision, potentially leads to better performance. Defaults to False.

Returns:

PD-TV filtered CuPy array.

Return type:

cp.ndarray

tomobar.regularisersCuPy.ROF_TV_cupy(data: <cp.ndarray>, regularisation_parameter: float = 1e-05, iterations: int = 3000, time_marching_parameter: float = 0.001, gpu_id: int = 0, half_precision: bool = False) <cp.ndarray>[source]#
Total Variation using Rudin-Osher-Fatemi (ROF) explicit iteration scheme to perform edge-preserving image denoising.

This is a gradient-based algorithm for a smoothed TV term which requires a small time marching parameter and a significant number of iterations. Ref: Rudin, Osher, Fatemi, “Nonlinear Total Variation based noise removal algorithms”, 1992.

Parameters:
  • data (cp.ndarray) – A 2d or 3d CuPy array.

  • regularisation_parameter (float) – Regularisation parameter to control the level of smoothing. Defaults to 1e-05.

  • iterations (int) – The number of iterations. Defaults to 3000.

  • time_marching_parameter (float) – Time marching parameter, needs to be small to ensure convergance. Defaults to 0.001.

  • gpu_id (int) – A GPU device index to perform operation on. Defaults to 0.

  • half_precision (bool) – Perform some computations in half-precision, potentially leads to better performance. Defaults to False.

Returns:

ROF-TV filtered CuPy array.

Return type:

cp.ndarray

tomobar.regularisersCuPy.prox_regul(self, X: <cp.ndarray>, _regularisation_: dict) <cp.ndarray>[source]#

Enabling proximal operators (regularisers) in iterative reconstruction.

Parameters:
  • X (cp.ndarray) – 2D or 3D CuPy array.

  • _regularisation_ (dict) – Regularisation dictionary with parameters, see tomobar.supp.dicts.

Returns:

Filtered 2D or 3D CuPy array.

Return type:

cp.ndarray