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:
This PR ensures that "cdata" and "indices" data are stored as column vectors.
In addition, it introduces two minor fixes:
even if there are multiple data elements with intent 'cdata', the fieldnamesfunction returns 'cdata' only once.
if there is an 'indices' element, then when saving the file, it is the first element present. This is required per the GIFTI standard, page 19:
For storing a subset of node data, a DataArray with intent NIFTI_INTENT_NODE_INDEX
may be used. In this case, the data array contains a list of node numbers and it should be
the first data array in the file. The remaining data arrays in the file that contain data
assigned to nodes must contain the same number of elements as the
NIFTI_INTENT_NODE_INDEX array.
the GIFTI standard requires that cdata (such as time series data) has Dimensionality=1 according to [1], page 36:
In the original code, the following produces an illegal GIFTI file that cannot be read by AFNI's ConvertDset:
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:
fieldnames
function returns 'cdata' only once.if there is an 'indices' element, then when saving the file, it is the first element present. This is required per the GIFTI standard, page 19:
For storing a subset of node data, a DataArray with intent NIFTI_INTENT_NODE_INDEX may be used. In this case, the data array contains a list of node numbers and it should be the first data array in the file. The remaining data arrays in the file that contain data assigned to nodes must contain the same number of elements as the NIFTI_INTENT_NODE_INDEX array.
[1] https://www.nitrc.org/frs/download.php/2871/GIFTI_Surface_Format.pdf