Analyzing func.gii files with SPM12

Has anyone had any success performing a basic, 1st-level analysis of gifti surface files in SPM12? Or, can someone point me to a bit of documentation on GLMs with surface files (in SPM12)? I have files that were generated during preprocessing with fmriprep. I had hoped that this would be as simple as replacing a regular call to

matlabbatch{1}.spm.stats.fmri_spec.sess.scans = {'[filename].nii,1' '[filename].nii,2', ...}

with

matlabbatch{1}.spm.stats.fmri_spec.sess.scans = {'[filename].func.gii'}, but SPM12 seems to have trouble recognizing the .func.gii filetype (see output below).

Running 'fMRI model specification’
Warning: Cannot recognise format. Trying Analyze.

In read_hdr_raw (line 50)
In read_hdr (line 30)
In nifti (line 26)
In spm_select>spm_select_get_nbframes (line 268)
In spm_select>spm_select_expand (line 254)
In spm_select (line 130)
In spm_run_fmri_spec (line 125)
In cfg_run_cm (line 29)
In cfg_util>local_runcj (line 1688)
In cfg_util (line 959)
In cfg_ui>MenuFileRun_Callback (line 703)
In gui_mainfcn (line 95)
In cfg_ui (line 53)
Failed 'fMRI model specification’
Error using read_hdr (line 52)
Unrecognised datatype (30583.000000) for “D:\git\fMRI\ntf\data\derivatives\fmriprep\sub-01\func\sub-01_task-loc_run-01_bold_space-fsnative.L.func.gii”.
In file “D:\documents\MATLAB\toolbox\spm12@nifti\private\read_hdr.m” (v4967), function “read_hdr” at line 52.
In file “D:\documents\MATLAB\toolbox\spm12@nifti\nifti.m” (v4986), function “nifti” at line 26.
In file “D:\documents\MATLAB\toolbox\spm12\spm_select.m” (v6530), function “spm_select_get_nbframes” at line 268.
In file “D:\documents\MATLAB\toolbox\spm12\spm_select.m” (v6530), function “spm_select_expand” at line 254.
In file “D:\documents\MATLAB\toolbox\spm12\spm_select.m” (v6530), function “spm_select” at line 130.
In file “D:\documents\MATLAB\toolbox\spm12\config\spm_run_fmri_spec.m” (v6562), function “spm_run_fmri_spec” at line 125.

No executable modules, but still unresolved dependencies or incomplete module inputs.
The following modules did not run:
Failed: fMRI model specification`

Note that I’m able to load the files with a call to

func = gifti('filename.func.gii');

and display them overlayed on the surface files:

surf = gifti('filename.surf.gii');

figure; plot(surf,func);

Thanks for your time

PS
Working in a fresh install of SPM12, Matlab2016b, Windows 10

PSS
This is a continuation of a related thread: Preferred method for extracting bold timecourse based on anatomically defined regions?

This question was asked of the SPM mailing list as well. For anyone else in this situation, this is possible! See the thread
unsure why SPM12 unable to load GIFTI files during 1st-level Analysis
.

4 Likes

Hello! I know this thread is ancient, but I would be very happy if someone could be of help. Has someone made spm work on gii files successfully?
I can do surface analysis on the first level and get meaningful output. But on the second level the con files are all zero. I checked whether the input files from the first level are ok and they are (all non-zero, no NaNs, not empty).
I don’t even get an error message.

thank you very much.