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.
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.
- orig/001.mgz is the "native space" MRI. It has a "scanner-based" transform which can make the link to other images in Freesurfer.
- nu.mrg, ribbon.mgz etc are in a resampled space (1mm) different from orig/001.mgz. Their scanner-based transform is OK however.
- transforms/talairach.auto.xfm transforms from the Scanner-based referential to the MNI space.
- Meshes have internal transforms going from their coordinates system to the MNI ("Talairach") space. We don't really care their own coordinates system this way (and actually I'm not sure we have understood it, hence the problems in Brainvisa 4.6).
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:
- Brainvisa builtin sphere, 40962 vertices
- Freesurfer icospheres, named ic0, ic1... ic7. BrainVisa only ships the ic6 sphere, using also 40962 vertices, but which is different from the above BrainVisa one.
- Human Connectome Project spheres (hcp 40k) which have 32492 vertices and are lateralized: there is one mesh for the left hemisphere and another one for the right hemisphere. This lateralization ensures an additional inter-hemisphere vertex-by-vertex correspondance.
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 )
Toolbox : Freesurfer
User level : 0
Identifier :
freesurferToBrainvisaConversionPipeline
File name :
brainvisa/toolboxes/freesurfer/processes/Tools/freesurferToBrainvisaConversionPipeline.py
Supported file formats :
anat :FreesurferMGZ, FreesurferMGZnu :FreesurferMGZ, FreesurferMGZribbon :FreesurferMGZ, FreesurferMGZleftPial :FreesurferPial, FreesurferPialleftWhite :FreesurferWhite, FreesurferWhiteleftSphereReg :FreesurferSphereReg, FreesurferSphereRegleftThickness :FreesurferThickness, FreesurferThicknessleftCurv :FreesurferCurv, FreesurferCurvleftAvgCurv :FreesurferAvgCurv, FreesurferAvgCurvleftCurvPial :FreesurferCurvPial, FreesurferCurvPialleftGyri :FreesurferParcellation, FreesurferParcellationleftSulciGyri :FreesurferParcellation, FreesurferParcellationrightPial :FreesurferPial, FreesurferPialrightWhite :FreesurferWhite, FreesurferWhiterightSphereReg :FreesurferSphereReg, FreesurferSphereRegrightThickness :FreesurferThickness, FreesurferThicknessrightCurv :FreesurferCurv, FreesurferCurvrightAvgCurv :FreesurferAvgCurv, FreesurferAvgCurvrightCurvPial :FreesurferCurvPial, FreesurferCurvPialrightGyri :FreesurferParcellation, FreesurferParcellationrightSulciGyri :FreesurferParcellation, FreesurferParcellation