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

coordinate system #16

Open
moskvich412 opened this issue Feb 26, 2024 · 2 comments
Open

coordinate system #16

moskvich412 opened this issue Feb 26, 2024 · 2 comments

Comments

@moskvich412
Copy link

Dear Developer and contributors,

Given little documentation on the library, I have hard time figuring out how to specify two coordinate systems to be used for output of the same surface. I know GIFTI formal allows it. Similarly, when reading a GIFTI file, only one transformation (seems to be always the first) is loaded without attributes (anatomical, unknown, etc). How do I deal with these?

Thank you,

@neurolabusc
Copy link

@moskvich412 the specification does allow you to support different spatial transforms, though I doubt many tools will detect them. According to the GIFTI specification you can in theory encode different spatial transforms:

NIFTI_XFORM_UNKNOWN
NIFTI_XFORM_SCANNER_ANAT
NIFTI_XFORM_ALIGNED_ANAT
NIFTI_XFORM_TALAIRACH
NIFTI_XFORM_MNI_152

In general, most tools assume that GIfTI vertex positions are in world space. The only exception I know of is FreeSurfer, which can insert different transforms. To see these in action, try mris_convert with one of these options:

--to-scanner : convert coordinates from native FS (tkr) coords to scanner coords
--to-tkr : convert coordinates from scanner coords to native FS (tkr) coords

The GIfTI mesh is a XML format, so the result will look like this:

   <CoordinateSystemTransformMatrix>
      <DataSpace><![CDATA[NIFTI_XFORM_TALAIRACH]]></DataSpace>
      <TransformedSpace><![CDATA[NIFTI_XFORM_TALAIRACH]]></TransformedSpace>
      <MatrixData>
         1 0 0 0 
         0 1 0 0 
         0 0 1 0 
         0 0 0 1 
      </MatrixData>
   </CoordinateSystemTransformMatrix>

I do not know if this library reads, writes or preserves these transforms. Since they are so rarely used, I think they should be used with caution. GIFTI is an interchange format, so having compatibility with how it is implemented in the real world seems important.

@moskvich412
Copy link
Author

I totally agree with neurolabusc's last sentence: "GIFTI is an interchange format, so having compatibility with how it is implemented in the real world seems important." That is why I ask how coordinate system is dealt with in this library.

I do not see a way to specify coordinates when I save GIFTI using this librar. I also do not see second coordinate transformation nor values for DataSpace/TransformedSpace attributes when I load a GIFTI file. It is possible I am doing something wrong. It is possible these are not currently implemented in the library. Hence the question: Which of these two?

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

2 participants