Skip to content

Commit e474426

Browse files
committed
pep8, tests passing
1 parent c8e6874 commit e474426

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

nipype/interfaces/dipy/preprocess.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# @Author: oesteban
44
# @Date: 2014-09-01 10:33:35
55
# @Last Modified by: oesteban
6-
# @Last Modified time: 2014-09-01 11:27:55
6+
# @Last Modified time: 2014-09-02 01:12:14
77
from nipype.interfaces.base import (traits, TraitedSpec, BaseInterface,
88
File, isdefined)
99
from nipype.utils.filemanip import split_filename
@@ -29,11 +29,13 @@
2929
class ResampleInputSpec(TraitedSpec):
3030
in_file = File(exists=True, mandatory=True,
3131
desc='The input 4D diffusion-weighted image file')
32-
vox_size = traits.Tuple(traits.Float, traits.Float, traits.Float, desc=('specify the new '
33-
'voxel zooms. If no vox_size is set, then isotropic regridding will '
34-
'be performed, with spacing equal to the smallest current zoom.'))
35-
interp = traits.Int(1, mandatory=True, usedefault=True, desc=('order of the interpolator'
36-
'(0 = nearest, 1 = linear, etc.'))
32+
vox_size = traits.Tuple(traits.Float, traits.Float, traits.Float,
33+
desc=('specify the new voxel zooms. If no vox_size'
34+
' is set, then isotropic regridding will '
35+
'be performed, with spacing equal to the '
36+
'smallest current zoom.'))
37+
interp = traits.Int(1, mandatory=True, usedefault=True, desc=('order of '
38+
'the interpolator (0 = nearest, 1 = linear, etc.'))
3739

3840

3941
class ResampleOutputSpec(TraitedSpec):
@@ -43,7 +45,8 @@ class ResampleOutputSpec(TraitedSpec):
4345
class Resample(BaseInterface):
4446
"""
4547
An interface to reslicing diffusion datasets.
46-
See http://nipy.org/dipy/examples_built/reslice_datasets.html#example-reslice-datasets.
48+
See
49+
http://nipy.org/dipy/examples_built/reslice_datasets.html#example-reslice-datasets.
4750
4851
Example
4952
-------
@@ -87,7 +90,8 @@ class DenoiseInputSpec(TraitedSpec):
8790
in_file = File(exists=True, mandatory=True,
8891
desc='The input 4D diffusion-weighted image file')
8992
in_mask = File(exists=True, desc='brain mask')
90-
noise_model = traits.Enum('rician', 'gaussian', mandatory=True, usedefault=True,
93+
noise_model = traits.Enum('rician', 'gaussian', mandatory=True,
94+
usedefault=True,
9195
desc=('noise distribution model'))
9296

9397

@@ -98,13 +102,15 @@ class DenoiseOutputSpec(TraitedSpec):
98102
class Denoise(BaseInterface):
99103
"""
100104
An interface to denoising diffusion datasets [Coupe2008]_.
101-
See http://nipy.org/dipy/examples_built/denoise_nlmeans.html#example-denoise-nlmeans.
105+
See
106+
http://nipy.org/dipy/examples_built/denoise_nlmeans.html#example-denoise-nlmeans.
102107
103-
.. [Coupe2008] P. Coupe, P. Yger, S. Prima, P. Hellier, C. Kervrann, C. Barillot,
104-
`An Optimized Blockwise Non Local Means Denoising Filter for 3D Magnetic Resonance Images
108+
.. [Coupe2008] Coupe P et al., `An Optimized Blockwise Non Local Means
109+
Denoising Filter for 3D Magnetic Resonance Images
105110
<http://dx.doi.org/10.1109%2FTMI.2007.906087>`_,
106111
IEEE Transactions on Medical Imaging, 27(4):425-441, 2008.
107112
113+
108114
Example
109115
-------
110116
@@ -124,7 +130,7 @@ def _run_interface(self, runtime):
124130
mask = nb.load(self.inputs.in_mask).get_data()
125131

126132
nlmeans_proxy(self.inputs.in_file, in_mask=mask,
127-
rician=(self.inputs.noise_model=='rician'),
133+
rician=(self.inputs.noise_model == 'rician'),
128134
out_file=out_file)
129135
iflogger.info('Denoised image saved as {i}'.format(i=out_file))
130136
return runtime
@@ -141,6 +147,7 @@ def _gen_outfilename(self):
141147
fext = fext2 + fext
142148
return op.abspath('%s_denoise%s' % (fname, fext))
143149

150+
144151
def resample_proxy(in_file, order=3, new_zooms=None, out_file=None):
145152
"""
146153
Performs regridding of an image to set isotropic voxel sizes using dipy.
@@ -205,4 +212,3 @@ def nlmeans_proxy(in_file, in_mask=None, rician=True, out_file=None):
205212
nb.Nifti1Image(den.astype(hdr.get_data_dtype()), aff,
206213
hdr).to_filename(out_file)
207214
return out_file
208-

0 commit comments

Comments
 (0)