@@ -18,15 +18,18 @@ def out_file_path(out_dir, filename, file_postfix, ext):
18
18
neighbours = [
19
19
str (p ) for p in fpath .parent .iterdir () if p .name .endswith (ext )
20
20
]
21
- raise ValueError (
22
- f"\n Did 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"\n Did 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
+ )
30
33
else :
31
34
fpath = attrs .NOTHING # Did not find output path and
32
35
@@ -72,7 +75,7 @@ def dcm2niix_out_files(out_dir, filename):
72
75
),
73
76
(
74
77
"out_dir" ,
75
- Directory ,
78
+ Path ,
76
79
{
77
80
"argstr" : "-o '{out_dir}'" ,
78
81
"help_string" : "output directory" ,
0 commit comments