Surface Scouts Definition

Hi Margherita,

You can do it with the script below. As with your lines of code, first open a figure with the cortex surface from Brainstorm.

% Scout vertices
sScout.Vertices = [1932,1933,1977,2073,2127,2166];

% Get Surface definition
TessInfo = getappdata(gcf, 'Surface'); % Consider only current figure
sSurface = TessInfo(1);                % Consider only first surface
% Get Surface vertices
[Vertices, Faces, VertexNormals, iVisibleVert] = panel_surface('GetSurfaceVertices', sSurface.hPatch, 0);
% Get visible scouts vertices
iScoutVert = intersect(sScout.Vertices, iVisibleVert);
% Expand slightly to avoid the exact overlap of the vertices
patchVertices = panel_scout('GetScoutPosition', Vertices, VertexNormals, iScoutVert, 0.0002);
% Get all the full faces in the scout patch
vertMask = false(length(Vertices),1);
vertMask(iScoutVert) = true;
% This syntax is faster but equivalent to: 
% patchFaces = Faces(all(vertMask(Faces),2),:);
iFacesTmp = find(vertMask(Faces(:,1)));
iFacesTmp = iFacesTmp(vertMask(Faces(iFacesTmp,2)));
iFacesTmp = iFacesTmp(vertMask(Faces(iFacesTmp,3)));
patchFaces = Faces(iFacesTmp,:);
% patchFaces as Scout vertices
[~, patchFaces] = ismember(patchFaces, iScoutVert);

% Plot
hold on
trisurf(patchFaces, patchVertices(:,1), patchVertices(:,2), patchVertices(:,3), 'Facecolor', 'blue')

Best,
Raymundo

[>]: Add the closest vertex (with respect to the seed) to the current scout.
[>>]: Grow scout in all directions. (Enlarge a scout by adding the next set of adjacent vertices)