Epileptogenicity Map error generating canonical surfaces

Hi Francois,
your previous help solved the initial errors. I have updated Brainstorm and no longer have the problem using the 20484 vertices.
However, working my way through the tutorial I have experienced an early and with my understanding insurmountable hurdle with the tutorial data, which I replicated with m,y data and on both a Windows and Mac systems. Matlab 2016a and b, latest Brainstorm version + SPM12

after co-registering and replacing MRIs the generating canonical surface step gives me the same error on 2 systems

SPM12: spm_preproc_run (v7408) 12:13:34 - 22/02/2019

Segment /Users/seris/.brainstorm/tmp/spm_canonical.nii
Completed : 12:15:02 - 22/02/2019
Undefined function or variable 'isfolder'.

Error in ft_filetype (line 156)
if isfolder(filename)

Error in ft_read_headshape (line 212)
fileformat = ft_filetype(filename);

Error in spm_eeg_inv_mesh (line 111)
fid = spm_eeg_fixpnt(ft_read_headshape(fullfile(spm('dir'), 'EEGtemplates', 'fiducials.sfp')));

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,[]) (line 564)
jItem = gui_component('MenuItem', jPopup, [], 'SPM canonical surfaces', IconLoader.ICON_SURFACE_CORTEX, [], @(h,ev)process_generate_canonical('ComputeInteractive', iSubject, []));


Folders on path. Names contain no spaces. Not sure what it is.

Nay help appreciated.

Stefano

Hi Stefano,

Looks like this is an error from SPM/Fieldtrip functions that use a Matlab feature that was introduced in R2017b (the isfolder function). I suggest either using an older version of SPM or updating your Matlab version if you can.

Cheers,
Marc

The function isfolder is available in the folder spm12/external/fieldtrip/compat/matlablt2017b.
If it is not available in your path, it means that the folder is not automatically added to your path as it should.

I modified a few things related with the interaction with FieldTrip and SPM in the past days.
Please do the following:

  • Update Brainstorm (menu Update > Update Brainstorm)
  • Update SPM
  • Remove all the SPM/Brainstorm/FieldTrip folders from your Matlab path (and save your path permanently)
  • Restart Matlab
  • Try again and let me know how it goes (post the new error message you get if it still doesn't work)

Btw: The SPM and FieldTrip tools are now also available from the compiled version of Brainstorm.

HI, I did what you said while still dosen't work. When I type which isfolder, It shows cannot find isfolder. The Matlab is 2016a. The system is Win10.

Can you please copy-paste here your Matlab path (type command "path") after :

  1. doing everything listed in the previous post
  2. running again the epileptogenicity process.

Please copy-paste the full error message you get from the Matlab command window when to run the process.

The error when I run Generate default surfaces in * SEEG epileptogenicity maps* is


** Error: Line 160: The function 'isFolder' corresponding to the input parameter of type 'char' is not defined.
**
** Call stack:
** >ft_filetype.m at 160
** >ft_read_headshape.m at 217
** >spm_eeg_inv_mesh.m at 111
** >process_generate_canonical.m>Compute at 152
** >process_generate_canonical.m>ComputeInteractive at 211
** >process_generate_canonical.m at 28
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_generate_canonical,'ComputeInteractive',iSubject,iAnatomy) at 1050
**


Here is an interesting thing. When I used matlabR2020a, running Generate default surfaces in SEEG epileptogenicity maps was OK. So I digged in an I found when I typed 'which isfolder' in MatlabR2020a, I got this 'built-in (D:\Program Files\MATLAB\R2020a\toolbox\matlab\general\isfolder)' , so I got into the same directory in 2016a, and I didn't find the isfolder in D:\Program Files\MATLAB\R2016a\toolbox\matlab\general, I asked others and they also didn't have it.So is there any possibility that the latest version of spm12 is not friendly to 2016a?

The function isfolder was introduced in Matlab R2017b:

For running with older versions of Matlab, FieldTrip (which is embedded in SPM) provides a replacement function in folder spm12/external/fieldtrip/compat/matlablt2017b.
This folder is added to the Matlab path only for Matlab versions older than 2017b.
If this folder doesn't get added dynamically to your Matlab path, there is maybe something wrong in your SPM/FieldTrip install. Repeat the steps I listed in a previous post to make sure everything is installed correctly.

The function 'ssFolder' corresponding to the input parameter of type 'char' is not defined.

This error also suggests something wrong in your installation.

Please try running the compiled version of Brainstorm and see if it works.
See sections "Without Matlab" on the installation page:
https://neuroimage.usc.edu/brainstorm/Installation