Skip to content

Commit 3fb1b5e

Browse files
committed
Fix SPM interfaces
1 parent d8ca85a commit 3fb1b5e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

nipype/interfaces/spm/utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _list_outputs(self):
3939
class CalcCoregAffineInputSpec(SPMCommandInputSpec):
4040
target = File( exists = True, mandatory = True,
4141
desc = 'target for generating affine transform')
42-
moving = File( exists = True, mandatory = True,
42+
moving = File( exists = True, mandatory = True, copyfile=False,
4343
desc = 'volume transform can be applied to register with target')
4444
mat = File( desc = 'Filename used to store affine matrix')
4545
invmat = File( desc = 'Filename used to store inverse affine matrix')
@@ -99,10 +99,10 @@ def _make_matlab_command(self, _):
9999
moving = '%s';
100100
targetv = spm_vol(target);
101101
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);
104104
save('%s' , 'M' );
105-
M = inv(spm_matrix(x(:)'));
105+
M = inv(spm_matrix(x));
106106
save('%s','M')
107107
"""%(self.inputs.target,
108108
self.inputs.moving,
@@ -152,15 +152,16 @@ def _make_matlab_command(self, _):
152152
script = """
153153
infile = '%s';
154154
transform = load('%s');
155+
M = inv(transform.M);
155156
img_space = spm_get_space(infile);
156-
spm_get_space(infile, transform.M * img_space);
157+
spm_get_space(infile, M * img_space);
157158
"""%(self.inputs.in_file,
158159
self.inputs.mat)
159160
return script
160161

161162
def _list_outputs(self):
162163
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)
164165
return outputs
165166

166167
class ResliceInputSpec(SPMCommandInputSpec):

0 commit comments

Comments
 (0)