Skip to content

Commit fbf5db1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix/bedpostx
* upstream/master: fix: change where nlmeans check is made fix: topup when out_base is a path
2 parents c8e82c0 + 9ce39c6 commit fbf5db1

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

nipype/interfaces/dipy/preprocess.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,6 @@ class Denoise(BaseInterface):
128128
input_spec = DenoiseInputSpec
129129
output_spec = DenoiseOutputSpec
130130

131-
def __init__(self, **inputs):
132-
try:
133-
package_check('dipy', version='0.8.0.dev')
134-
except Exception, e:
135-
have_dipy = False
136-
else:
137-
from dipy.denoise.nlmeans import nlmeans
138-
BaseInterface.__init__(self, **inputs)
139-
140131
def _run_interface(self, runtime):
141132
out_file = op.abspath(self._gen_outfilename())
142133

@@ -218,6 +209,8 @@ def nlmeans_proxy(in_file, settings,
218209
"""
219210
Uses non-local means to denoise 4D datasets
220211
"""
212+
package_check('dipy', version='0.8.0.dev')
213+
from dipy.denoise.nlmeans import nlmeans
221214

222215
if out_file is None:
223216
fname, fext = op.splitext(op.basename(in_file))

nipype/interfaces/fsl/epi.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,27 @@ class TOPUP(FSLCommand):
248248
def _format_arg(self, name, trait_spec, value):
249249
if name == 'encoding_direction':
250250
return trait_spec.argstr % self._generate_encfile()
251+
if name == 'out_base':
252+
path, name, ext = split_filename(value)
253+
if path != '':
254+
if not os.path.exists(path):
255+
raise ValueError('out_base path must exist if provided')
251256
return super(TOPUP, self)._format_arg(name, trait_spec, value)
252257

253258
def _list_outputs(self):
254259
outputs = super(TOPUP, self)._list_outputs()
255260
del outputs['out_base']
261+
base_path = None
256262
if isdefined(self.inputs.out_base):
257-
base = self.inputs.out_base
263+
base_path, base, _ = split_filename(self.inputs.out_base)
264+
if base_path == '':
265+
base_path = None
258266
else:
259267
base = split_filename(self.inputs.in_file)[1] + '_base'
260-
outputs['out_fieldcoef'] = self._gen_fname(base, suffix='_fieldcoef')
268+
outputs['out_fieldcoef'] = self._gen_fname(base, suffix='_fieldcoef',
269+
cwd=base_path)
261270
outputs['out_movpar'] = self._gen_fname(base, suffix='_movpar',
262-
ext='.txt')
271+
ext='.txt', cwd=base_path)
263272

264273
if isdefined(self.inputs.encoding_direction):
265274
outputs['out_enc_file'] = self._get_encfilename()

0 commit comments

Comments
 (0)