JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for FSL Archives


FSL Archives

FSL Archives


FSL@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

FSL Home

FSL Home

FSL  2003

FSL 2003

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: FSL/FLIRT .mat to freesurfer talairach.xfm file

From:

Mark Jenkinson <[log in to unmask]>

Reply-To:

FSL - FMRIB's Software Library <[log in to unmask]>

Date:

Mon, 17 Feb 2003 14:35:19 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (173 lines)

Hi Darren,

I don't have any experience of the talairach.xfm files, though Doug
Greve in Boston has been looking at freesurfer/fsl conversions for
transformations, so he would have a very good idea.

As for the flirt conventions, I've emailed details on these before
and I've included one of these responses below which should help.

Your interpretation of the 4x4 affine matrix isn't quite right though.
The right hand column are the translations, but the rotations, scalings
and skews are *all* in the upper left 3x3 part - thoroughly mixed
together.  To separate them you can run avscale, but this isn't a
unique decomposition as there are so many choices of convention.

Also, FSL does not interpret left or right.  It just orders its
coordinates based on the order they appear in the .img file.
For calculating Talaraich coords it does use negative voxel dimension
info (see second reply below).  Note that reslicing/transforming an
image does not require Talaraich coords - only voxel or mm coords
to be used, hence it is only the few components of FSL that deal
in Talaraich coords (e.g. img2talcoord) that ever do anything
beyond our standard mm coord system which is totally driven from
the data ordering.

You might also find that slices is useful as it will always display the
images as they are ordered in the data too - hence this is useful
for actually figuring out how our conventions might relate to those
that you see from other display programs which do worry about
left and right designations as well as the data order.

Hope this helps.
All the best,
        Mark

-----------------

.. on flirt matrices ...

The coordinates that flirt uses are not defined with respect to anatomy
but with respect to data storage block.  That is, when going through
the data block byte by byte, the coordinates are: (0,0,0) then (1,0,0)
then (2,0,0) then ... then (0,1,0) then (1,1,0) then ... (0,0,1) then
(1,0,1) then ... etc.
So, the position in the data block of a voxel coordinate (x,y,z) is
given
by (x + N_x * (y + N_y * z)) where (N_x,N_y,N_z) are the number of
voxels in the x, y and z directions.  Note that x is always in the
range 0 to (N_x - 1), and similarly for y and z.

Consequently, the orientation of the axes with respect to the anatomy
depends on the type of scanning and reslicing that's been done (e.g.
axial or coronal or sagittal acquistions)

This defines the *voxel* coordinate conventions.
However, the matrices always use mm coordinates.
These are defined as the voxel coordinates multiplied by the voxel
dimensions.

For example, if the voxel coordinate of interest was (30,20,10) and
the voxel dimensions were (4,4,6) mm then the mm coordinate would be
(120,80,60) mm.  FLIRT uses mm coordinates in all images so that the
voxel dimensions and FOV do not need to be stored in the transformation
matrix.

So, a flirt matrix represents the transformation:
         new mm coordinates =  matrix * old mm coordinates
where each coordinate is represented by as a standard homogeneous
coordinate column vector (i.e. [ x_mm y_mm z_mm 1 ]' )

---------------------

  ... and on negative voxel dimensions ...


Slices and flirt and FSL in general *do not care* whether the voxel dim is
positive or negative.  They effectively always treat them as positive.
The only bit of FSL that ever uses this information is when converting
voxel coordinates (or internal flirt mm coords) to Talaraich coordinates
where the negative signs are used, together with the origins (which are
also otherwise ignored).

All the results seem to be consistent with this.  Whether the output
image from flirt has a negative dim or not is totally dependent on
the reference image, since the sizes and dims are just copied from
this image (i.e. the output is a clone of the reference image but
with the intensities within it changed - to those of the tranformed
input image).


We could, of course, have decided to never save negative dims but just
make a specific vox -> Tal coord conversion that relied on certain
fixed conventions for the image.  However, I think we went with negative
dims in order to maintain compliance with MEDx - especially with
respect to the display of images - as this was our principle viewing
platform.

Personally, I wish no-one (including minc format) ever used negative
voxel dims - the world would be a better place without them!  Still, I
think there are bigger problems out there than this too.  :)


-----------------





Darren Weber wrote:
> Dear Steve, Mark, et al,
>
> I'm trying to obtain Talairach coordinates for freesurfer using FSL/FLIRT
> registration.  It may be easy to convert a .mat file to the freesurfer
> talairach.xfm file (a simple format conversion), but I would appreciate
> consideration and any comments on the process described below, as there are
> some steps involved in doing the registration.
>
> In freesurfer, when starting tksurfer, it tries to read the file:
>
> subject/mri/transforms/talairach.xfm
>
> so it can display the normalized coordinates for a given vertex location.
> I'm trying to create this file via FSL/FLIRT (as it is more convenient than
> SPM because I don't have matlab licence under linux).
>
> I've used the FSL/FLIRT tool under linux to generate a .mat registration
> file.  These files are not matlab binary data files (as in SPM), they are
> ascii files that contain the 4x4 spatial transform matrix (I think the top
> left 3x3 is the rotations and the right most 3x1 is the translations, while
> the bottom row is shears and scaling).
>
> In my case, I'm registering a T1 analyze volume with the MNI
> avg152T1_brain.img template in the FSL distribution.  The T1 analyze file
> was created from original GE files that were converted to analyze (axial,
> LAS) and then converted to COR files (coronal, RAS) with:
>
> mri_convert -iid -1 0 0 -ijd 0 1 0 -ikd 0 0 1 orig.img orig
>
> Note the iid is flipped in X, as I think freesurfer displays use RAS
> (neurological), while Analyze is LAS (radiological).  I'm not entirely sure
> about this step.  I've checked the orig volume in tkmedit by display of the
> axes, which show the R arrow pointing toward the left, so I think this is
> correct.  Any comments on this are appreciated.
>
> At this stage, the volume has been effectively resliced from the original
> dimensions into a coronal 256x256x256 and 1mm^3 voxels (the COR volume).
>
> To ensure the registration uses the same dimensions as the COR volume, I
> convert the COR volume back into analyze (now 256x256x256 1mm^3 voxels)
> using:
>
> mri_convert -oid -1 0 0 -ojd 0 1 0 -okd 0 0 1 orig orig.img
>
> Note the oid is flipped back to LAS, again.  Using the FSL tool 'slices
> orig.img' it appears to be correctly oriented (LAS).
>
> Then I applied FSL/FLIRT registration to this volume to generate a .mat
> file.  Have you had any experience in generating a freesurfer talairach.xfm
> (or similar) files from these .mat files?
>
>
> Best regards, Darren
>
>
> --
> Darren Weber, PhD Student
> Cognitive Neuroscience, School of Psychology
> Flinders University of SA, GPO Box 2100, Adelaide, SA 5001, Aust.
> Ph:  (61 8) 8201 3998, Fax: (61 8) 8201 3877
> http://brain.mhri.edu.au/~dlw/homepages/index.html
>
>

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

May 2024
April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001


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

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager