32
Introduc)on to FreeSurfer h0p://surfer.nmr.mgh.harvard.edu Jenni Pacheco [email protected]

Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

  • Upload
    others

  • View
    15

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Introduc)ontoFreeSurferh0p://surfer.nmr.mgh.harvard.edu

[email protected]

Page 2: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Analyzingtheindividualsubject

•  Whathappens?•  HowdoIdothat?

•  Nowwhat?

Page 3: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Toolsyouwilluse

•  recon‐all– Commandlinescriptwillrunallthestepsoftheprocessingstream.NoGUIinterface.

•  tkmedit– Volumeviewer.Usedtovisualizeallvolumeoutput

•  tksurfer– Surfaceviewer.Usedtovisualizeallsurfacemodels.

Page 4: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

How to Get Started

UsedicomsfromscannerasinputtoCor)calReconstruc)oncommand:

recon‐all‐all‐i<input>‐s<subject>

mustdoforeachsubject.

Comebackin30hours…Checkyourresults–accuratetothe)ssue

boundaries?

Page 5: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Reconstruc)onStages

recon‐allisbrokenintothreestages– autorecon1– autorecon2– autorecon3

these3stagesareequivalentto‐all

Page 6: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Set‐upEnvironmentalVariables

•  FREESURFER_HOME–variablethatgivesthepathtoyourversionofFreeSurfer

•  setenvFREESURFER_HOME/path/to/installa)on•  echo$FREESURFER_HOME

•  SUBJECTS_DIR–variablethatgivesthepathtothedirectorywhereyoursubjectslive

•  setenvSUBJECTS_DIR/path/to/your/study•  echo$SUBJECTS_DIR

Page 7: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Set‐upEnvironmentalVariables

bert

$SUBJECTS_DIR

fred sara margaret …

Subject ID

Page 8: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

MGZFileFormat

001.mgz •  mgz = compressed MGH file •  Can store 4D (like NIFTI) •  cols, rows, slices, frames •  Generic: volumes and Surfaces

•  Eg, Typical Anatomical volume: 256 x 256 x 128 x 1

“Volume-encoded” Surface Files

•  nvertices, 1, 1, frames (eg, 163214 x 1 x 1 x 40) •  No geometry information

lh.thickness.sm10.mgz

Page 9: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

OtherFileFormats

•  Surface: lh.white, lh.pial, lh.orig •  Curv: lh.curv, lh.sulc, lh.thickness •  Annotation: lh.aparc.annot •  Label: lh.pericalcarine.label •  Unique to FreeSurfer •  FreeSurfer can read/write:

•  NIFTI, Analyze, MINC •  Careful with NIFTI! (32k limit)

•  FreeSurfer can read: •  DICOM, Siemens IMA, AFNI

Page 10: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

Page 11: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

AddYourData•  Addyourdatamanuallyas001.mgz,002.mgz OR

•  Addyourdataasinputdirectlytoyourrecon‐allcommand– recon‐all–i<input1>‐i<input2>‐s<subject>

bert

bem label morph mri scripts surf tiff label

orig 001.mgz 002.mgz

Page 12: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

‐autorecon1Volumetric Processing Stages (subjid/mri): 1. Motion Cor, Avg, Conform (orig.mgz) 2. Non-uniform inorm (nu.mgz) 3. Talairach transform computation (talairach/

talairach.xfm) 4. Intensity Normalization 1 (T1.mgz) 5. Skull Strip (brainmask.mgz)

6. EM Register (linear volumetric registration) 7. CA Intensity Normalization (norm.mgz) 8. CA Non-linear Volumetric Registration 9. CA Label (Volumetric Labeling) (aseg.mgz)

10. Intensity Normalization 2 (T1.mgz) 11. White matter segmentation (wm.mgz) 12. Edit WM With ASeg 13. Fill and cut (filled.mgz)

Surface Processing Stages (subjid/surf): 14. Tessellate (?h.orig.nofix) 15. Smooth1 16. Inflate1 17. QSphere (?h.qsqhere) 18. Automatic Topology Fixer (?h.orig) 19. Final Surfs (?h.white ?h.pial ?.thickness) 20. Smooth2 (?h.smoothwm) 21. Inflate2 (?h.inflated) 22. Aseg Statistics (stats/aseg.stats) 23. Cortical Ribbon Mask (?h.ribbon.mgz)

