Hi Ziad,
thanks for your reply.
ziad Wrote:
-------------------------------------------------------
> It does look like there is an LPI/RAI problem here
> but I am not sure where it is getting introduced.
> I do use GIFTI versions of FreeSurfer surfaces
> fine so there has to be something else going on
> here.
FYI, the GIFTI surface I use were generated using python nibabel.gifti module. So far everything seems to work well, though, except for this LPI/RAI issue.
> If I understand what is going correctly, if the
> GIFTI files do not have the affine transform
> modified to have -1 in the 1st two diagonal
> elements, then after pressing 't', the contours of
> the surfaces look flipped in AFNI.
>
> If you use -1 in the 1st two diagonal elements,
> then contours look fine in AFNI, but rotation in
> SUMA is messed up.
Exactly.
>
> 1- Let us verify what is happening to the Center
> of Mass Estimate in SUMA:
> Start SUMA on the set of GIFTI surfaces without
> changes to the affine transform, open the surface
> controller for one hemisphere and click 'more'
> under the "surface properties" block. Then search
> for "Center of Mass" and note the value
> Repeat on the set of GIFTI surfaces with the
> changes to the affine transform, what is the new
> value of the center of mass?
In both cases I get the following:
Center of Mass: [-29.494 -21.959 17.559]
Surface geometry is considered irregular.
Sphere Center Set To: [-1.000 -1.000 -1.000]
Sphere Radius Set To: [-1.000]
MaxDist From Center: 95.656 at node 218
MinDist From Center: 5.638 at node 7053
Maximum: [1.630 68.839 77.995] (aMax 77.995)
Minimum: [-68.736 -104.722 -46.911] (aMin -104.722)
(There are no swaps of signs anywhere, irrespective of whether the xform is changed or not)
>
> 2- Instead of changing the affine transform, can
> you explicitly flip the x and y coord sign before
> writing out the GIFTI files? And when you do this,
> do things work OK?
Yes, they work ok, in the sense that overlay (on the anatomical image in the AFNI viewer) is fine and rotation (in SUMA) too.
*But* the coordinates are now - as expected - in RAI format. The center of mass has the signs swapped too:
Center of Mass: [29.494 21.959 17.559]
and min/max coordinates have changed as well.
That does not seem desirable as I would assume that every tool that
works with surfaces expects LPI coordinates, no?
(For completeness I also swapped both the signs in the xform matrix *and* swapped the signs of the x and y coordinates of the vertices. As expected, this gives both a wrong overlay *and* rotation issues.)
> Hopefully this will get us somewhere good quickly.
> I am glad you reached the GIFTI route, I was going
> to propose using it anyway.
Great minds think alike?
As always, thanks for your help.
best,
Nick