Non Local Spatial and Angular Matching (NLSAM) denoising

Readme from the project

Non Local Spatial and Angular Matching (NLSAM) denoising

The reference implementation for the Non Local Spatial and Angular Matching (NLSAM) denoising algorithm for diffusion MRI.

You can find the latest documentation and installation instructions over here with a downloadable version of the documentation here.

How to install

The new easy way is to use the Dockerfile. for which you’ll need to install docker (probably already available in your favorite linux distribution).

The old easiest way is to go grab a release, in which case the downloaded zip file contains everything you need (no python installation required, you can use it straight away without installing anything else). After extracting the zip file, start a terminal/command line prompt (start button, then type cmd + enter on windows) and navigate to where you extracted the binaries.

Since the tools are command line only, double-clicking it will open and immediately close a dos-like window, hence the need for opening a command line prompt.

If you have a working python setup already, the next command should give you everything you need.

pip install --user --process-dependency-links

If you would like to look at the code and modify it, you can also clone it locally and then install everything through pip after grabbing some dependencies

git clone
pip install -e nlsam

You can also download the datasets used in the paper over here.

Using the NLSAM algorithm

The process is to first transform your data to Gaussian distributed signals if your dataset is Rician or Noncentral chi distributed and then proceed to the NLSAM denoising part itself.

A quickstart example call would be

nlsam_denoising dwi.nii.gz dwi_nlsam.nii.gz 1 bvals bvecs 5 -m mask.nii.gz

For more fine grained control and explanation of arguments, have a look at the possible command line options with nlsam_denoising –help

You can find a detailed usage example and assorted dataset to try out in the example folder.

Questions / Need help / Think this is great software?

If you need help or would like more information, don’t hesitate to drop me a line at, where of course firstname needs to be replaced with samuel.


The NLSAM denoising algorithm itself is detailed in

St-Jean, S., Coupé, P., & Descoteaux, M. (2016). “Non Local Spatial and Angular Matching : Enabling higher spatial resolution diffusion MRI datasets through adaptive denoising” Medical Image Analysis, 32(2016), 115–130. DOI URL

The bias correction framework is a reimplementation of

Koay, CG, Özarslan, E and Basser, PJ A signal transformational framework for breaking the noise floor and its applications in MRI, Journal of Magnetic Resonance, Volume 197, Issue 2, 2009

The automatic estimation of the noise distribution is computed with

St-Jean S, De Luca A, Tax C.M.W., Viergever M.A, Leemans A. (2020) “Automated characterization of noise distributions in diffusion MRI data.” Medical Image Analysis, October 2020:101758. doi:10.1016/

And here is a premade bibtex entry.

  author = {St-Jean, Samuel and Coup{\'{e}}, Pierrick and Descoteaux, Maxime},
  doi = {10.1016/},
  journal = {Medical Image Analysis},
  pages = {115--130},
  title = {{Non Local Spatial and Angular Matching : Enabling higher spatial resolution diffusion MRI datasets through adaptive denoising}},
  volume = {32},
  year = {2016}
Postdoctoral Researcher

I am a postdoctoral research developping new methods to analyze diffusion MRI datasets.