24. Spherical Morph 25. Spherical Registration (?h.sphere.reg) 26. Map average curvature to subject 27. Cortical Parcellation (Labeling) 28. Cortical Parcellation Statistics 29. Cortical Parcellation mapped to Aseg 30. White Matter Parcellation (wmparc.mgz)

Page 13: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

‐autorecon2Volumetric Processing Stages (subjid/mri): 1. Motion Cor, Avg, Conform (orig.mgz) 2. Non-uniform inorm (nu.mgz) 3. Talairach transform computation (talairach/

talairach.xfm) 4. Intensity Normalization 1 (T1.mgz) 5. Skull Strip (brainmask.mgz)

6. EM Register (linear volumetric registration) 7. CA Intensity Normalization (norm.mgz) 8. CA Non-linear Volumetric Registration 9. CA Label (Volumetric Labeling) (aseg.mgz)

10. Intensity Normalization 2 (T1.mgz) 11. White matter segmentation (wm.mgz) 12. Edit WM With ASeg 13. Fill and cut (filled.mgz)

Surface Processing Stages (subjid/surf): 14. Tessellate (?h.orig.nofix) 15. Smooth1 16. Inflate1 17. QSphere (?h.qsqhere) 18. Automatic Topology Fixer (?h.orig) 19. Final Surfs (?h.white ?h.pial ?.thickness) 20. Smooth2 (?h.smoothwm) 21. Inflate2 (?h.inflated) 22. Aseg Statistics (stats/aseg.stats) 23. Cortical Ribbon Mask (?h.ribbon.mgz)

24. Spherical Morph 25. Spherical Registration (?h.sphere.reg) 26. Map average curvature to subject 27. Cortical Parcellation (Labeling) 28. Cortical Parcellation Statistics 29. Cortical Parcellation mapped to Aseg 30. White Matter Parcellation (wmparc.mgz)

Page 14: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

‐autorecon3Volumetric Processing Stages (subjid/mri): 1. Motion Cor, Avg, Conform (orig.mgz) 2. Non-uniform inorm (nu.mgz) 3. Talairach transform computation (talairach/

talairach.xfm) 4. Intensity Normalization 1 (T1.mgz) 5. Skull Strip (brainmask.mgz)

6. EM Register (linear volumetric registration) 7. CA Intensity Normalization (norm.mgz) 8. CA Non-linear Volumetric Registration 9. CA Label (Volumetric Labeling) (aseg.mgz)

10. Intensity Normalization 2 (T1.mgz) 11. White matter segmentation (wm.mgz) 12. Edit WM With ASeg 13. Fill and cut (filled.mgz)

Surface Processing Stages (subjid/surf): 14. Tessellate (?h.orig.nofix) 15. Smooth1 16. Inflate1 17. QSphere (?h.qsqhere) 18. Automatic Topology Fixer (?h.orig) 19. Final Surfs (?h.white ?h.pial ?.thickness) 20. Smooth2 (?h.smoothwm) 21. Inflate2 (?h.inflated) 22. Aseg Statistics (stats/aseg.stats) 23. Cortical Ribbon Mask (?h.ribbon.mgz)

24. Spherical Morph 25. Spherical Registration (?h.sphere.reg) 26. Map average curvature to subject 27. Cortical Parcellation (Labeling) 28. Cortical Parcellation Statistics 29. Cortical Parcellation mapped to Aseg 30. White Matter Parcellation (wmparc.mgz)

Page 15: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

orig T1 brainmask wm aseg

Page 16: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Volumes

orig.mgz

• $SUBJECTS_DIR/bert/mri • All “Conformed” 256^3, 1mm

aseg.mgz

T1.mgz brainmask.mgz wm.mgz filled.mgz Subcortical Mass

aparc+aseg.mgz Volume Viewer: tkmedit

Page 17: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

lh.white lh.curv lh.thickness lh.pial

Page 18: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Surfaces

orig white pial

inflated sphere,sphere.reg flat •  $SUBJECTS_DIR/bert/surf • Number/Identity of vertices stays the same (except flat) • XYZ Location Changes • Flattening not done as part of standard reconstruction

