File tree 2 files changed +33
-1
lines changed
2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+ from nipype .interfaces .afni import Zeropad
3
+ from nipype .testing .fixtures import create_files_in_directory
4
+
5
+
6
+ def test_zeropad_handles_outfile_default (create_files_in_directory ):
7
+ filelist , outdir = create_files_in_directory
8
+ zp = Zeropad (I = 1 )
9
+ zp .inputs .in_files = filelist [0 ]
10
+
11
+ result = zp .run ()
12
+
13
+ assert (Path (outdir ) / "zeropad+tlrc.BRIK" ).exists ()
14
+ assert Path (result .outputs .out_file ).name == "zeropad+tlrc.BRIK"
15
+
16
+
17
+ def test_zeropad_handles_outfile_specified_nii_gz (create_files_in_directory ):
18
+ filelist , outdir = create_files_in_directory
19
+ zp = Zeropad (I = 1 , out_file = "padded.nii.gz" )
20
+ zp .inputs .in_files = filelist [0 ]
21
+
22
+ result = zp .run ()
23
+
24
+ assert (Path (outdir ) / "padded.nii.gz" ).exists ()
25
+ assert Path (result .outputs .out_file ).name == "padded.nii.gz"
Original file line number Diff line number Diff line change @@ -3391,7 +3391,6 @@ class ZeropadInputSpec(AFNICommandInputSpec):
3391
3391
copyfile = False ,
3392
3392
)
3393
3393
out_file = File (
3394
- name_template = "zeropad" ,
3395
3394
desc = "output dataset prefix name (default 'zeropad')" ,
3396
3395
argstr = "-prefix %s" ,
3397
3396
)
@@ -3497,3 +3496,11 @@ class Zeropad(AFNICommand):
3497
3496
_cmd = "3dZeropad"
3498
3497
input_spec = ZeropadInputSpec
3499
3498
output_spec = AFNICommandOutputSpec
3499
+
3500
+ def _list_outputs (self ):
3501
+ out_file = getattr (self .inputs , "out_file" )
3502
+
3503
+ if not isdefined (out_file ):
3504
+ out_file = "zeropad+tlrc.BRIK"
3505
+
3506
+ return {"out_file" : out_file }
You can’t perform that action at this time.
0 commit comments