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
>> >>> >> >>> >
>> >>> >> >>> >
>> >>> >> >>
>> >>> >> >
>> >>> >> >
>> >>> >
>> >>
>> >
>> >
>> >
>
>
|