You can look at the interface of the c++ CiftiLib for ideas (mainly Cifti/CiftiXML.h and the classes that inherit from the Cifti/CiftiMappingType.h interface): https://github.com/Washington-University/CiftiLib . This library is nearly identical to the code we currently use in Connectome Workbench for CIFTI files.
There is a terminology problem here, though - I think you are talking about CIFTI mapping types, whereas "datatype" in NIFTI context usually refers to float, int32, etc. However, matrix is not one of those mapping types - you might want to take a second read through the CIFTI specification ( http://www.nitrc.org/forum/attachment.php?attachid=341&group_id=454&forum_id=1955), mainly the "General Concepts" section at the beginning, which is intended to describe what a CIFTI file can store, rather than how it stores it. I'll try to cover the main bits here: All CIFTI-2 files contain exactly one data matrix, and it always contains scalar values. The matrix can have either 2 or 3 dimensions (future versions may allow more dimensions), and every dimension is given a mapping - there are 5 mapping types in CIFTI-2: brain models, parcels, series, scalars, and labels. It is analogous to labeling the axes of a chart, if that helps. The standard CIFTI file types (.dscalar.nii, etc, described at the end of the main document) are carefully chosen combinations of these mapping types that are intended to cover most common use cases of CIFTI, while avoiding the full 25+125 total possible combinations possible, in order to make it easier to exchange data of similar meaning between software (for instance, if one group uses brain models by time, and another uses time by brain models, it would make it unnecessarily tedious to move data between them). However, there is allowance in the specification for the use of combinations other than these standard ones, where the file extension is up to the user. There is a (currently not very active) list related to this one for the discussion of the more technical aspects of CIFTI, here: http://lists.humanconnectome.org/mailman/listinfo/hcp-cifti , if you want to have a public discussion of something more technical without bothering this larger list. Also, you can contact me directly with implementation questions about CIFTI if that list doesn't seem appropriate either. Tim On Mon, Aug 4, 2014 at 12:49 PM, Satrajit Ghosh <[email protected]> wrote: > hi all, > > for those who use python and nibabel to do various image i/o operations a > basic implementation for reading and writing cifti-2 files is now in place > within nibabel. > > since cifti supports multiple data types (matrix, timeseries, scalars, > fibers), we ought to start thinking about how best to address an api for > each data type. there is an ongoing pull request here: > > https://github.com/nipy/nibabel/pull/249 > > would very much appreciate a quick or detailed review and more importantly > how best to expand the api for each data type. there are still quite a few > things to be implemented and any help would be much appreciated. > > cheers, > > satra > > > _______________________________________________ > HCP-Users mailing list > [email protected] > http://lists.humanconnectome.org/mailman/listinfo/hcp-users > _______________________________________________ HCP-Users mailing list [email protected] http://lists.humanconnectome.org/mailman/listinfo/hcp-users
