Skip popup box in scout timeseries calculation

Hi there,

I’m trying to calculate scouts time series with custom anatomy templates. I have written a script to automatically do this for all source estimation files I have created. For each file, I get a popup saying : The cortex file associated with these sources no longer exists. Using instead: cortexfile.mat

This is the cortex file that I want to use, and the popup gives an option for “ok”. I want the script to run without the popup box appearing, so I don’t have to manually press OK multiple times for each subject. How can I do this?


As the warning indicates, the cortex file (SurfaceFile) associated with the source no longer exists, therefore Brainstorm tries to automatically find it. What you can do is for each of your source file, set the SurfaceFile field to the existing one (cortexfile.mat). Refer to this section to see the proper format of this field (it depends on where cortexfile.mat is located):
Typically it is {SubjectName}/cortexfile.mat

Once that is fixed, the warning will stop appearing.


How do i set the surface file for each source file?

Here’s one way, where sFiles is a list of your source files you iterate on with index i:

[sMat, matName] = in_bst(sFiles{i});
ProtocolInfo = bst_get('ProtocolInfo');
sMat.SurfaceFile = 'SubjectName/cortexfile.mat'; % Change this line
outputFile = bst_fullfile(ProtocolInfo.STUDIES, sFiles{i})
bst_save(outputFile, sMat, 'v6');


This file should not be called cortexfile.mat, but something like tess_cortex_…mat, otherwise it will cause many issues in the automatic management of the database.


The actual filename is tess_cortex_pial_low.mat, I just called it cortexfile.mat for simplicity. I am trying what MartinC suggested right now I will report back if this works. Thanks!

When I run the code that MartinC wrote I am still getting the same popup “The Cortex file associated with these sources no longer exists. Using instead: SubjectID/tess_cortex_pial_low.mat”

Are you sure the file you’re looking for is under SubjectID? It it sometimes under @default_subject or other folders. Try to locate where that good tess_cortex_pial_low.mat file is first.

Ah I think it was looking for tess_cortex_pial_low in the data folder as opposed to the anat folder. Nonetheless I ran the script last night using AutoHotKey and it managed to work out fine.