Skip to content

Commit 321c427

Browse files
committed
debugged out_file_path and converted out_dir type to Path from directory (to avoid it being included in the inputs hash)
1 parent 9053fe9 commit 321c427

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

pydra/tasks/dcm2niix/utils.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ def out_file_path(out_dir, filename, file_postfix, ext):
1818
neighbours = [
1919
str(p) for p in fpath.parent.iterdir() if p.name.endswith(ext)
2020
]
21-
raise ValueError(
22-
f"\nDid not find expected file '{fpath}' (file_postfix={file_postfix}) "
23-
"after DICOM -> NIfTI conversion, please see "
24-
"https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md for the "
25-
"list of postfixes that dcm2niix produces and provide an appropriate "
26-
"postfix, or set postfix to None to ignore matching a single file and use "
27-
"the list returned in 'out_files' instead. Found the following files "
28-
"with matching extensions:\n" + "\n".join(neighbours)
29-
)
21+
if len(neighbours) == 1 and file_postfix is attrs.NOTHING:
22+
fpath = neighbours[0]
23+
else:
24+
raise ValueError(
25+
f"\nDid not find expected file '{fpath}' (file_postfix={file_postfix}) "
26+
"after DICOM -> NIfTI conversion, please see "
27+
"https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md for the "
28+
"list of postfixes that dcm2niix produces and provide an appropriate "
29+
"postfix, or set postfix to None to ignore matching a single file and use "
30+
"the list returned in 'out_files' instead. Found the following files "
31+
"with matching extensions:\n" + "\n".join(neighbours)
32+
)
3033
else:
3134
fpath = attrs.NOTHING # Did not find output path and
3235

@@ -72,7 +75,7 @@ def dcm2niix_out_files(out_dir, filename):
7275
),
7376
(
7477
"out_dir",
75-
Directory,
78+
Path,
7679
{
7780
"argstr": "-o '{out_dir}'",
7881
"help_string": "output directory",

0 commit comments

Comments
 (0)