Surface Viewer: tksurfer

Page 19: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

SurfaceOverlays

•  Value for each vertex •  Color indicates value •  Color: gray,red/green, heat, color table •  Rendered on any surface •  fMRI/Stat Maps too

lh.sulc on inflated lh.curv on inflated lh.thickness on inflated

lh.sulc on pial

lh.aparc.annot on inflated

lh.curv on inflated fMRI on flat

Page 20: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

lh.aparc.annot rh.aparc.annot

Page 21: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

aseg.stats lh.aparc.stats rh.aparc.stats

Page 22: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

ROISummaries:$SUBJECTS_DIR/subjid/stats

aseg.stats – volume summaries ?h.aparc.stats – desikan/killiany atlas summaries ?h.aparc.a2005s.stats – destrieux atlas summaries wmparc.stats – volume summaries

_______________________________________________ aseg:•  volumesofsubcor)calstructures(mm3)

aparc:•  thicknessofcor)calparcella)onstructures(mm)•  totalwhitema0ervolume(mm3)•  numberofver)cesincortex•  surfaceareaofcortex(mm2)

Page 23: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

AsegStatsFileIndex SegId NVoxels Volume_mm3 StructName Mean StdDev Min Max Range 1 2 255076 255076.0 Left-Cerebral-White-Matter 101.5872 7.9167 34.0000 148.0000 114.0000 2 3 266265 266265.0 Left-Cerebral-Cortex 75.3682 9.4016 28.0000 152.0000 124.0000 3 4 5855 5855.0 Left-Lateral-Ventricle 37.7920 10.9705 20.0000 88.0000 68.0000 4 5 245 245.0 Left-Inf-Lat-Vent 56.4091 9.5906 26.0000 79.0000 53.0000 5 7 16357 16357.0 Left-Cerebellum-White-Matter 91.2850 4.8989 49.0000 106.0000 57.0000 6 8 60367 60367.0 Left-Cerebellum-Cortex 76.3620 9.5724 26.0000 135.0000 109.0000 7 10 7460 7460.0 Left-Thalamus-Proper 91.3778 7.4668 43.0000 108.0000 65.0000 8 11 3133 3133.0 Left-Caudate 78.5801 8.2886 42.0000 107.0000 65.0000 9 12 5521 5521.0 Left-Putamen 86.9680 5.5752 66.0000 106.0000 40.0000 10 13 1816 1816.0 Left-Pallidum 97.7162 3.4302 79.0000 106.0000 27.0000 11 14 852 852.0 3rd-Ventricle 41.9007 11.8230 22.0000 69.0000 47.0000 12 15 1820 1820.0 4th-Ventricle 39.7053 10.6407 20.0000 76.0000 56.0000 13 16 25647 25647.0 Brain-Stem 85.2103 8.2819 38.0000 106.0000 68.0000 14 17 4467 4467.0 Left-Hippocampus 77.6346 7.5845 45.0000 107.0000 62.0000 15 18 1668 1668.0 Left-Amygdala 74.5104 5.8320 50.0000 94.0000 44.0000 16 24 1595 1595.0 CSF 52.1348 11.6113 29.0000 87.0000 58.0000

Index: nth Segmentation in stats file SegId: index into lookup table NVoxels: number of Voxels/Vertices in segmentation StructName: Name of structure from LUT Mean/StdDev/Min/Max/Range: intensity across ROI

Eg: aseg.stats, wmparc.stats created by mri_segstats

Page 24: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

GefngStatsintoTableFormat

• Organizestatsfilesfromagroupofsubjectsintoasingletextfile

asegstats2table\ Commandname‐‐subjects001002003\Listsubjectstoinclude‐‐measvolume\volormeanintensityofstruct‐‐tablefileasegstats.txt textoutputfile

asegstats.txtcreatedinSUBJECTS_DIR

Page 25: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Parcella)onStatsFile

StructName: Name of structure/ROI NumVert: number of vertices in ROI SurfArea: Surface area in mm2 GrayVol: volume of gray matter ThickAvg/ThickStd – average and stddev of thickness in ROI MeanCurv – mean Gaussian curvature GausCurv – Gaussian curvature FoldInd – folding index CurvInd – curvature index

