OptimalSVDDenoiser#

class patch_denoise.space_time.lowrank.OptimalSVDDenoiser(patch_shape, patch_overlap, loss='fro', recombination='weighted')[source]#

Bases: BaseSpaceTimeDenoiser

Optimal Shrinkage of singular values for a specific norm.

Parameters:
  • patch_shape (tuple) – The patch shape

  • patch_overlap (tuple) – the overlap of each pixel

  • recombination (str, optional) – The recombination method of the patch. “weighted”, “average” or “center”. default “weighted”.

  • loss (str) – The loss determines the choice of the optimal thresholding function associated to it. The losses “fro”, “nuc” and “op” are supported, for the frobenius, nuclear and operator norm, respectively.

Methods

__init__

denoise

Optimal thresholing denoising method.

_patch_processing(patch, patch_idx=None, shrink_func=None, mp_median=None, var_apriori=None)[source]#

Process a patch.

Implemented by child classes.

denoise(input_data, mask=None, mask_threshold=50, noise_std=None, eps_marshenko_pastur=1e-07, progbar=None)[source]#

Optimal thresholing denoising method.

Parameters:
  • input_data (numpy.ndarray) – The input data to denoise. It should be a ND array, and the last dimension should a dynamically varying one (eg time).

  • progbar (tqdm.tqdm Progress bar, optiononal) – An existing Progressbar, default (None) will create a new one.

mask: numpy.ndarray

A boolean array, defining a ROI in the volume. Only patch with voxels in the ROI will be processed.

mask_threshold: int

percentage of the path that has to be in the mask so that the patch is processed. if mask_threshold = -1, all the patch are processed, if mask_threshold=100, all the voxels of the patch needs to be in the mask

noise_std: float or numpy.ndarray

An estimation of the spatial noise map standard deviation.

loss: str

The loss for which the optimal thresholding is performed.

eps_marshenko_pastur: float

The precision with which the optimal threshold is computed.

Returns:

numpy.ndarray: The denoised sequence of volume numpy.ndarray: The weight of each pixel after the processing. numpy.ndarray: If possible, the noise variance distribution in the volume numpy.ndarray: If possible, the rank of each patch in the volume.

Return type:

tuple

Notes

Reimplementation of the original Matlab code [1] in python.

References