nlsam.denoiser

Module Contents

Functions

nlsam_denoise(data, sigma, bvals, bvecs, block_size[, ...])

Main nlsam denoising function which sets up everything nicely for the local

local_denoise(data, block_size, overlap, variance[, ...])

processer(data, mask, variance, block_size, overlap, ...)

Attributes

logger

nlsam.denoiser.logger
nlsam.denoiser.nlsam_denoise(data, sigma, bvals, bvecs, block_size, mask=None, is_symmetric=False, n_cores=-1, split_b0s=False, split_shell=False, subsample=True, n_iter=10, b0_threshold=10, bval_threshold=25, dtype=np.float64, verbose=False)

Main nlsam denoising function which sets up everything nicely for the local block denoising.

Input

datandarray

Input volume to denoise.

sigmandarray

Noise standard deviation estimation at each voxel. Converted to variance internally.

bvals1D array

the N bvalues associated to each of the N diffusion volume.

bvecsN x 3 2D array

the N 3D vectors for each acquired diffusion gradients.

block_sizetuple, length = data.ndim

Patch size + number of angular neighbors to process at once as similar data.

Optional parameters

maskndarray, default None

Restrict computations to voxels inside the mask to reduce runtime.

is_symmetricbool, default False

If True, assumes that for each coordinate (x, y, z) in bvecs, (-x, -y, -z) was also acquired.

n_coresint, default -1

Number of processes to use for the denoising. Default is to use all available cores.

split_b0sbool, default False

If True and the dataset contains multiple b0s, a different b0 will be used for each run of the denoising. If False, the b0s are averaged and the average b0 is used instead.

split_shellbool, default False

If True and the dataset contains multiple bvalues, each shell is processed independently. If False, all the data is used at the same time for computing angular neighbors.

subsamplebool, default True

If True, find the smallest subset of indices required to process each dwi at least once.

n_iterint, default 10

Maximum number of iterations for the reweighted l1 solver.

b0_thresholdint, default 10

A bvalue below b0_threshold will be considered as a b0 image.

bval_thresholdint, default 25

Any bvalue within += bval_threshold of each others will be considered on the same shell (e.g. b=990 and b=1000 are on the same shell).

dtypenp.float32 or np.float64, default np.float64

Precision to use for inner computations. Note that np.float32 should only be used for very, very large datasets (that is, your ram starts swapping) as it can lead to numerical precision errors.

verbosebool, default False

print useful messages.

Output

data_denoisedndarray

The denoised dataset

nlsam.denoiser.local_denoise(data, block_size, overlap, variance, n_iter=10, mask=None, dtype=np.float64, n_cores=-1, verbose=False)
nlsam.denoiser.processer(data, mask, variance, block_size, overlap, param_alpha, param_D, current_slice, dtype=np.float64, n_iter=10, gamma=3, tau=1, tolerance=1e-05)