Issue setting fiducial points while importing Freesurfer output folder and creating BEM surfaces

Dear Brainstorm community,

I am for some reason running into multiple issues with Brainstorm currently. I'm working with an iMac, with macOS Big Sur (version 11.0.1) and Matlab 2020a, and Brainstorm from November 13, 2020. I've pasted issues below. I did just move my brainstorm_db to an external hard drive, but I don't think that's related to the issues I am having (in case, I have deleted the folder and created a new local one, but the BEM issue below still persists). For the BEM issue, it is also occurring for both the default anatomy as well for a participant's MRI that was already imported.

  1. I am having issues importing a Freesurfer output folder while trying to set the fiducial points.

Not enough input arguments.

Error in cross (line 11)
this = this@predictory(group1,options);

Error in cs_compute (line 49)
vz = cross(vx, LPA-RPA);

Error in figure_mri>LoadLandmarks (line 1744)
scsTransf = cs_compute(sMri, 'scs');

Error in figure_mri>SetFiducial (line 2318)
[sMri, Handles] = LoadLandmarks(sMri, Handles);

Error in figure_mri>@(h,ev)SetFiducial(hFig,'SCS','LPA') (line 252)
c.gridx = 2; c.gridy = 2; Handles.jButtonLpaSet = gui_component('button', Handles.jPanelCS, c,
'Set', , '', @(h,ev)SetFiducial(hFig, 'SCS', 'LPA'));

  1. The following error comes up with trying to create BEM surfaces.

** Error: Line 45: in_tess_bst (line 45)
** Surface file not found:
** Users/prabhjotdhami/Documents/MATLAB/Add-Ons/brainstorm_201113/brainstorm3/defaults/anatomy/ICBM152/Users/prabhjotdhami/.brainstorm/defaults/anatomy/ICBM152.zip/tess_cortex_pial_low.mat
** You should reload this protocol (right-click > reload).
**
** Call stack:
** >in_tess_bst.m at 45
** >tess_envelope.m at 86
** >tess_bem.m at 103
** >process_generate_bem.m>ComputeInteractive at 152
** >process_generate_bem.m at 24
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_generate_bem,'ComputeInteractive',iSubject,) at 597
**


I'm not sure why the path is coming like that (which is incorrect). It should be:

Users/prabhjotdhami/Documents/MATLAB/AddOns/brainstorm_201113/brainstorm3/defaults/anatomy/ICBM152

I've also done 'brainstorm reset', but the issue still persists. Any help here would be greatly appreciated.

I am having issues importing a Freesurfer output folder while trying to set the fiducial points.

This function cross is not the Matlab one, type which cross to see where it is coming from.
Cleanup your Matlab path: remove ALL the folders that are not related with MATLAB and SAVE it, then restart Matlab. Run brainstorm.m without adding the brainstorm3 folder and subfolders to the path.

The following error comes up with trying to create BEM surfaces.

Have you followed strictly all the recommendations for the Brainstorm folders?
https://neuroimage.usc.edu/brainstorm/Tutorials/CreateProtocol#Brainstorm_folders

Please copy-paste here the output of the following commands (with Brainstorm started):

bst_get('ProtocolInfo')
bst_get('BrainstormDefaultsDir')
dir(bst_fullfile(bst_get('BrainstormDefaultsDir'), 'anatomy'))
bst_get('UserDefaultsDir')
dir(bst_fullfile(bst_get('UserDefaultsDir'), 'anatomy'))
bst_get('AnatomyDefaults', 'ICBM152')

Hi Francois,

Thank you for your response. With regards to the importing issue, it seems to have been resolved after I cleaned up the paths as you suggested.

With regards to the creation of the Brainstorm folders, I have strictly followed the recommendations.

Please find below the output of the commands.

bst_get('ProtocolInfo')

ans =

struct with fields:

          Comment: 'Youth_TMSEEG'
          STUDIES: '/Volumes/Prabh Backup Plus Drive/brainstorm_db/Youth_TMSEEG/data'
         SUBJECTS: '/Volumes/Prabh Backup Plus Drive/brainstorm_db/Youth_TMSEEG/anat'
           iStudy: 60
   UseDefaultAnat: 0
UseDefaultChannel: 1

bst_get('BrainstormDefaultsDir')

ans =

'/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/brainstorm_201113/brainstorm3/defaults'

