-
Notifications
You must be signed in to change notification settings - Fork 266
Description
I am working with HCP Conte69 surface data in resolution that's not supported in the official HCP pipeline. I mostly work with surf.gii, shape.gii, func.gii and cifti format. I will focus on gifti in this issue as cifti is a different file format. I found the nibabel gifti function a bit difficult to use for read/write the actual data. I would like to propose a new API aiming at more intuitive access to the data and save new output.
The most important information for me as a user is
- the intents of the darrys
- size of the collection of darray (currently supported through GiftiImage.numDA)
- resolution (ie. mesh face and coordinate numbers)
- access data as numpy arrays rather than going through all GiftiImage.darrays to concatenate the information (similar to the output from nilearn.surface.load_surface_mesh)
Header-like method to access information of in point 1 to 3
The current GiftiImage.print_summary()
method will give you all the metadata, but the only useful information is the metadata in the intents. Currently, you have to access the darrays first to get more useful information.
GiftiImage.darrays[0].print_summary()
Some
I would like to have a header that can access the information about the intents.
Something like this:
GiftiImage.header
GiftiImage.header.intents - what are the intents of the data array
GiftiImage.header.meta - for the metadata
Access data
For .func.gii
and other metric files, it would be nice to concatenate all darrys for timeseires data through get_data()
.
For any kind of mesh (surf.gii
), the method will return a tuple of corrdinates and faces.
The preliminary idea is as follow:
get_data(intent_code=None):
timeseries = vstack(da.data for da in get_array_by_intent)
coords = get_arrays(pointset).data
faces = get_arrays(triangles).data
return (coords, faces)
if None:
tuple(da.data for da in self.darrays)
Creating gifti files
Currently I replace the data in exisitng gifti files to create new image. It would be helpful if I can just pass a dictionary with the intents as keys and the data as the entry to create a new file.
For surface mesh (surf.gii
), the user can pass a tuple of (coords, faces) and the funciton will translate that into data arrays. For timeseries data or other metric data (func.gii
, shape.gii
, and so on), we can have a np array of the size time x faces and parse each timepoint as a darray to fit the gifti format.