@@ -99,8 +99,7 @@ class Volreg2ITK(SimpleInterface):
99
99
def _run_interface (self , runtime ):
100
100
# Load AFNI mat entries and append (0, 0, 0, 1) for homogeneous coordinates
101
101
orig_afni_mat = np .loadtxt (self .inputs .in_file )
102
- afni_affines = [np .vstack ((orig_afni_mat [i , :].reshape (3 , 4 , order = 'C' ), [0 , 0 , 0 , 1 ]))
103
- for i in range (orig_afni_mat .shape [0 ])]
102
+ afni_affines = [mat .reshape (3 , 4 , order = 'C' ) for mat in orig_afni_mat ]
104
103
105
104
out_file = Path (fname_presuffix (self .inputs .in_file ,
106
105
suffix = '_mc4d_itk.txt' , newpath = runtime .cwd ))
@@ -111,8 +110,9 @@ def _run_interface(self, runtime):
111
110
lines .append ("#Transform %d" % i )
112
111
lines .append ("Transform: AffineTransform_double_3_3" )
113
112
114
- ants_affine_2d = np .hstack ((affine [:3 , :3 ].reshape (1 , - 1 ), affine [:3 , 3 ].reshape (1 , - 1 )))
115
- params = ants_affine_2d .reshape (- 1 , 1 ).astype ('float64' )
113
+ ants_affine_2d = np .hstack ((affine [:3 , :3 ].reshape (1 , - 1 ),
114
+ affine [:3 , 3 ].reshape (1 , - 1 )))
115
+ params = ants_affine_2d .reshape (- 1 ).astype ('float64' )
116
116
params_list = ["%g" % i for i in params .tolist ()]
117
117
lines .append ("Parameters: %s" % ' ' .join (params_list ))
118
118
lines .append (fixed_params )
0 commit comments