nno / matlab_GIfTI

A MATLAB GIfTI library
Other
3 stars 2 forks source link

store cdata matrix as separate data elements for each column #1

Open nno opened 9 years ago

nno commented 9 years ago

the GIFTI standard requires that cdata (such as time series data) has Dimensionality=1 according to [1], page 36:

The functional file contains one or more DataArrays with Intent set to NIFTI_INTENT_NONE 
or one of the statistical intent values. Each DataArray has DataType set to NIFTI_TYPE_FLOAT32.
Dimensionality is one with the first dimension set to the number of nodes.

In the original code, the following produces an illegal GIFTI file that cannot be read by AFNI's ConvertDset:

s=struct();
s.cdata=randn(7,3);
g=gifti(s);
save(g,'myfile.gii')

because the DataArray has Dimensionality='2'.

This PR ensures that "cdata" and "indices" data are stored as column vectors.

In addition, it introduces two minor fixes:

[1] https://www.nitrc.org/frs/download.php/2871/GIFTI_Surface_Format.pdf