[FieldTrip] Issue with cortical sheet atlasing using Freesurfer and HCP-WB - with solution

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Oct 20 14:40:37 CEST 2021


Dear Tibor,

Thanks for sharing.
Indeed coordinate systems (https://www.fieldtriptoolbox.org/faq/coordsys/#details-of-the-freesurfer-coordinate-system) are a pain in the bum. And indeed Freesurfer is notorious for having the surfaces expressed in a different coordinate system than the corresponding volumetric anatomicals. Specifically, where you mention ’typically’ a volume from the same FreeSurfer processing, I’d say it is mandatory to use a reference image (e.g. T1.mgz or so, at least a volume that is in the /mri/ folder of a recon-all output) from the same FreeSurfer pipeline. Alternatively, one can run https://github.com/fieldtrip/fieldtrip/blob/master/bin/ft_postfreesurferscript.sh on the files in the /surf/ directory, which expresses the output surfaces in the same coordinate system as the input MRI images. (as per line 85 in the referenced shell script).

Best wishes and keep up the good work,

JM

On 20 Oct 2021, at 13:14, Tibor Auer via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear FieldTrippers,

I came across an issue when atlasing the source-level measures and the sourcemodel was estimated using FreeSurfer cortical sheet.

The typical code to read the corresponding FreeSurfer annotation uses ft_read_atlas:

    atlaslh = ft_read_atlas({‘label/lh.aparc.DKTatlas’,’surf/lh.pial’ },'format','freesurfer_aparc');
    atlasrh = ft_read_atlas({‘label/rh.aparc.DKTatlas’,’surf/rh.pial’ },'format','freesurfer_aparc');
    sourceatlas = rmfield(atlaslh,'rgba');
    sourceatlas.pos = vertcat(atlaslh.pos, atlasrh.pos);
    sourceatlas.tri = vertcat(atlaslh.tri, atlasrh.tri+size(atlaslh.pos,1));
    sourceatlas.aparclabel = vertcat(spm_file(atlaslh.aparclabel,'prefix','lh_'),spm_file(atlaslh.aparclabel,'prefix','rh_'));
    sourceatlas.aparc = vertcat(atlaslh.aparc, atlasrh.aparc+numel(atlaslh.aparclabel));

The issue, however, is that the positions do not correspond to those of the sourcemodel. It is not a FieldTrip issue, but a more generic one. E.g. FSL: JISCMail - FSL Archives<https://urldefense.com/v3/__https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;19c45d5b.1803__;!!HJOPV4FYYWzcc1jazlU!s-pXYehuu6woMknmRYORhLOPZ2KHyp8vbG1ReYL_ocY5Ur7pbnHMxCIE2jCayGkh0Wu1LS1L-tAJ9Wc$>. FSL solves the issue by asking for a reference image (typically a volume from the same FreeSurfer processing). Based on the FSL codes for fsleyes<https://urldefense.com/v3/__https://open.win.ox.ac.uk/pages/fsl/fsleyes/fsleyes/apidoc/_modules/fsleyes/displaycontext/meshopts.html__;!!HJOPV4FYYWzcc1jazlU!s-pXYehuu6woMknmRYORhLOPZ2KHyp8vbG1ReYL_ocY5Ur7pbnHMxCIE2jCayGkh0Wu1LS1L6P1iGA4$> and fsl.data.mghimage<https://urldefense.com/v3/__https://git.fmrib.ox.ac.uk/fsl/fslpy/-/blob/master/fsl/data/mghimage.py__;!!HJOPV4FYYWzcc1jazlU!s-pXYehuu6woMknmRYORhLOPZ2KHyp8vbG1ReYL_ocY5Ur7pbnHMxCIE2jCayGkh0Wu1LS1La76onHQ$>, I managed to implement something similar in MATLAB:

    fsmri = MRIread(‘mri/T1.mgz’);
    sourceatlas = ft_transform_geometry(fsmri.vox2ras/fsmri.tkrvox2ras, sourceatlas);

After transformation, the sourceatlas will be aligned to the sourcemodel.

Kind regards,
Tibor

Auer, Tibor M.D. Ph.D.
Research Fellow
School of Psychology, Faculty of Health and Medical Sciences
University of Surrey, Guildford GU2 7XH
T.Auer at surrey.ac.uk<mailto:T.Auer at surrey.ac.uk>
@TiborAuer<https://urldefense.com/v3/__https://eur02.safelinks.protection.outlook.com/?url=https*3A*2F*2Ftwitter.com*2FTiborAuer&data=04*7C01*7Ct.auer*40surrey.ac.uk*7C5f32dba325f5422f5c5a08d8becc029f*7C6b902693107440aa9e21d89446a2ebb5*7C0*7C0*7C637469131016806177*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C1000&sdata=wkpejqTmmo*2Fe4JA9QIaA6Z3*2BzipbFY*2FCEmRXC9UvKJs*3D&reserved=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSU!!HJOPV4FYYWzcc1jazlU!s-pXYehuu6woMknmRYORhLOPZ2KHyp8vbG1ReYL_ocY5Ur7pbnHMxCIE2jCayGkh0Wu1LS1LYjZgM-Y$>

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!s-pXYehuu6woMknmRYORhLOPZ2KHyp8vbG1ReYL_ocY5Ur7pbnHMxCIE2jCayGkh0Wu1LS1LhbTATZM$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20211020/7942af85/attachment.htm>


More information about the fieldtrip mailing list