9
9
10
10
from nipype .testing import assert_equal , skipif
11
11
from nipype .interfaces .freesurfer import model , no_freesurfer
12
+ import nipype .pipeline .engine as pe
12
13
13
14
14
15
@skipif (no_freesurfer )
15
16
def test_concatenate ():
16
17
tmp_dir = tempfile .mkdtemp ()
17
18
cwd = os .getcwd ()
18
19
os .chdir (tmp_dir )
19
- in1 = 'cont1.nii'
20
- in2 = 'cont2.nii'
20
+ in1 = os . path . join ( tmp_dir , 'cont1.nii' )
21
+ in2 = os . path . join ( tmp_dir , 'cont2.nii' )
21
22
out = 'bar.nii'
22
23
23
24
data1 = np .zeros ((3 , 3 , 3 , 1 ), dtype = np .float32 )
@@ -40,6 +41,17 @@ def test_concatenate():
40
41
os .path .join (tmp_dir , out ))
41
42
yield (assert_equal , nib .load (out ).get_data (), out_data )
42
43
44
+ # Test in workflow
45
+ wf = pe .Workflow ('test_concatenate' , base_dir = tmp_dir )
46
+ concat = pe .Node (model .Concatenate (in_files = [in1 , in2 ],
47
+ concatenated_file = out ),
48
+ name = 'concat' )
49
+ wf .add_nodes ([concat ])
50
+ wf .run ()
51
+ yield (assert_equal , nib .load (os .path .join (tmp_dir , 'test_concatenate' ,
52
+ 'concat' , out )).get_data (),
53
+ out_data )
54
+
43
55
# Test a simple statistic
44
56
res = model .Concatenate (in_files = [in1 , in2 ], concatenated_file = out ,
45
57
stats = 'mean' ).run ()
0 commit comments