Skip to content

Commit

Permalink
convert out_files for AFNI 3dZeropad to absolute paths in list_outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Lindsey committed Mar 21, 2024
1 parent 1506a85 commit 0953e5b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 14 additions & 0 deletions nipype/interfaces/afni/tests/test_extra_Zeropad.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
from nipype import Node
from nipype.interfaces.afni import Zeropad
from nipype.testing.fixtures import create_files_in_directory

Expand All @@ -23,3 +24,16 @@ def test_zeropad_handles_outfile_specified_nii_gz(create_files_in_directory):

assert (Path(outdir) / "padded.nii.gz").exists()
assert Path(result.outputs.out_file).name == "padded.nii.gz"


def test_zeropad_keeps_file_after_node_run(create_files_in_directory):
filelist, outdir = create_files_in_directory

zp = Node(
Zeropad(I=1, out_file="padded.nii.gz"), name="test_zeropad", base_dir=outdir
)
zp.inputs.in_files = Path(outdir) / filelist[0]

result = zp.run()
assert (Path(zp.output_dir()) / "padded.nii.gz").exists()
assert Path(result.outputs.out_file).name == "padded.nii.gz"
3 changes: 1 addition & 2 deletions nipype/interfaces/afni/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3502,5 +3502,4 @@ def _list_outputs(self):

if not isdefined(out_file):
out_file = "zeropad+tlrc.BRIK"

return {"out_file": out_file}
return {"out_file": op.abspath(out_file)}

0 comments on commit 0953e5b

Please sign in to comment.