Skip to content
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

Empty output files list if filename contains metacharacters in dcm2nii #3416

Closed
qian587 opened this issue Nov 29, 2021 · 0 comments · Fixed by #3417
Closed

Empty output files list if filename contains metacharacters in dcm2nii #3416

qian587 opened this issue Nov 29, 2021 · 0 comments · Fixed by #3417

Comments

@qian587
Copy link

qian587 commented Nov 29, 2021

Summary

If the dcm2nii output file names contain regex metacharacters (eg: [] or *) nipype dcm2nii interface is not able to parse the output filename properly and will return empty output files.

Actual behavior

from nipype.interfaces.dcm2nii import Dcm2niix
converter = Dcm2niix()
converter.inputs.source_dir = 'testdicomdir'
converter.inputs.anon_bids = True
converter.inputs.bids_format = True
converter.inputs.compress = 'y'
converter.inputs.compression = 6
converter.inputs.out_filename = '%d'
output = converter.run()
>>> Convert 109 DICOM as /opt/work/[DICOMEXAMPLE_-_Frame_1_of_6] 
Compress: "/usr/bin/pigz" -b 960 -n -f -6 "/opt/work/[DICOMEXAMPLE_-_Frame_1_of_6].nii"

output.outputs 
>>> bids = <undefined>
>>> bvals = <undefined>
>>> bvecs = <undefined>
>>> converted_files = <undefined>

Expected behavior

output.outputs 
>>> bids = <undefined>
>>> bvals = <undefined>
>>> bvecs = <undefined>
>>> converted_files = <undefined>
bids = ['/opt/work/[DICOMEXAMPLE_-_Frame_1_of_6].json']
bvals = <undefined>
bvecs = <undefined>
converted_files = ['/opt/work/[DICOMEXAMPLE_-_Frame_1_of_6].nii.gz']

How to replicate the behavior

Set the output filename template to a name that contains metacharacters

Platform details:

nipype.get_info()
{'pkg_path': '/usr/local/lib/python3.6/dist-packages/nipype', 'commit_source': 'installation', 'commit_hash': '071523a50', 'nipype_version': '1.5.1', 'sys_version': '3.6.9 (default, Jan 26 2021, 15:33:00) \n[GCC 8.4.0]', 'sys_executable': '/usr/bin/python3', 'sys_platform': 'linux', 'numpy_version': '1.18.5', 'scipy_version': '1.5.4', 'networkx_version': '2.5.1', 'nibabel_version': '3.1.1', 'traits_version': '6.2.0'}

Execution environment

  • Container: neurodebian:bionic
  • Python version: 3.6.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant