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

Help for SPM Archives


SPM Archives

SPM Archives


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

LISTSERV Archives

LISTSERV Archives

SPM Home

SPM Home

SPM  August 2012

SPM August 2012

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Transform into Dartel template space

From:

John Ashburner <[log in to unmask]>

Reply-To:

John Ashburner <[log in to unmask]>

Date:

Thu, 23 Aug 2012 12:18:22 +0100

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (423 lines)

MNI space encodes brains that are much bigger than average human brains.
After affine alignment with MNI space, I would therefore not expect
the estimated voxel sizes in the population average to remain the
same.  The sizes will need to be increased to make it match with MNI
space.

There are two affine transform matrices stored in NIfTI headers.  One
of them (sform) is a 12-parameter affine, whereas the other (qform)
only uses 9-parameters.  The 9-parameter qform transform can encode
isotropic zooms followed by rigid-body rotation, but it can not encode
rigid-body rotation followed by isotropic zooms, or indeed the full
range of transforms of the sform.

For most data, I wasn't sure what to do with the qform field.  I
usually try to keep it the same as the sform whenever possible,
although this can not always be achieved.  This is why you got the
"QFORM0 representation has been rounded" warning message.
spm_get_space tried to write a full 12-parameter transform into the
qform, but failed.

Best regards,
-John

