Skip to content

Commit 900e48b

Browse files
committed
BF: split prefix into path (if any) and provide only basename as prefix for dcm2niix invocation
dcm2niix started to segfault whenever -f is too long. rordenlab/dcm2niix#465 And it feels that we abused -f wherever -o should have been used. I have not looked though through history of changes if such use of -f was warranted, but as I see that output_dir is not explicitely defined, decided to just use that one instead. this seems to resolve the dcm2niix segfault during heudiconv/tests/test_heuristics.py::test_scans_keys_reproin when testing on my laptop
1 parent ee5cebb commit 900e48b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

heudiconv/convert.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,11 @@ def nipype_convert(item_dicoms, prefix, with_prov, bids_options, tmpdir, dcmconf
614614
convertnode = Node(Dcm2niix(from_file=fromfile), name='convert')
615615
convertnode.base_dir = tmpdir
616616
convertnode.inputs.source_names = item_dicoms
617-
convertnode.inputs.out_filename = prefix
617+
convertnode.inputs.out_filename = op.basename(prefix)
618+
prefix_dir = op.dirname(prefix)
619+
# if provided prefix had a path in it -- pass is as output_dir instead of default curdir
620+
if prefix_dir:
621+
convertnode.inputs.output_dir = prefix_dir
618622

619623
if nipype.__version__.split('.')[0] == '0':
620624
# deprecated since 1.0, might be needed(?) before

0 commit comments

Comments
 (0)