How to read niml.dset into matlab?

Hi there,

I’m currently using with -surf block processing rsfmri data.
So what I’m interested in is I converted these file to gifti type using ConvertDset -o_gii. Reading these gifti files with GIfTI library for matlab(@gifti). However it returns only cdata. Although I can do some calculations on it, I don’t know how to mapping the results back to surface space for Visualizing and FWE.

Does gii converted from niml.dset contains ‘vertices field’ ?
Are there other methods that read/write niml.dset in matlab?

Thanks in advance.

Hi Xiwen,

The errts datasets (as well as pb*, stats*, etc) are purely data on nodes. Those nodes correspond to surface datasets (vertex coordinates and triangles), but the surface information is not included (as it would be redundant across so many copies).

Surface datasets include smoothwm, pial, etc. They define the surface. Plotting data on the surface (betas, thickness) is a separate step with separate data.

The results directory should have a run_suma script to give you an example of associating data with a particular surface (or family of surfaces in that example).

  • rick

The niml.dset file is often a simple text file with a single column of numbers following a short XML-like header.

less std.60.lh.thickness.niml.dset
ni_form=“ni_group” >
data_type=“Node_Bucket_data” >

gifti files can define surfaces or the data on those surfaces. The first kind is sometimes named with surf.gii while the second type may be func.gii, label.gii, shape.gii or time.gii depending on the kind of data that’s being mapped. In AFNI, we typically use gifti files for only the spatial sort that defines the coordinates, but the ConvertDset program does convert our niml.dset format to one of the second sort. You should be able to read the niml.dset files with Matlab as text files, or you can use 3dmaskdump to dump out the values to a text file and then read from that.

Thanks for your answer. I still have some questions:

  • I do successfully read the errts data (198812 * 230). After calculations, I got a t values data (198812 * 1). Next, I wanna visualize the result using SUMA and perform a FWE correction. How can I save the data to let SUMA recognize the result?

  • The second question may not related to AFNI: What is the difference between lh.thickness and lh.curv. I thought they’re both second type and in same dimension. However I can’t read the lh.thickness by @gifti. Interesting, I can read lh.thickness.fwhm*.fsaverage.mgh but failed in lh.thickness.

Load datasets in suma with ctrl-s to open the surface object controller menu. Then select “Load Dset” on the lower left part of that menu. The default file selection filter will show only the niml.dset files, but you can change that to any other filter like just an asterisk character to search for any file name, and then select “Filter”. Find the file you want and select “Open”.

I’m sorry I don’t know why @gifti will only read one of those two file types - thickness and curvature. They are similar as far as I can tell. The mgh format is different than either gii or niml.dset.

Thanks for your kind reply ! I will try that. Have a nice day !