Skip to content

[WIP] FIX - AFNI Zeropad sets out_file #3641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
convert out_files for AFNI 3dZeropad to absolute paths in list_outputs
  • Loading branch information
Zach Lindsey committed Mar 21, 2024
commit 0953e5b50e666e61ef221b329cba42f2e4d8649c
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)}