Email discussion lists for the UK Education and Research communities

## SPM@JISCMAIL.AC.UK

#### View:

 Message: [ First | Previous | Next | Last ] By Topic: [ First | Previous | Next | Last ] By Author: [ First | Previous | Next | Last ] Font: Proportional Font

#### Options

Subject:

Re: Feature request: saving affine transformation matrices in coregister batch jobs

From:

John Ashburner <[log in to unmask]>

Reply-To:

John Ashburner <[log in to unmask]>

Date:

Thu, 16 Feb 2012 16:46:16 +0000

Content-Type:

text/plain

Parts/Attachments:

 text/plain (59 lines)
 ```I'm not sure which matrices you need, but if you have a pair of coregistered images, you can map from voxels in one image to voxels in the other by: NA=nifti('A.nii'); NB=nifti('B.nii'); % Map from voxel x,y,z in A to corresponding location in B M = NB.mat\NA.mat; xyzB = M(1:3,:)*[x;y;z;1] % Map from voxel x,y,z in B to corresponding location in A M = NA.mat\NB.mat; xyzA = M(1:3,:)*[x;y;z;1] Converting these M matrices into a form that FSL can work with may require a bit of messing about. Also note that SPM indexes the first voxel as 1,1,1 (because it is MATLAB based), whereas FSL indexes the first voxel as 0,0,0 (as it is mostly written in C++). For this reason, the matrices in the NIfTI headers are adjusted in order to obtain NA.mat and NB.mat that work for the MATLAB indexing. Best regards, -John On 16 February 2012 16:33, Chris Filo Gorgolewski <[log in to unmask]> wrote: > Silly me thinking this would be simple... Let me look into this a bit more. > > Thanks, > Chris > > On 15 February 2012 18:11, John Ashburner <[log in to unmask]> wrote: >> This may not be quite as simple as you think.  If my understanding is >> correct, the matrices that FSL uses seem to be a legacy from the >> pre-NIfTI days.  This complicates things slightly (see >> http://www.nitrc.org/snippet/detail.php?type=package&id=1 for more >> info). >> >> Best regards, >> -John >> >> >> On 15 February 2012 16:15, Chris Filo Gorgolewski >> <[log in to unmask]> wrote: >>> Hi, >>> I would like to request a tiny feature feature which will cost very >>> little coding. In the Coregister batch jobs the estimated >>> transformation matrix is discarded. For interoperability with other >>> software it would be great if it was saved in a file (for example in >>> plain text format compatible with FSL). It would only require adding a >>> line or two to config/ spm_run_coreg_est.m and >>> config/spm_run_coreg_estwrite.m >>> >>> Best, >>> Chris ```

#### RSS Feeds and Sharing

JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice