|
11 | 11 | from .base import MRTrix3BaseInputSpec, MRTrix3Base
|
12 | 12 |
|
13 | 13 |
|
| 14 | +class DWIDenoiseInputSpec(MRTrix3BaseInputSpec): |
| 15 | + in_file = File( |
| 16 | + exists=True, |
| 17 | + argstr='%s', |
| 18 | + position=-2, |
| 19 | + mandatory=True, |
| 20 | + desc='input DWI image') |
| 21 | + mask = File( |
| 22 | + exists=True, |
| 23 | + argstr='-mask %s', |
| 24 | + position=1, |
| 25 | + desc='mask image') |
| 26 | + extent = traits.Tuple((traits.Int, traits.Int, traits.Int), |
| 27 | + argstr='-extent %d,%d,%d', |
| 28 | + desc='set the window size of the denoising filter. (default = 5,5,5)') |
| 29 | + noise = File( |
| 30 | + argstr='-noise %s', |
| 31 | + desc='noise map') |
| 32 | + out_file = File(name_template='%s_denoised', |
| 33 | + name_source='in_file', |
| 34 | + keep_extension=True, |
| 35 | + argstr="%s", |
| 36 | + position=-1, |
| 37 | + desc="the output denoised DWI image") |
| 38 | + |
| 39 | +class DWIDenoiseOutputSpec(TraitedSpec): |
| 40 | + out_file = File(desc="the output denoised DWI image", exists=True) |
| 41 | + |
| 42 | +class DWIDenoise(MRTrix3Base): |
| 43 | + """ |
| 44 | + Denoise DWI data and estimate the noise level based on the optimal |
| 45 | + threshold for PCA. |
| 46 | +
|
| 47 | + DWI data denoising and noise map estimation by exploiting data redundancy |
| 48 | + in the PCA domain using the prior knowledge that the eigenspectrum of |
| 49 | + random covariance matrices is described by the universal Marchenko Pastur |
| 50 | + distribution. |
| 51 | +
|
| 52 | + Important note: image denoising must be performed as the first step of the |
| 53 | + image processing pipeline. The routine will fail if interpolation or |
| 54 | + smoothing has been applied to the data prior to denoising. |
| 55 | +
|
| 56 | + Note that this function does not correct for non-Gaussian noise biases. |
| 57 | +
|
| 58 | + For more information, see |
| 59 | + <https://mrtrix.readthedocs.io/en/latest/reference/commands/dwidenoise.html> |
| 60 | +
|
| 61 | + Example |
| 62 | + ------- |
| 63 | +
|
| 64 | + >>> import nipype.interfaces.mrtrix3 as mrt |
| 65 | + >>> denoise = mrt.DWIDenoise() |
| 66 | + >>> denoise.inputs.in_file = 'dwi.mif' |
| 67 | + >>> denoise.inputs.mask = 'mask.mif' |
| 68 | + >>> denoise.cmdline # doctest: +ELLIPSIS |
| 69 | + 'dwidenoise -mask mask.mif dwi.mif dwi_denoised.mif' |
| 70 | + >>> denoise.run() # doctest: +SKIP |
| 71 | + """ |
| 72 | + |
| 73 | + _cmd = 'dwidenoise' |
| 74 | + input_spec = DWIDenoiseInputSpec |
| 75 | + output_spec = DWIDenoiseOutputSpec |
| 76 | + |
| 77 | + |
14 | 78 | class ResponseSDInputSpec(MRTrix3BaseInputSpec):
|
15 | 79 | algorithm = traits.Enum(
|
16 | 80 | 'msmt_5tt',
|
|
0 commit comments