Skip to content

Commit ba78e42

Browse files
committed
fix: updated interface for dcm2niix's latest version
1 parent 3f336b4 commit ba78e42

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ class Dcm2niixInputSpec(CommandLineInputSpec):
220220
desc="Convert only one image (filename as last input")
221221
verbose = traits.Bool(False, argstr='-v', usedefault=True,
222222
desc="Verbose output")
223+
crop = traits.Bool(False, argstr='-x', usedefault=True,
224+
desc="Crop 3D T1 acquisitions")
225+
has_private = traits.Bool(False, argstr='-t', usedefault=True,
226+
desc="Flag if text notes includes private patient details")
223227

224228

225229
class Dcm2niixOutputSpec(TraitedSpec):
@@ -240,15 +244,16 @@ class Dcm2niix(CommandLine):
240244
>>> converter.inputs.single_file = True
241245
>>> converter.inputs.output_dir = '.'
242246
>>> converter.cmdline
243-
'dcm2niix -b y -z i -m n -f %t%p -o . -s y -v n functional_1.dcm'
247+
'dcm2niix -b y -z i -m n -f %t%p -o . -s y -v n -x n -t n functional_1.dcm'
244248
"""
245249

246250
input_spec = Dcm2niixInputSpec
247251
output_spec = Dcm2niixOutputSpec
248252
_cmd = 'dcm2niix'
249253

250254
def _format_arg(self, opt, spec, val):
251-
if opt in ['bids_format', 'merge_imgs', 'single_file', 'verbose']:
255+
if opt in ['bids_format', 'merge_imgs', 'single_file', 'verbose', 'crop',
256+
'has_private']:
252257
spec = deepcopy(spec)
253258
if val:
254259
spec.argstr += ' y'
@@ -299,7 +304,7 @@ def _parse_stdout(self, stdout):
299304
if out_file:
300305
files.append(out_file + ".nii.gz")
301306
if self.inputs.bids_format:
302-
bids.append(out_file + ".bids")
307+
bids.append(out_file + ".json")
303308
continue
304309
skip = False
305310
# just return what was done

nipype/interfaces/tests/test_auto_Dcm2niix.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ def test_Dcm2niix_inputs():
1212
compress=dict(argstr='-z %s',
1313
usedefault=True,
1414
),
15+
crop=dict(argstr='-x',
16+
usedefault=True,
17+
),
1518
environ=dict(nohash=True,
1619
usedefault=True,
1720
),
21+
has_private=dict(argstr='-t',
22+
usedefault=True,
23+
),
1824
ignore_exception=dict(nohash=True,
1925
usedefault=True,
2026
),

0 commit comments

Comments
 (0)