Skip to content

Commit c9315ca

Browse files
authored
Merge pull request #2550 from satra/fix/dcm2niix
fix: undeprecate dcm2niix source_names option
2 parents 0e6b0f3 + d752ce7 commit c9315ca

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

nipype/interfaces/dcm2nii.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,18 @@ class Dcm2niixInputSpec(CommandLineInputSpec):
263263
argstr="%s",
264264
position=-1,
265265
copyfile=False,
266-
deprecated='1.0.2',
267-
new_name='source_dir',
268266
mandatory=True,
267+
desc=('A set of filenames to be converted. Note that the current '
268+
'version (1.0.20180328) of dcm2niix converts any files in the '
269+
'directory. To only convert specific files they should be in an '
270+
'isolated directory'),
269271
xor=['source_dir'])
270272
source_dir = Directory(
271273
exists=True,
272274
argstr="%s",
273275
position=-1,
274276
mandatory=True,
277+
desc='A directory containing dicom files to be converted',
275278
xor=['source_names'])
276279
out_filename = traits.Str(
277280
argstr="-f %s",
@@ -378,6 +381,18 @@ class Dcm2niix(CommandLine):
378381
>>> converter.cmdline
379382
'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n dicomdir'
380383
>>> converter.run() # doctest: +SKIP
384+
385+
# In the example below, we note that the current version of dcm2niix
386+
# converts any files in the directory containing the files in the list. We
387+
# also do not support nested filenames with this option. Thus all files
388+
# should have a common root directory.
389+
>>> converter = Dcm2niix()
390+
>>> converter.inputs.source_names = ['functional_1.dcm', 'functional_2.dcm']
391+
>>> converter.inputs.compression = 5
392+
>>> converter.inputs.output_dir = 'ds005'
393+
>>> converter.cmdline
394+
'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n .'
395+
>>> converter.run() # doctest: +SKIP
381396
"""
382397

383398
input_spec = Dcm2niixInputSpec
@@ -399,7 +414,7 @@ def _format_arg(self, opt, spec, val):
399414
spec.argstr += ' n'
400415
val = True
401416
if opt == 'source_names':
402-
return spec.argstr % val[0]
417+
return spec.argstr % (os.path.dirname(val[0]) or '.')
403418
return super(Dcm2niix, self)._format_arg(opt, spec, val)
404419

405420
def _run_interface(self, runtime):

nipype/interfaces/tests/test_auto_Dcm2niix.py

-2
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ def test_Dcm2niix_inputs():
6262
source_names=dict(
6363
argstr='%s',
6464
copyfile=False,
65-
deprecated='1.0.2',
6665
mandatory=True,
67-
new_name='source_dir',
6866
position=-1,
6967
xor=['source_dir'],
7068
),

0 commit comments

Comments
 (0)