[pymvpa] GIFTI i/o issue
Nick Oosterhof
n.n.oosterhof at googlemail.com
Tue Aug 25 16:18:43 UTC 2015
> On 24 Aug 2015, at 22:12, John Baublitz <jbaub at bu.edu> wrote:
>
> I am trying to export functional data from PyMVPA. Our lab is specifically trying to load functional data from the analysis (a list of vertices and a value associated with each vertex from the analysis) and visualize it in FreeSurfer. As I understand it, I have been saving it as functional data (using map2gifti) based on the update to PyMVPA that you committed. Unfortunately there seems to be an issue where FreeSurfer will not load an overlay with an extension .gii. I am happy to email FreeSurfer if this is more of a FreeSurfer issue but it seems that the .gii file output by PyMVPA does not really work with any FreeSurfer utils, not just the visualization as I mentioned with mris_convert. I am still unsure of where this issue is coming from: FreeSurfer or PyMVPA.
It seems it is due to a combination of the two:
- FreeSurfer seems to require the presence of anatomical data (vertices and faces) in a GIFTI file, even for functional data.
- The recent updates in PyMVPA could result in writing GIFTI-incompatible data, in particular when data was provided as float64 or int64 data. GIFTI only supports 8 and 32 bit data.
I've added support to the map2gifti function for a "surface" argument, which takes a anatomical Surface object (from mvpa2.support.nibabel.surf) or a filename of an anatomical surface. Also, data is casted to 32 bit representations. Storing GIFTI overlay data together with the anatomical data seems to make mris_convert happy. This is currently submitted in a PR [1].
For example, if ds is a PyMVPA dataset, you can do:
from mvpa2.suite import *
anat_surface=surf.from_any('pial.gii')
map2gifti(ds, filename='data_for_mris_convert.gii', surface=anat_surface)
and then
mris_convert data_for_mris_convert.gii data.asc
Can you see if this PR fixes the GIFTI issues for you?
[1] https://github.com/PyMVPA/PyMVPA/pull/357
More information about the Pkg-ExpPsy-PyMVPA
mailing list