[Scripting] importing volume atlas from subject anatomy as source scouts

Hi @Taiziliulong, you were in the good path. The required information is read from the Fig handler, so it is needed to open the figure.

The piece of information that was missing is about volume sources, while they are plotted on the MRI (Viewer or 3D) they are not MRI, they are values for a volume grid (defined in the head model), the these values are interpolated in the MRI volume. All this to say, the file that needs to be open is the volume sources, not the MRI.

Volume head models: https://neuroimage.usc.edu/brainstorm/Tutorials/TutVolSource#Compute_a_volume_head_model

Note that your sources (from the screenshot) are not files in the HDD, they are a source link to a kernel. See the section source links in here:

You can obtain the "path" for the source link by right-click on it > File > Copy file path to clipboard

To plot the source file

SourceFile = 'link|Subject01/.../*KERNEL*.mat|Subject01/.../*data*.mat';
hFig = view_mri([], SourceFile);

Then you can run the lines you posted to import the Volume atlas:

ScoutFiles = 'Subject01/subjectimage_aal3_volatlas.mat';
isNewAtlas = 1;

And close figure


:bulb: Note that the importing the Atlas just needs to be done once per Subject. These atlases are saved in the default (in green) cortex file for the Subject.

You can programmatically find the source files with the process File > Select files : Sources