Module Contents


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, dtype=np.float64, verbose=False)

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

local_denoise(data, block_size, overlap, variance, n_iter=10, mask=None, dtype=np.float64, n_cores=-1, verbose=False)

processer(data, mask, variance, block_size, overlap, param_alpha, param_D, dtype=np.float64, n_iter=10, gamma=3.0, tau=1.0, tolerance=1e-05)



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, dtype=np.float64, verbose=False)

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


Input volume to denoise.


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

bvals1D array

the N b-values 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.

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 b-values, 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 b-value below b0_threshold will be considered as a b0 image.

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.


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, dtype=np.float64, n_iter=10, gamma=3.0, tau=1.0, tolerance=1e-05)