@@ -39,7 +39,7 @@ def _list_outputs(self):
39
39
class CalcCoregAffineInputSpec (SPMCommandInputSpec ):
40
40
target = File ( exists = True , mandatory = True ,
41
41
desc = 'target for generating affine transform' )
42
- moving = File ( exists = True , mandatory = True ,
42
+ moving = File ( exists = True , mandatory = True , copyfile = False ,
43
43
desc = 'volume transform can be applied to register with target' )
44
44
mat = File ( desc = 'Filename used to store affine matrix' )
45
45
invmat = File ( desc = 'Filename used to store inverse affine matrix' )
@@ -99,10 +99,10 @@ def _make_matlab_command(self, _):
99
99
moving = '%s';
100
100
targetv = spm_vol(target);
101
101
movingv = spm_vol(moving);
102
- x = spm_coreg(movingv, targetv );
103
- M = spm_matrix(x(:)' );
102
+ x = spm_coreg(targetv, movingv );
103
+ M = spm_matrix(x);
104
104
save('%s' , 'M' );
105
- M = inv(spm_matrix(x(:)') );
105
+ M = inv(M );
106
106
save('%s','M')
107
107
""" % (self .inputs .target ,
108
108
self .inputs .moving ,
@@ -152,15 +152,16 @@ def _make_matlab_command(self, _):
152
152
script = """
153
153
infile = '%s';
154
154
transform = load('%s');
155
+ M = inv(transform.M);
155
156
img_space = spm_get_space(infile);
156
- spm_get_space(infile, transform. M * img_space);
157
+ spm_get_space(infile, M * img_space);
157
158
""" % (self .inputs .in_file ,
158
159
self .inputs .mat )
159
160
return script
160
161
161
162
def _list_outputs (self ):
162
163
outputs = self ._outputs ().get ()
163
- outputs ['out_file' ] = os .path .abspath (self .inputs .mat )
164
+ outputs ['out_file' ] = os .path .abspath (self .inputs .in_file )
164
165
return outputs
165
166
166
167
class ResliceInputSpec (SPMCommandInputSpec ):
0 commit comments