Problem of generating default surfaces_SEEG

Hi there,

When I tried to generate SPM canonical surface for SEEG data, the following error appeared.

Could you please let me know how to fix this? Do I need to add new version of SPM to the path or something else?

Thanks!
Jie

BST> Emptying temporary directory…
Undefined function or variable ‘spm_preproc_run’.

Error in spm_eeg_inv_spatnorm (line 43)
spm_preproc_run§;

Error in spm_eeg_inv_mesh (line 32)
mesh = spm_eeg_inv_spatnorm(mesh);

Error in process_generate_canonical>Compute (line 151)
spmMesh = spm_eeg_inv_mesh(NiiFile, Resolution);

Error in process_generate_canonical>ComputeInteractive (line 210)
[isOk, errMsg] = Compute(iSubject, iAnatomy, Resolution, 1);

Error in process_generate_canonical (line 28)
eval(macro_method);

Error in tree_callbacks>@(h,ev)process_generate_canonical(‘ComputeInteractive’,iSubject,iAnatomy) (line 972)
gui_component(‘MenuItem’, jPopup, [], ‘SPM canonical surfaces’, IconLoader.ICON_SURFACE_CORTEX, [],
@(h,ev)process_generate_canonical(‘ComputeInteractive’, iSubject, iAnatomy));

Hi Jie,

It seems only part of the SPM toolbox is in your Matlab path, or some files are missing from your installation. Find your SPM path and add it and all its subfolders to the Matlab path with this command:

addpath(genpath('/your/path/to/spm'));

If you don't know where SPM is installed, you can try to look for the parent folder of spm_eeg_inv_mesh.m which seems to already be in your path. At the BIC, it's under '/usr/local/spm8'.

If that doesn't work, I suggest you do a clean installation of SPM locally.

I hope this helps,
Martin

Hi Martin,

Thanks for your reply. I solved the previous problem followed your suggestion. spm_preproc_run is a new function in SPM12 but not SPM8. But unfortunately, a new error came out.

Would you mind to come upstairs and help me have a look?

Thanks!
Jie

SPM12: spm_preproc_run (v6365) 14:22:12 - 19/10/2018

Segment /export01/data/jdong/brainstorm_tmp/spm_canonical.nii
Completed : 14:24:04 - 19/10/2018
Error using read_gifti_file (line 17)
[GIFTI] Loading of XML file /usr/local/spm12/canonical/cortex_20484.surf.gii failed.

Error in gifti (line 71)
this = read_gifti_file(varargin{1},giftistruct);

Error in spm_eeg_inv_mesh (line 56)
mesh.tess_mni = export(gifti(filename), ‘spm’);

Error in process_generate_canonical>Compute (line 151)
spmMesh = spm_eeg_inv_mesh(NiiFile, Resolution);

Error in process_generate_canonical>ComputeInteractive (line 210)
[isOk, errMsg] = Compute(iSubject, iAnatomy, Resolution, 1);

Error in process_generate_canonical (line 28)
eval(macro_method);

Error in tree_callbacks>@(h,ev)process_generate_canonical(‘ComputeInteractive’,iSubject,iAnatomy) (line 972)
gui_component(‘MenuItem’, jPopup, [], ‘SPM canonical surfaces’, IconLoader.ICON_SURFACE_CORTEX, [],
@(h,ev)process_generate_canonical(‘ComputeInteractive’, iSubject, iAnatomy));

Somehow, SPM’s gifti reader cannot read its own template files, it’s saying file spm12/canonical/cortex_20484.surf.gii has invalid XML. I think your best bet would be to ask the SPM folks.

@Francois any ideas?

Hi Jie,

I’ve seen this error in an older SPM12 version.
You can try deleting all the SPM12 installs on your computer, make sure they are not in your Matlab path anymore, and download the latest SPM12 version from the website.
Do not add SPM12 to your path: in the braintorm preferences, just set the SPM path.

Cheers,
Francois

Thanks Francois! It works now.