On 23 August 2012 01:34, YAN Chao-Gan <[log in to unmask]> wrote:
> Dear John,
>
> Hope all is well! Got a question about the affine matrix in
> Template_6_2mni.mat again.
>
> In a previous email, you mentioned this affine matrix is for mapping from
> voxels in Template to MNI space.
> https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1202&L=spm&P=R94596&1=spm&9=A&J=on&d=No+Match%3BMatch%3BMatches&z=4
>
> So this matrix (M) could be used to convert voxel index (I,J,K) in template
> space to mm coordinates (X,Y,Z) in MNI space, right? i.e.,
>
> Xm       =  M   *  It
> Ym                    Jt
> Zm                    Zt
> 1                       1
>
> However, seems the voxel size in this affine matrix is not the same as the
> Template image (1.5*1.5*1.5 in Template_6.nii).
>
>>>sqrt(sum(M(1:3,1:3).^2))
> ans =
>     1.5464    1.6636    1.7137
>
> If we replace the affine matrix in Template_6.nii by M:
>
> spm_get_space('Template_6.nii',M)
>
> Then get a warning of "QFORM0 representation has been rounded". And the
> voxel size of this image (viewed by MRIcroN) is no longer 1.5*1.5*1.5.
>
>
> I am wondering if the understanding of the affine matrix (convert I,J,K in
> template space to MNI coordinates) is wrong or the voxel size doesn't
> matter?
>
>
> Thank you very much!
>
> Best,
>
> Chao-Gan
>
> On Tue, Mar 27, 2012 at 10:41 AM, John Ashburner <[log in to unmask]>
> wrote:
>>
>> You are absolutely correct.  I got M2 and M3 the wrong way around.
>> Sorry about that (I'm glad to see that you tested my untested snippet
>> first).
>>
>> All the best,
>> -John
>>
>> On 22 March 2012 21:25, YAN Chao-Gan <[log in to unmask]> wrote:
>> > Dear John,
>> >
>> > Recently I want to use the affine matrix in Template_6_2mni.mat to
>> > transform
>> > an image into the DARTEL template space.
>> >
>> > I found you gave a solution previously
>> > (https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=spm;16f5c0a5.1102)
>> >
>> > Alternatively, you could create a copy of the MNI-space image of
>> > labels, and tweak the matrix in its header, so that it is in alignment
>> > with the population average. This is untested, but I think you'd set
>> > the matrix to M3*inv(M2)*M1, where:
>> >
>> > M1 = voxel-to-world matrix of your MNI-space labels
>> > M2 = voxel-to-world matrix of the population average space Template_6
>> > M3 = matrix in the Template_6_2mni.mat
>> >
>> > I wonder if M3*inv(M2)*M1 a typo from M2*inv(M3)*M1?
>> >
>> > As far as I understand, M1, M2, M3 are used for transform voxel index
>> > (It,
>> > Jt, Kt: in template space; Im, Jm, Km: in mni space; ) to coordinates
>> > (Xt,
>> > Yt, Zt: in template space; Xm, Ym, Zm: in mni space; ):
>> >
>> > Xm     =  M1 *  Im        ,         Xt     =  M2 *  It              ,
>> >  Xm     =  M3 *  It
>> > Ym                   Jm                 Yt                   Jt
>> >          Ym                   Jt
>> > Zm                    Km                Zt                   Kt
>> >         Zm                   Kt
>> > 1                       1                    1                     1
>> >               1                     1
>> >
>> >
>> > The matrix we need to put in the header to transform MNI file into
>> > template
>> > face should be a matrix M:
>> >
>> > Xt       =  M  *  Im
>> > Yt                    Jm
>> > Zt                     Zm
>> > 1                       1
>> >
>> > And M should be M2*inv(M3)*M1 because:
>> >
>> >         M2    *    inv(M3)         *      M1
>> > Xt    ←     It       ←        Xm         ←      Im
>> > Yt            Jt                   Ym                  Jm
>> > Zt            Kt                   Zm                  Km
>> > 1               1                     1                      1
>> >
>> > I wonder if it's a typo or I made something wrong for M2*inv(M3)*M1?
>> > Thanks
>> > a lot!
>> >
>> > Best,
>> >
>> > Chao-Gan
>> >
>> >
>> >
>> > ---------
>> >
>> > Subject:
>> >
>> > Re: New Segmentation Out of Memory Error
>> >
>> > From:
>> >
>> > John Ashburner <[log in to unmask]>
>> >
>> > Reply-To:
>> >
>> > John Ashburner <[log in to unmask]>
>> >
>> > Date:
>> >
>> > Thu, 17 Feb 2011 16:33:07 +0000
>> >
>> > Content-Type:
>> >
>> > text/plain
>> >
>> > Parts/Attachments:
>> >
>> > text/plain (216 lines)
>> >
>> > The best possible workaround would be the following. In principle, if
>> > you have scans from other subjects that have additional information
>> > (eg structure label images etc), then you can align these scans to the
>> > population average images, using Dartel. Once you have done this, the
>> > information can be warped so that it overlays on your individuals'
>> > scans via a procedure described towards the end of the "Using Dartel"
>> > chapter of the SPM8 manual.
>> >
>> > Alternatively, you could create a copy of the MNI-space image of
>> > labels, and tweak the matrix in its header, so that it is in alignment
>> > with the population average. This is untested, but I think you'd set
>> > the matrix to M3*inv(M2)*M1, where:
>> >
>> > M1 = voxel-to-world matrix of your MNI-space labels
>> > M2 = voxel-to-world matrix of the population average space Template_6
>> > M3 = matrix in the Template_6_2mni.mat
>> >
>> > If this works, you should be able to use one of the options in the
>> > Dartel toolbox (or the Deformations Utility) to warp the data on to
>> > your original scans.
>> >
>> > Best regards,
>> > -John
>> >
>> > On 16 February 2011 19:45, michel grothe <[log in to unmask]> wrote:
>> >> Thanks, this would be great.
>> >>
>> >> Meanwhile, I have some questions regarding a possible work-around:
>> >>
>> >> Would it be OK to use an affine transform calculated with the
>> >> Normalise-Button to approximate the affine transform from
>> >> 'DARTEL-Normalise
>> >> to MNI' in order to be able to generate the mentioned composition
>> >> 'native->DARTEL->MNI'. Does the affine alignment step in
>> >> 'DARTEL-Normalise
>> >> to MNI' register the DARTEL-GM template to the GM-apriori map (or the
>> >> GM
>> >> map
>> >> in TPM.nii,1?) or does it also use the respective WM-maps?
>> >> How much does the affine alignment in 'DARTEL-Normalise to MNI' differ
>> >> from
>> >> the one in 'Normalise', when registering DARTEL-GM to GM-apriori map
>> >> (or
>> >> TPM.nii,1) and setting non-linear iterations to 0?
>> >>
>> >> Thanks again for your help.
>> >> Best regards,
>> >> Michel
>> >>
>> >>> Date: Wed, 16 Feb 2011 17:16:00 +0000
>> >>> From: [log in to unmask]
>> >>> Subject: Re: [SPM] New Segmentation Out of Memory Error
>> >>> To: [log in to unmask]
>> >>>
>> >>> > I haven´t seen such a file in my version of SPM8 (the penultimate
>> >>> > update,
>> >>> > run on win32). Is it possible that this file is just generated
>> >>> > during
>> >>> > estimation of the affine transform and not stored permanently on
>> >>> > disk?
>> >>> > Or
>> >>> > does it come with the latest update?
>> >>>
>> >>> This change occurred in SPM8 r3727, so should be in the current
>> >>> updates, which are to r4010.
>> >>>
>> >>>
>> >>> > It would be very helpful to have such a file, mainly for the reasons
>> >>> > Richard
>> >>> > mentioned, i.e. use it to compose the complete transform
>> >>> > 'native->DARTEL-mean->MNI'. The inverse of such a composition could
>> >>> > be
>> >>> > used
>> >>> > to warp Atlas-labels in MNI space to native space.
>> >>>
>> >>> There's no easy way to use the file yet, but I'll try to code
>> >>> something up for a future version of SPM8.
>> >>>
>> >>> Best regards,
>> >>> -John
>> >>>
>> >>>
>> >>> >> Date: Wed, 16 Feb 2011 15:58:16 +0000
>> >>> >> From: [log in to unmask]
>> >>> >> Subject: Re: [SPM] New Segmentation Out of Memory Error
>> >>> >> To: [log in to unmask]
>> >>> >>
>> >>> >> This file does indeed contain an affine transform, and is generated
>> >>> >> when the affine registration between population average and MNI
>> >>> >> space
>> >>> >> is estimated.
>> >>> >>
>> >>> >> There's no script to do what you're after yet, but if the demand is
>> >>> >> high enough I could introduce the option. Can I ask how you plan to
>> >>> >> use the transforms?
>> >>> >>
>> >>> >> Best regards,
>> >>> >> -John
>> >>> >>
>> >>> >>
>> >>> >> On 16 February 2011 15:44, Richard Binney
>> >>> >> <[log in to unmask]>
>> >>> >> wrote:
>> >>> >> > ......I've just spotted that running normalise-to-mni now spits
>> >>> >> > out
>> >>> >> > a
>> >>> >> > 'Template_6_2mni.mat' file. I don't recall seeing this before -
>> >>> >> > would
>> >>> >> > this
>> >>> >> > happen to be the affine transform I spoke of?
>> >>> >> >
>> >>> >> > R
>> >>> >> >
>> >>> >> > On Wed, Feb 16, 2011 at 3:39 PM, Richard Binney
>> >>> >> > <[log in to unmask]> wrote:
>> >>> >> >>
>> >>> >> >> Ah, yes. I couldn't find the email you were refferring to, but
>> >>> >> >> I've
>> >>> >> >> done
>> >>> >> >> it and it makes a huge difference. Pretty obvious really.
>> >>> >> >>
>> >>> >> >> One more thing, John (or anybody else for that matter) - is
>> >>> >> >> there
>> >>> >> >> now a
>> >>> >> >> way in which one can easily create an inverse of the DARTEL
>> >>> >> >> normalise-to-MNI
>> >>> >> >> deformation composition (so from MNI --> study average -->
>> >>> >> >> individual
>> >>> >> >> subject space)? Is it possible (i.e., is there script) to have
>> >>> >> >> this
>> >>> >> >> (forward
>> >>> >> >> and/or backwards) written out for each subject or,
>> >>> >> >> alternatively,
>> >>> >> >> to
>> >>> >> >> have
>> >>> >> >> the affine template-to-TPM transform outputted such that one can
>> >>> >> >> combine it
>> >>> >> >> with a flow field, and subsequently inverse the composition
>> >>> >> >> using
>> >>> >> >> the
>> >>> >> >> deformations tool?
>> >>> >> >>
>> >>> >> >> All the best,
>> >>> >> >>
>> >>> >> >> Richard
>> >>> >> >>
>> >>> >> >> On Tue, Feb 15, 2011 at 5:42 PM, John Ashburner
>> >>> >> >> <[log in to unmask]>
>> >>> >> >> wrote:
>> >>> >> >>>
>> >>> >> >>> You may wish to change the voxel sizes and bounding box in
>> >>> >> >>> order
>> >>> >> >>> to
>> >>> >> >>> obtain slightly lower resolution versions (other than the
>> >>> >> >>> default
>> >>> >> >>> 1.5mm isotropic with a large bounding box).  See the email I
>> >>> >> >>> sent
>> >>> >> >>> out
>> >>> >> >>> recently.
>> >>> >> >>>
>> >>> >> >>> Best regards,
>> >>> >> >>> -John
>> >>> >> >>>
>> >>> >> >>> On 15 February 2011 17:29, Richard Binney
>> >>> >> >>> <[log in to unmask]>
>> >>> >> >>> wrote:
>> >>> >> >>> > Dear John (and other knowledgeable types),
>> >>> >> >>> >
>> >>> >> >>> > I used the deformation file (e.g., Y_p1_T1.nii) from Seg8 to
>> >>> >> >>> > normalise
>> >>> >> >>> > a
>> >>> >> >>> > functional MRI timeseries. That worked fine - the anatomical
>> >>> >> >>> > images that
>> >>> >> >>> > I additionally warped in this way look great - but I now
>> >>> >> >>> > cannot
>> >>> >> >>> > do
>> >>> >> >>> > anything
>> >>> >> >>> > with the timeseries.
>> >>> >> >>> >
>> >>> >> >>> > It is now almost 4Gb in size. I appreciate that using DARTEL
>> >>> >> >>> > to
>> >>> >> >>> > warp
>> >>> >> >>> > fMRI
>> >>> >> >>> > data can result in massive files which are problematic (and
>> >>> >> >>> > thus
>> >>> >> >>> > a
>> >>> >> >>> > work
>> >>> >> >>> > around is to apply the warp to contrast images), but I didn't
>> >>> >> >>> > expect
>> >>> >> >>> > the
>> >>> >> >>> > segment deformation field to do the same.
>> >>> >> >>> >
>> >>> >> >>> > Does this sound about right for a timeseries with 465 volumes
>> >>> >> >>> > (voxel
>> >>> >> >>> > dim 2.5
>> >>> >> >>> > x 2.5 x 3; matrix 96x96; numslices = 42)? Or have I made a
>> >>> >> >>> > mistake
>> >>> >> >>> > somewhere?
>> >>> >> >>> >
>> >>> >> >>> > so I'm supposing my inability to use the warped timeseries is
>> >>> >> >>> > a
>> >>> >> >>> > memory
>> >>> >> >>> > issue - I am running a 64-bit machine with 8Gb memory (I can
>> >>> >> >>> > see
>> >>> >> >>> > all
>> >>> >> >>> > this
>> >>> >> >>> > being used in the task manager so doesn't seem to be a matlab
>> >>> >> >>> > version
>> >>> >> >>> > problem) but maybe this file is just way too big for the SPM
>> >>> >> >>> > platform.....???? I could crop the image, etc I suppose but
>> >>> >> >>> > maybe
>> >>> >> >>> > the
>> >>> >> >>> > biggest problem is the shear number of volumes.
>> >>> >> >>> >
>> >>> >> >>> > Thanks in advance for your thoughts
>> >>> >> >>> >
>> >>> >> >>> > Richard
>> >>> >> >>> >
>> >>> >> >>> > On Thu, Feb 10, 2011 at 4:05 PM, William Pettersson-Yeo
>> >>> >> >>> > <[log in to unmask]> wrote:
>> >>> >> >>> >>
>> >>> >> >>> >> Thanks John.
>> >>> >> >>> >>
>> >>> >> >>> >> It turns out the problem was due to the version of Matlab I
>> >>> >> >>> >> was
>> >>> >> >>> >> running.
>> >>> >> >>> >>
>> >>> >> >>> >> Matlab2007 was only running 32bit, whilst the 2010 version
>> >>> >> >>> >> is
>> >>> >> >>> >> 64.
>> >>> >> >>> >>
>> >>> >> >>> >> Having set up with Matlab2010, the new segmentation with
>> >>> >> >>> >> DARTEL
>> >>> >> >>> >> import
>> >>> >> >>> >> now
>> >>> >> >>> >> runs without any problem, without me having to alter/crop
>> >>> >> >>> >> any
>> >>> >> >>> >> of
>> >>> >> >>> >> the
>> >>> >> >>> >> images.
>> >>> >> >>> >>
>> >>> >> >>> >> All the best
>> >>> >> >>> >> William
>> >>> >> >>> >
>> >>> >> >>> >
>> >>> >> >>
>> >>> >> >
>> >>> >> >
>> >>> >
>> >>
>> >
>> >
>> >
>
>

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
2000
1999
1998


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