Skip to content

Commit

Permalink
debugged out_file_path and converted out_dir type to Path from direct…
Browse files Browse the repository at this point in the history
…ory (to avoid it being included in the inputs hash)
  • Loading branch information
tclose committed Jul 10, 2023
1 parent 9053fe9 commit 321c427
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pydra/tasks/dcm2niix/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ def out_file_path(out_dir, filename, file_postfix, ext):
neighbours = [
str(p) for p in fpath.parent.iterdir() if p.name.endswith(ext)
]
raise ValueError(
f"\nDid not find expected file '{fpath}' (file_postfix={file_postfix}) "
"after DICOM -> NIfTI conversion, please see "
"https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md for the "
"list of postfixes that dcm2niix produces and provide an appropriate "
"postfix, or set postfix to None to ignore matching a single file and use "
"the list returned in 'out_files' instead. Found the following files "
"with matching extensions:\n" + "\n".join(neighbours)
)
if len(neighbours) == 1 and file_postfix is attrs.NOTHING:
fpath = neighbours[0]
else:
raise ValueError(
f"\nDid not find expected file '{fpath}' (file_postfix={file_postfix}) "
"after DICOM -> NIfTI conversion, please see "
"https://github.com/rordenlab/dcm2niix/blob/master/FILENAMING.md for the "
"list of postfixes that dcm2niix produces and provide an appropriate "
"postfix, or set postfix to None to ignore matching a single file and use "
"the list returned in 'out_files' instead. Found the following files "
"with matching extensions:\n" + "\n".join(neighbours)
)
else:
fpath = attrs.NOTHING # Did not find output path and

Expand Down Expand Up @@ -72,7 +75,7 @@ def dcm2niix_out_files(out_dir, filename):
),
(
"out_dir",
Directory,
Path,
{
"argstr": "-o '{out_dir}'",
"help_string": "output directory",
Expand Down

0 comments on commit 321c427

Please sign in to comment.