Freesurfer outputs To BrainVisa conversion pipeline

Convert Freesurfer outputs to GIFTI formats, handle coordinates systems links with BrainVISA/AIMS/Anatomist world, make resampled meshes and textures with direct vertex_to-vertex inter-subject correspondance, based on template sphere meshes.

Description

Before running this pipeline, a database should have been defined in BrainVISA preferences, which follows the "freesurfer" ontology (see the expert settings of the database).

STEP DESCRIPTION
03b Convert FreeSurfer anatomical image to Nifti format Data managed by FreeSurfer are in MGZ format, which is not used in BrainVISA. This step just performs a conversion from MGZ to Nifti format.
04 Conversion of FreeSurfer meshes to Gifti format Data managed by FreeSurfer are in MGZ format, which is not used in BrainVISA. This step just performs a conversion from MGZ to Gifti format.
06 Computation of resampling parameters Create the isin file:
  • Extraction of projection information about the inflated (right/left) hemisphere to sphere and the registration to (right/left) spherical surfaces with surface-based atlas (?h.sphere.reg.gii file).
  • Projection onto an icosphere (the ico100_7.mesh file) in order to normalize the number of nodes and their indexation. This way allows to compare meshes nodes by nodes across subjects.
07 Mesh resampling Resample ?h.pial.gii and ?h.white.gii with the ?h.isin file.
08 Conversion of meshes to aims referential Resample ?h.r.pial.gii and ?h.r.white.gii to use the aims coordinate system. Otherwise data are displayed upside down.
09/10 Converting freesurfer unreadable labels to aims textures Conversion ?h.aparc.annot and ?h.aparc.a2009s.annot.More information about ?h.aparc.annot and ?h.aparc.a2009s.annot .
11 Resample label textures Resample label textures ?h.aparc.annot.gii and ?h.aparc.a2009s.annot.gii with the ?h.isin file.
12 Converting freesurfer textures to Gifti format Conversion ?h.curv, ?h.avg_curv, ?h.curv.pial and ?h.thickness to Gifti format.
?h.avg.curv corresponds to the resample of the average curvature from the atlas to the subject.
14 Resampling freesurfer data textures Resample ?h.curv.gii, ?h.avg_curv.gii, ?h.curv.pial.gii and ?h.thickness.gii with the ?h.isin file.
15 Meshes inflate Inflate ?h.r.aims.white.gii.
16 Concatenate meshes Concatenate white, pial and inflated meshes.
17 Concatenate textures Concatenate right and left textures to bh.r.aparc.annot.gii and bh.r.aparc.a2009s.annot.gii.

Note on coordinates systems

Important: incorrect behavior in BV 4.6.0
For what I have understood, the Freesurfer toolbox for BrainVISA did not handle them well in BrainVisa 4.6.0. They appeared to be OK for Freesurfer 5.3 but not for Freesurfer 6.
Combining all this we can transform any data to any other one. The pipeline in BrainVisa 4.7 has been updated.

Parameters

anat: RawFreesurferAnat ( input )
icosphere_type: Choice ( optional, input )
This merely helps the link to the target template icosphere used in the Computation of resampling parameters process. There are basically 3 sets of meshes:
nu: Nu FreesurferAnat ( input )
ribbon: Ribbon Freesurfer ( input )
leftPial: FreesurferType ( input )
leftWhite: FreesurferType ( input )
leftSphereReg: FreesurferType ( input )
leftThickness: FreesurferType ( input )
leftCurv: FreesurferType ( input )
leftAvgCurv: FreesurferType ( input )
leftCurvPial: FreesurferType ( input )
leftGyri: FreesurferGyriTexture ( input )
leftSulciGyri: FreesurferSulciGyriTexture ( input )
rightPial: FreesurferType ( input )
rightWhite: FreesurferType ( input )
rightSphereReg: FreesurferType ( input )
rightThickness: FreesurferType ( input )
rightCurv: FreesurferType ( input )
rightAvgCurv: FreesurferType ( input )
rightCurvPial: FreesurferType ( input )
rightGyri: FreesurferGyriTexture ( input )
rightSulciGyri: FreesurferSulciGyriTexture ( input )

Technical information

Toolbox : Freesurfer

User level : 0

Identifier : freesurferToBrainvisaConversionPipeline

File name : brainvisa/toolboxes/freesurfer/processes/Tools/freesurferToBrainvisaConversionPipeline.py

Supported file formats :

anat :
FreesurferMGZ, FreesurferMGZ
nu :
FreesurferMGZ, FreesurferMGZ
ribbon :
FreesurferMGZ, FreesurferMGZ
leftPial :
FreesurferPial, FreesurferPial
leftWhite :
FreesurferWhite, FreesurferWhite
leftSphereReg :
FreesurferSphereReg, FreesurferSphereReg
leftThickness :
FreesurferThickness, FreesurferThickness
leftCurv :
FreesurferCurv, FreesurferCurv
leftAvgCurv :
FreesurferAvgCurv, FreesurferAvgCurv
leftCurvPial :
FreesurferCurvPial, FreesurferCurvPial
leftGyri :
FreesurferParcellation, FreesurferParcellation
leftSulciGyri :
FreesurferParcellation, FreesurferParcellation
rightPial :
FreesurferPial, FreesurferPial
rightWhite :
FreesurferWhite, FreesurferWhite
rightSphereReg :
FreesurferSphereReg, FreesurferSphereReg
rightThickness :
FreesurferThickness, FreesurferThickness
rightCurv :
FreesurferCurv, FreesurferCurv
rightAvgCurv :
FreesurferAvgCurv, FreesurferAvgCurv
rightCurvPial :
FreesurferCurvPial, FreesurferCurvPial
rightGyri :
FreesurferParcellation, FreesurferParcellation
rightSulciGyri :
FreesurferParcellation, FreesurferParcellation