Importing merged Desikan Killiany using MATLAB script

Hi community,

I have been trying to figure out the code on how to script my code and I could not find much information on this. I have a scout_Desikan-Killiany_modified.mat file which is a scout file I created from the existing Desikan-Killiany atlas for the surface model. Using the create atlas, I copied the atlas and merged certain scouts as per the need of my experiment and obtained this modified scout file.

To extract my source time series, I need to import this scout file back into Brainstorm so that I could use it for all my cohorts. I am using a scripting procedure and I was wondering how I could get this scout file back into Brainstorm and then extract the time series for the newly imported scout file.
(Keep in mind i can do this manually using the GUI by just selecting load atlas button on the scout tab)

So far I've come across import_label() but I have much difficulty in implementing an import section for a third-party scout file and then extracting the source time series for the same.

If someone could direct me to an idea of how to do this, it would be a great help for me.

Thanks in advance.
Best,
a13

HI @a13,

Keep in mind that this modified Desikan-Killiany atlas is only valid for the save surface that contain the original Desikan-Killiany that was merged.

The process (copying, modifying the DK atlas and adding the modified-DK atlas) depends on the anatomy that is used for each of the Subjects in the Protocol.

  1. For Subjects using the Default Anatomy: the process only needs to be done for the Default-Anatomy Cortex.

  2. For Subjects not using the Default Anatomy, the process needs to be done for each of the Subjects, as their DK atlases are not the same vertex by vertex.

The simplest way would do to modify directly the Atlases for the Subject's Cortex:

  1. Load the surface for that
  2. Get the Desikan-Killiany atlas
  3. Modify (merge) it
  4. Add the modified atlas to the surface strucutre
  5. Save surface file
SubjectName = 'Subject01';
AtlasName   = 'Desikan-Killiany';

% Get subject definition
sSubject = bst_get('Subject', SubjectName);
% Get default cortex file
CortexFile = sSubject.Surface(sSubject.iCortex).FileName;
% 1. Load cortex file
sCortex = in_tess_bst(CortexFile);
% 2. Get DK Atlas
iAtlas = find(strcmp(AtlasName, {sCortex.Atlas.Name}));
sAtlas =  sCortex.Atlas(iAtlas);
% 3. Modify Atlas, change Name and keep only first Scout
sAtlasMod = sAtlas;
sAtlasMod.Name   = ['Modified ' sAtlasMod.Name];
sAtlasMod.Scouts = sAtlasMod.Scouts(1);
% 4. Add modified Atlas
sCortex.Atlas(end + 1) = sAtlasMod;
% Save cortex file
bst_save(file_fullpath(CortexFile), sCortex, 'v7');

More info on the Atlas and Scout structures:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scouts#On_the_hard_drive

Best,
Raymundo

Hi @Raymundo.Cassani,

Thanks for this version of the pipeline. I appreciate it!

I forgot to mention my subjects will be going to use the default anatomy itself, it being ICBM152. The process you describe seems cumbersome for each subject. My question here is, is it possible to upload the scout file that I've created for the merged regions? The file is a scout_Desikan-Killiany.mat.

I was wondering since I am able to click on the Load Atlas button, I should be able to script it out using a function. If you could help me to the function that uploads the scout file, it'd be a great help.

Thanks,
a13

If they all use the default anatomy, it only needs to be done once for the default anatomy, and the modified atlas will appear for all the subjects.

It is import_label, and it would be called like:

import_label(SurfaceFile, FullPathToYourScoutFile, 1, [], 'BST');

You still need to retrieve the SurfaceFile, as in the shared script above

Thanks so much, @Raymundo.Cassani. This method worked, and I now understand the underlying process much better.

You are much appreciated! :grinning:

Best,
a13