Skip to content

Commit fd4b8bd

Browse files
committed
ENH: Dcm2niix - add mvec output
1 parent cdfe679 commit fd4b8bd

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ class Dcm2nii(CommandLine):
119119
>>> converter.inputs.gzip_output = True
120120
>>> converter.inputs.output_dir = '.'
121121
>>> converter.cmdline # doctest: +ELLIPSIS
122-
'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm'"""
122+
'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm'
123+
"""
123124

124125
input_spec = Dcm2niiInputSpec
125126
output_spec = Dcm2niiOutputSpec
@@ -374,6 +375,7 @@ class Dcm2niixInputSpec(CommandLineInputSpec):
374375
class Dcm2niixOutputSpec(TraitedSpec):
375376
converted_files = OutputMultiPath(File(exists=True))
376377
bvecs = OutputMultiPath(File(exists=True))
378+
mvecs = OutputMultiPath(File(exists=True))
377379
bvals = OutputMultiPath(File(exists=True))
378380
bids = OutputMultiPath(File(exists=True))
379381

@@ -456,8 +458,8 @@ def _parse_stdout(self, stdout):
456458
return filenames
457459

458460
def _parse_files(self, filenames):
459-
outfiles, bvals, bvecs, bids = [], [], [], []
460-
outtypes = [".bval", ".bvec", ".json", ".txt"]
461+
outfiles, bvals, bvecs, mvecs, bids = [], [], [], [], []
462+
outtypes = [".bval", ".bvec", ".mvec", ".json", ".txt"]
461463
if self.inputs.to_nrrd:
462464
outtypes += [".nrrd", ".nhdr", ".raw.gz"]
463465
else:
@@ -477,10 +479,13 @@ def _parse_files(self, filenames):
477479
bvals.append(fl)
478480
elif fl.endswith(".bvec"):
479481
bvecs.append(fl)
482+
elif fl.endswith(".mvec"):
483+
mvecs.append(fl)
480484
elif fl.endswith(".json") or fl.endswith(".txt"):
481485
bids.append(fl)
482486
self.output_files = outfiles
483487
self.bvecs = bvecs
488+
self.mvecs = mvecs
484489
self.bvals = bvals
485490
self.bids = bids
486491

@@ -489,6 +494,7 @@ def _list_outputs(self):
489494
outputs["converted_files"] = self.output_files
490495
outputs["bvecs"] = self.bvecs
491496
outputs["bvals"] = self.bvals
497+
outputs["mvecs"] = self.mvecs
492498
outputs["bids"] = self.bids
493499
return outputs
494500

nipype/interfaces/tests/test_auto_Dcm2niix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def test_Dcm2niix_outputs():
9595
bvals=dict(),
9696
bvecs=dict(),
9797
converted_files=dict(),
98+
mvecs=dict(),
9899
)
99100
outputs = Dcm2niix.output_spec()
100101

0 commit comments

Comments
 (0)