Hi guys,
Sorry, I forgot to tell you that I found a workaround for the last problem of decoupling the invwarp displacements.
Here is what I do
1. get the transformation that take you from the fa index to the ref index space
2. load the reference img
3. load the invwarp displacements
4. load the forward displacements
5. load the forward displacements + affine
6. from the difference between 5 & 4 create the affine part in the reference image space
7. affine transform the affine part back to the FA space
8. remove the transformed affine from 7 from the invwarp displacements
Now the invwarp displacemens are clear and you can use them to warp for example tractography in the correct MNI space.
Jesper: Would you mind letting me know when you will add the invwarp option to save the displacements without the affine. So, that I can update my code?
Thank you for your help & best wishes,
Eleftherios
________________________________________
From: FSL - FMRIB's Software Library [[log in to unmask]] on behalf of Mark Jenkinson [[log in to unmask]]
Sent: 07 December 2010 17:05
To: [log in to unmask]
Subject: Re: [FSL] Understanding fnirt displacements
Hi,
There is actually a way that you can do this with existing tools.
That is to use convertwarp to construct the equivalent "warp field"
of the affine transformation and just subtract this with fslmaths.
Imagine, for example, you had a "highres" image and a "standard"
image, with the appropriate highres2standard.mat (affine),
the highres2standard warp field, and the inverse of
this - standard2highres warp field (which contains the affine
component). Then do:
convertwarp -r highres -o standard2highres_aff --premat=standard2highres.mat
fslmaths standard2highres -sub standard2highres_aff standard2highres_noaff
where standard2highres.mat is the normal affine inverse matrix
(you can get this from convert_xfm, which just does an ordinary matrix inverse).
This will then give you the warp field minus the affine component
(as standard2highres_noaff).
I hope this is useful.
All the best,
Mark
On 7 Dec 2010, at 15:53, Jesper Andersson wrote:
> Hi again,
>
>> Cool, so now that we both understand. I suppose the obvious question is what someone needs to do to get the invwarp displacements without the affine part so that they are clean and neat?
>
> I have code that strips any affine component off a warp field, but presently it is only used internally within the various utilities. I guess I didn't expect anyone to interested in actually doing that to a warp field.
>
> I'll put on my "to do list" to include that as an option for fnirtfileutils for our next release.
>
> Jesper
>
>>
>> From: FSL - FMRIB's Software Library [[log in to unmask]] on behalf of Jesper Andersson [[log in to unmask]]
>> Sent: 06 December 2010 16:51
>> To: [log in to unmask]
>> Subject: Re: [FSL] Understanding fnirt displacements
>>
>> Hi again,
>>
>>> OK perhaps I don't understand something. But if for example we copy independently the 3 different volumes of the invwarp displacements
>>>
>>> dx=invw[:,:,:,0]
>>> dy=invw[:,:,:,1]
>>> dz=invw[:,:,:,2]
>>>
>>> and then find the min, mean and max of these
>>> dx.min, dx.mean, dx.max
>>> (-41.49826, -29.517453835227272, -18.096992)
>>> dy.min, dy.mean, dy.max
>>> (-21.371231, -1.2154097123579546, 17.967239)
>>> dz.min, dz.mean, dz.max
>>> (-4.1304131, 14.658940972222222, 37.063133)
>>>
>>> we can observe that there is a big shift of about -29 on the dx and of about +14.6 on the dz. I think both things look impossible because the displacements are sitting on top of the flirt registration so such huge overall shifts shouldn't be possible. So, what processing do I need to do to make these meaningful? Do they need to be devided with something (like in the apply_warp case) ? Are they in mm? Please, do advise.
>>
>> I see now your problem. When inverting the field we invert the entire transform, i.e. the affine and the non-linear. Hence the output from invwarp is equivalent to the output from fnirtfileutils with the --withaff flag set. So the mean and max displacements you see correspond primarily to the inverse of the affine component. The dispacements are still in mm.
>>
>> Jesper
>>
>>
>
|