dir(bst_fullfile(bst_get('BrainstormDefaultsDir'), 'anatomy'))

. .. .DS_Store ICBM152

bst_get('UserDefaultsDir')

ans =

'/Users/prabhjotdhami/.brainstorm/defaults'

dir(bst_fullfile(bst_get('UserDefaultsDir'), 'anatomy'))

. ..

bst_get('AnatomyDefaults', 'ICBM152')

ans =

0×0 empty struct array with fields:

FilePath
Name

There seems to be something wrong with regards to the last two commands. I updated brainstorm, and the last command returned the ICBM152 template. I then ran a couple of participants for getting their BEM surfaces. However, after a couple of participants, the template came up as missing, I ran the last command you asked for, and it returned an empty array. Is my Brainstorm folder corrupt in any way? I've gotten rid of my current Brainstorm folder, downloaded the most up to date one from the site, and am stilling running into issues.

Not to add a list of problems to one thread, but furthermore, under my "functional data" panel in my current loaded protocol, nothing is being displayed. However, everything appears normal when I go to the anatomical or condition panel.

I tried 'Brainstorm reset', but that hasn't resolved anything. I also get a bunch of these messages related to different functions when trying to start Brainstorm.

Warning: The input to STR2FUNC "process_absolute 2" is not a valid function name. This will generate an error in
a future release.

In panel_process_select>ParseProcessFolder (line 2621)
In panel_process_select (line 30)
In bst_startup (line 396)
In brainstorm (line 205)

I've been using Brainstorm for a while now, and never ran into these issues before. The only thing that I've done differently recently is that I deleted my brainstorm_db that was on my computer, and created a new one on my external hard drive for space reasons (I followed this with a brainstorm reset).

Best,
Paul

There seems to be something wrong with regards to the last two commands.

Just the last one.
The incoherence is that you have brainstorm3/defaults/anatomy/ICBM152, but bst_get('AnatomyDefaults', 'ICBM152') doesn't return it.

I updated brainstorm, and the last command returned the ICBM152 template. I then ran a couple of participants for getting their BEM surfaces. However, after a couple of participants, the template came up as missing, I ran the last command you asked for, and it returned an empty array. Is my Brainstorm folder corrupt in any way?

Is your folder brainstorm3/defaults/anatomy/ICBM152 still there?

It looks like something weird is going on, it would require some manual debugging...
Open the code of function bst_get.m, put a breakpoint at line 2182 (in case 'AnatomyDefaults'), run
bst_get('AnatomyDefaults', 'ICBM152'). When the debugger stops, execute code line by line to understand what is going on. If you are not familiar with the Matlab debugger, watch an introduction video about it, it's a very useful tool!

Warning: The input to STR2FUNC "process_absolute 2" is not a valid function name

You have a file name "process_absolute 2" somewhere on your computer? Why?

I've been using Brainstorm for a while now, and never ran into these issues before. The only thing that I've done differently recently is that I deleted my brainstorm_db that was on my computer, and created a new one on my external hard drive for space reasons (I followed this with a brainstorm reset).

Can you still load your previous protocols from your local hard drive?
How does it go if you create a new protocol?
Are you sure about the integrity of your external hard drive and the completeness of the copy?

Hi Francois. I tried doing as clean of a restart of brainstorm and my db folder, and all seems to be working for some reason. I don't think I did anything new, but I'll take it.

I do have one concern that may or may not be related. As I'm starting my protocols from scratch again, I am importing my subject Freesurfer folders. However, I noticed that the Yeo atlases are no longer coming up once the anatomy is imported. Is there something wrong on my end? Or was this a recent change within Brainstorm?

Best,
Paul

The Yeo atlases are not generated by FreeSurfer's recon-all.
If you have computed it for each subject and it is available in the label of the FreeSurfer folder, then it should be imported automatically by newer versions of Brainstorm.

The Yeo atlases are available in the FsAverage atlas, which we don't recommend using for source estimation.

Consider using the Schaefer/Yeo atlases available when processing the MRI with CAT:
https://neuroimage.usc.edu/brainstorm/Tutorials/SegCAT12#Cortical_parcellations

We've just updated the CAT12 wrapper in Brainstorm: it takes now less than 1h per subject.

Thank you Francois. My mistake, I forgot that recon-all does not provide the Yeo atlases.