Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConvertSurface issues #451

Open
neurolabusc opened this issue Feb 28, 2023 · 2 comments
Open

ConvertSurface issues #451

neurolabusc opened this issue Feb 28, 2023 · 2 comments

Comments

@neurolabusc
Copy link

ConvertSurface seems to flip the X and Y polarities when reading from/to the FreeSurfer (.asc), PLY (.ply) and byu (.g) formats. Since this is applied both on reading and writing, the round trip from GIFTI->other->GIFTI restores the coordinates. Notice that FreeSurfer uses the same coordinate system as GIFTI, so a FreeSurfer format mesh created by ConvertSurfaces appears flipped in the Anterior-Posterior and Left-Right dimensions (see screenshot). The -native switch does not seem to help.

ConvertSurface  -i_gii L.surf.gii -o_gii afni
ConvertSurface  -i_gii L.surf.gii -o_fs afni
ConvertSurface  -i_gii L.surf.gii -o_ply afni
ConvertSurface  -i_gii L.surf.gii -o_byu afni

ConvertSurface  -i_gii afni.gii -o_gii gii2
ConvertSurface  -i_fs afni.asc -o_gii fs2
ConvertSurface  -i_ply afni.ply -o_gii ply2
ConvertSurface  -i_byu afni.g -o_gii byu2

FreeSurfer FreeView provides the reference display for FreeSurfer format images. The original (green) and converted (yellow) images are not aligned, but the converted back (red) perfectly aligns with the source:

afni_fs

@mrneont
Copy link
Contributor

mrneont commented Mar 1, 2023

Hi, @neurolabusc : Hmmm, weird. OK, thanks, we will dig into the code and see what is happening. Thanks for pointing this out.

@afni-dglen
Copy link
Contributor

I took a look at this and tried similar examples. Interestingly, they all appear correct and nearly identical (except for some small rounding differences with ascii output) within the suma interface. What I think is going on is that almost all the surface reading functions assume LPI coordinate order, rather than RAI/DICOM order. It's mentioned in a couple places in some of the help output, but it's definitely not obvious. Based on that help, it seems that FreeSurfer used to output data in RAI order, but that has not been the case in recent years. Is this data, the l.surf.gii, a new GIFTI dataset?

In any case, there is a workaround, use the "-xmat_1D NegXY" option for ConvertSurface to negate X and Y coordinate values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants