designer.preprocessing.smoothing.nansmooth(imgslice, fwhm, size=5)

Smooths an image slice while ignoring NaNs

Parameters
  • imgslice ((X x Y) img_like or array_like object) – 2D image to be smoothed

  • fwhm (float) – The full width half max to be used for smoothing

  • size (int, optional) – The size of 2D Gaussian kernel [size, size]. Default: 5

Returns

gauss – 2D smoothed image

Return type

(X x Y) array_like object

Notes

Intensity is only shifted between not-nan pixels and is hence conserved. The intensity redistribution with respect to each single point is done by the weights of available pixels according to a gaussian distribution. All nans in imgslice, stay nans in gauss. This approach is to spead the intesity of each point by a gaussian filter. The intensity, which is mapped to nan-pixels is reshifted back to the origin. If this maskes sense, depends on the application. I have a closed area surronded by nans and want to preseve the total intensity + avoid distortions at the boundaries.

Solution adapted from https://stackoverflow.com/a/61481246

designer.preprocessing.smoothing.smooth(dwi, csfmask=None, width=1.25, size=5)

Smooths a DWI dataset

Parameters
  • dwi ((X x Y x Z x N) img_like object) – Image to be smoothed, where N is the number of volumes in the DWI acquisition.

  • csfmask ((S) img_like object) – The mask of CSF that will be applied to each volume in DWI

  • width (float, optional) – The full width half max in voxels to be smoothed. Default: 1.25

  • size (int, optional) – The size of 2D Gaussian kernel [size, size]. Default: 5

Returns

smoothed – The smoothed version of dwi

Return type

(X x Y x Z x N) array_like or img_like object

Notes

This is done mainly to reduce the Gibbs ringing. It might be recommended to only smooth the high SNR (or b-valued) data in order not to alter the Rice distribution of the low SNR data. This is important to maintain the high accuracy of WLLS. If a CSF mask is given as an additional argument, CSF infiltration in microstructural signal is avoided during smoothing.

designer.preprocessing.smoothing.smooth_image(dwiname, csfname=None, outname='dwism.nii', width=1.25, size=5)

Smooths a DWI dataset

Parameters
  • dwiname (str) – Filename of image to be smoothed

  • csfname (str, optional) – Filename of CSF mask

  • outname (str) – Filename to be written out

  • width (float, optional) – The full width half max in voxels to be smoothed. Default: 1.25

  • size (int) – The size of 2D Gaussian kernel [size, size]. Default: 5

Return type

None; writes out file

See also

smooth, csfmask, width