Export scout as freesurfer label

Hello,

I was wondering, is there any solution to export scout as Freesurfer ROI (*.label) ?

My problem is that I want to generate the controlateral region of a scout and to do that it seems that I can use Xhemi from free surfer to map a label from the left to right hemisphere using:

mris_apply_reg --src-label label/rh.V1_exvivo.thresh.label --trg rh-on-lh.V1_exvivo.thresh.label \
--streg xhemi/surf/lh.fsaverage_sym.sphere.reg surf/lh.fsaverage_sym.sphere.reg

(Xhemi - Free Surfer Wiki)

Regards,
Edouard

It is relatively easy to do I guess.
It requires:

  • Moving part of the function panel_scout.m/SaveScouts to a new function export_scout.m, similar to other export functions e.g. export_matrix.m
  • Editing it enable a new entry: {'.label'}, 'FreeSurfer ROI, single scout (*.label)', 'FS-LABEL-SINGLE'
  • Writing the export code, based on the import code (see import_label.m line 218)

I won't be able to work on this write now. Do you want to give it a try?

Indeed, it was quite simple.

Does Export scout as label by Edouard2laire · Pull Request #565 · brainstorm-tools/brainstorm3 · GitHub works for you?
If my experimentation with the generation of the contralateral region works, i will make a post to explain how to do it :slight_smile:

Edouard

Implemented here: Export scout as FreeSurfer .label · brainstorm-tools/brainstorm3@0709bc6 · GitHub

Hello Francois,

How do the FreeSurfer sphere works in brainstorm ? When importing a FreeSurfer folder, the sphere are imported for all surface regardless of the number of vertex in each surface. How is it done ?

When I look in tess_addsphere it doesn't seem to do any downsampling. But if I execute

sphere_path = fullfile(folder_path,'surf/',"lh.sphere.reg");
SphereVertices = mne_read_surface(sphere_path);

i get:

/Users/edelaire1/Desktop/ICBM512/surf/lh.sphere.reg is a triangle file (nvert = 152495 ntri = 304986)
created by edelaire on Thu Aug 4 22:42:03 2022
Read a surface with 152495 vertices from /Users/edelaire1/Desktop/ICBM512/surf/lh.sphere.reg

But the surface I am working with (that is also linked to this sphere) only has 15 000 vertex.

I think this is linked also the one issue I have with Xhemi; after projecting the scout from left to right hemisphere; the scout is on a surface with 152495 vertex.
( /Users/edelaire1/Desktop/ICBM512/surf/lh.fsaverage_sym.sphere.reg is a triangle file (nvert = 152495 ntri = 304986))

Edit:

So it seems that the sphere are registered with lh/rh pial surface. So when we import a Fs folder, brainstorm import the pial surface, the sphere and then downsample the two :

[iLh, BstTessLhFile, nVertOrigL] = import_surfaces(iSubject, TessLhFile, 'FS', 0);
[TessMat, err] = tess_addsphere(BstTessLhFile, TessLsphFile, 'FS');

[BstTessLhLowFile, iLhLow, xLhLow] = tess_downsize(BstTessLhFile, nVertHemi, 'reducepatch');

and to do that in Tess_downsize:

[NewTessMat.Faces, NewTessMat.Vertices] = reducepatch(TessMat.Faces, TessMat.Vertices, dsFactor);
[tmp, I, J] = intersect(TessMat.Vertices, NewTessMat.Vertices, 'rows');
% Re-order the vertices so that they are in the same order in the output surface
[I, iSort] = sort(I);

newSphVert = TessMat.Reg.Sphere.Vertices(I,:);
NewTessMat.Reg.Sphere.Vertices = newSphVert;

Edit2: Ok so I tried to save the vector I; that is used to sample from the sphere; to then resample other sphere :


sphere_path = fullfile(folder_path,'surf/',"lh.fsaverage_sym.sphere.reg");
[verts, faces] = mne_read_surface(sphere_path);
verts = verts(Idx_L, : );
faces = faces(Idx_L, : );
sphere_path_out = fullfile(folder_path,'bst_label/',"lh.fsaverage_sym.sphere_resample.reg");
mne_write_surface(sphere_path_out,verts,faces,'resampled')

but doesn't work:

$Id: mris_apply_reg.c,v 1.6.2.4 2016/12/08 22:02:40 zkaufman Exp $
cwd /NAS/home/edelaire/Documents/FS_db/ICBM512/bst_label
cmdline mris_apply_reg --src-label scout_precentral_left.label --streg xhemi.lh.fsaverage_sym.sphere_resample.reg lh.fsaverage_sym.sphere_resample.reg --trg scout_precentral_left_right.label
sysname Linux
hostname perf-imglab07
machine x86_64
user edelaire
srcvalfile (null)
trgvalfile scout_precentral_left_right.label
nsurfs 2
jac 0
revmap 0
1 Loading xhemi.lh.fsaverage_sym.sphere_resample.reg
f[732]->v[1] = 7503 - out of range!

I guess the issue might be 'faces = faces(Idx_L, : );';

Edit 3; Found a way using the left-> right sphere coregistration :

Red: Original scout
Green : Projected

Willl clean up the code and make a PR. PR opened here: Scout Projection from one hemisphere to another by Edouard2laire · Pull Request #566 · brainstorm-tools/brainstorm3 · GitHub

Regards,
Edouard

I guess you have answered all your initial questions, and that we can keep discussing on the PR directly.

Projecting a scout on the contralateral hemisphere is a question that I got regularly, this can be a useful feature, but the annoying part is that it requires extra parameters when running recon-all.
This must be documented in the FreeSurfer and Scout tutorials for other users to reproduce this:

The ICBM152 template should be updated as well, and the dataset of the introduction tutorial.
This is not such a trivial change...

1 Like