8000 Issue 3553 add mvecs to dcm2niix by pvelasco · Pull Request #3554 · nipy/nipype · GitHub
[go: up one dir, main page]

Skip to content

Issue 3553 add mvecs to dcm2niix #3554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ENH: Dcm2niix - add mvec output
  • Loading branch information
pvelasco committed Mar 23, 2023
commit fd4b8bdb47eda74011ffceeccb5fcc5ea15547d0
12 changes: 9 additions & 3 deletions nipype/interfaces/dcm2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ class Dcm2nii(CommandLine):
>>> converter.inputs.gzip_output = True
>>> converter.inputs.output_dir = '.'
>>> converter.cmdline # doctest: +ELLIPSIS
'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'"""
'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'
"""

input_spec = Dcm2niiInputSpec
output_spec = Dcm2niiOutputSpec
Expand Down Expand Up @@ -374,6 +375,7 @@ class Dcm2niixInputSpec(CommandLineInputSpec):
class Dcm2niixOutputSpec(TraitedSpec):
converted_files = OutputMultiPath(File(exists=True))
bvecs = OutputMultiPath(File(exists=True))
mvecs = OutputMultiPath(File(exists=True))
bvals = OutputMultiPath(File(exists=True))
bids = OutputMultiPath(File(exists=True))

Expand Down Expand Up @@ -456,8 +458,8 @@ def _parse_stdout(self, stdout):
return filenames

def _parse_files(self, filenames):
outfiles, bvals, bvecs, bids = [], [], [], []
outtypes = [".bval", ".bvec", ".json", ".txt"]
outfiles, bvals, bvecs, mvecs, bids = [], [], [], [], []
outtypes = [".bval", ".bvec", ".mvec", ".json", ".txt"]
if self.inputs.to_nrrd:
outtypes += [".nrrd", ".nhdr", ".raw.gz"]
else:
Expand All @@ -477,10 +479,13 @@ def _parse_files(self, filenames):
bvals.append(fl)
elif fl.endswith(".bvec"):
bvecs.append(fl)
elif fl.endswith(".mvec"):
mvecs.append(fl)
elif fl.endswith(".json") or fl.endswith(".txt"):
bids.append(fl)
self.output_files = outfiles
self.bvecs = bvecs
self.mvecs = mvecs
self.bvals = bvals
self.bids = bids

Expand All @@ -489,6 +494,7 @@ def _list_outputs(self):
outputs["converted_files"] = self.output_files
outputs["bvecs"] = self.bvecs
outputs["bvals"] = self.bvals
outputs["mvecs"] = self.mvecs
outputs["bids"] = self.bids
return outputs

Expand Down
1 change: 1 addition & 0 deletions nipype/interfaces/tests/test_auto_Dcm2niix.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_Dcm2niix_outputs():
bvals=dict(),
bvecs=dict(),
converted_files=dict(),
mvecs=dict(),
)
outputs = Dcm2niix.output_spec()

Expand Down
0