Eg, lh.aparc.stats, lh.a2005s.aparc.stats created by mris_anatomical_stats

StructName NumVert SurfArea GrayVol ThickAvg ThickStd MeanCurv GausCurv FoldInd CurvInd unknown 10863 7151 13207 1.776 1.629 0.121 0.107 383 50.8 bankssts 1222 830 2290 2.711 0.559 0.112 0.027 10 1.3 caudalanteriorcingulate 830 585 1459 2.474 0.569 0.128 0.020 10 0.7 caudalmiddlefrontal 2509 1658 4979 2.653 0.567 0.125 0.035 27 3.5 corpuscallosum 2124 1340 569 0.489 0.631 0.151 0.110 87 8.0 cuneus 2737 1706 3086 1.741 0.509 0.162 0.065 52 8.0 entorhinal 495 330 1685 3.150 0.753 0.149 0.187 15 1.5 fusiform 3878 2638 7887 2.627 0.724 0.137 0.046 57 6.7

Page 26: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

GefngStatsintoTableFormat

aparcstats2table\ Commandname‐‐subjects001002003\Listsubjectstoinclude‐‐hemirh\ Whichhemisphere‐‐measvolume\volume,thickness,orarea‐‐tablefilerh.aparc.vol.txttextoutputfile

rh.aparc.vol.txtcreatedinSUBJECTS_DIR

Page 27: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

FreeSurferDirectoryTree

Subject ID

Each data set has its own unique SubjectId (eg, bert)

bert

bem stats morph mri scripts surf tiff label

recon-all.log recon-all-status.log

Page 28: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

ActualWorkflow:version1

1.  recon-all –all (Stages 1-29) ~30 hours 2.  Check talairach transform, skull strip, normalization 3.  Check surfaces

1.  Add control points: recon-all –autorecon2-cp –autorecon3 (Stages 10-29)

2.  Edit wm.mgz: recon-all –autorecon2-wm –autorecon3 (Stages 13-29)

3.  Edit brain.mgz: recon-all –autorecon2-pial (Stage 19-22) Note: all stages can be run individually

Page 29: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

ActualWorkflow:version2

1.  recon-all –autorecon1 (Stages 1-5) ~45 min 2.  Check talairach transform, skull strip, normalization 3.  recon-all –autorecon2 (Stages 6-22) ~20 hours 4.  Check surfaces

1.  Add control points: recon-all –autorecon2-cp (Stages 10-22) 2.  Edit wm.mgz: recon-all –autorecon2-wm (Stages 13-22) 3.  Edit brain.mgz: recon-all –autorecon2-pial (Stage 19-22)

5.  recon-all –autorecon3 (Stages 23-29) ~6 hours

Note: all stages can be run individually

Page 30: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Cor)calReconstruc)onGoals

•  GeometricallyAccuratesurfaces– Accuratelyfollowtheboundariesseenonthescanforeachofyourindividualsubjects

•  TopologicallyCorrectsurfaces– Eachsurfaceisa2‐Dcon)nuous,nonself‐intersec)ngsheetandcanbeinflatedintoaperfectsphere

•  Surfacesareonlyasgoodasyourscan.

Page 31: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

MRAnatomyCaveats•  Dependentondataquality

–  Contrasttonoise–  Signaltonoise–  Voxelresolu)on

•  MRAr)facts– MRsuscep)bility– MRdistor)ons

•  Varia)onsinMR)ssueparametersacrossregionsofthebrainarealteredindifferentpopula)ons

Page 32: Introducon to FreeSurfer - wikis.la.utexas.eduwikis.la.utexas.edu/imagelab/sites/wikis.la.utexas... · Introducon to FreeSurfer ... EM Register (linear volumetric registration) 7

Tutorialsh0p://dev.laits.utexas.edu/imagelab/index.php?n=Tutorials.FreeSurfer

•  FREESURFER_HOMEissetforyouwhenyoutypecsh•  TutorialinstructsyoutosetyourSUBJECTS_DIR

•  Tutorialwilltakeyouthroughoutputofonesubject,introducingyoutotheviewingtools,wherethingsareandhowtheyshouldbe.

•  Tomorrow–checkingandcorrec)ngerrors.