nlsam.smoothing

Module Contents

Functions

sh_smooth(data, bvals, bvecs[, sh_order, ...])

Smooth the raw diffusion signal with spherical harmonics.

_local_standard_deviation(arr[, current_slice])

Standard deviation estimation from local patches.

local_standard_deviation(arr[, n_cores, verbose])

Standard deviation estimation from local patches.

Attributes

logger

nlsam.smoothing.logger
nlsam.smoothing.sh_smooth(data, bvals, bvecs, sh_order=4, b0_threshold=1.0, similarity_threshold=50, regul=0.006)

Smooth the raw diffusion signal with spherical harmonics.

datandarray

The diffusion data to smooth.

gtabgradient table object

Corresponding gradients table object to data.

b0_thresholdfloat, default 1.0

Threshold to consider this bval as a b=0 image.

sh_orderint, default 8

Order of the spherical harmonics to fit.

similarity_thresholdint, default 50

All bvalues such that |b_1 - b_2| < similarity_threshold will be considered as identical for smoothing purpose. Must be lower than 200.

regulfloat, default 0.006

Amount of regularization to apply to sh coefficients computation.

Returns:

pred_sig – The smoothed diffusion data, fitted through spherical harmonics.

Return type:

ndarray

nlsam.smoothing._local_standard_deviation(arr, current_slice=None)

Standard deviation estimation from local patches.

Estimates the local variance on patches by using convolutions to estimate the mean. This is the multiprocessed function.

Parameters:
  • arr (3D or 4D ndarray) – The array to be estimated

  • current_slice (numpy slice object) – current slice to evaluate if we are running in parallel

Returns:

sigma – Map of standard deviation of the noise.

Return type:

ndarray

nlsam.smoothing.local_standard_deviation(arr, n_cores=-1, verbose=False)

Standard deviation estimation from local patches.

The noise field is estimated by subtracting the data from it’s low pass filtered version, from which we then compute the variance on a local neighborhood basis.

Parameters:
  • arr (3D or 4D ndarray) – The array to be estimated

  • n_cores (int) – Number of cores to use for multiprocessing, default : all of them

  • verbose (int) – If True, prints progress information. A higher number prints more often

Returns:

sigma – Map of standard deviation of the noise.

Return type:

ndarray