class: middle, right, title-slide .title[ # Visualizing brain data ] .subtitle[ ## - Improving speed and flexibility of the ggseg-suite - ] .author[ ### Athanasia Monika Mowinckel ] .date[ ### 24.08.2023 ] --- layout: true <div class="my-sidebar"></div> --- background-image: url(https://fsl.fmrib.ox.ac.uk/fsl/wiki_static/fsl/img/fsl-logo-x2.png), url(https://freesurfer2016.sciencesconf.org/conference/freesurfer2016/pages/FSlogo.png), url(https://nipype.readthedocs.io/en/latest/_static/nipype-banner-bg.png), url(https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/98b0f6cf-f7e6-4051-b4f4-2aacf06f551b/a5cdc6ec-7ee3-4aaa-afbd-f283c68dd149/images/screenshot.png) background-size: 20%, 40%, 50%, 20% background-position: 20% 45%, 70% 45%, 85% 90%, 20% 95% ## MRI analyses are usually run in specialized software ??? - run in specialized software - but results and dissemination is usually run in stats software - switching between different software creates workflows that are hard to reproduce and keep track of --- background-image: url(https://visceralmind.files.wordpress.com/2017/04/voxel-brain.jpg?w=1024) background-size: contain ??? - the images are 3d matrices of 1mm cubic voxels, usually around 100 thousand voxels per brain - MRI analyses run large numbers of comparisons just within a single subjects' brain, and issues with multiple comparisons need to be dealt with --- background-image: url(https://www.researchgate.net/profile/Arno_Klein2/publication/233889622/figure/fig2/AS:271987822034957@1441858358467/Regions-in-the-DKT-cortical-labeling-protocol-Cortical-regions-of-interest-included-in.png) background-size: contain ??? - To reduce this problem, the brain is often reduced to a smaller set of functionally or structurally meaningful parcellations - here: the DK cortical atlas on an inflated brain (blown up like a balloon) to see also inside the grooves - measurements are extracted from these regions for metrics like coritcal thickness, surface area, gyrification index etc. and used in statistical models --- class: center, dark background-image: url(img/ggseg.png), url(img/ggseg3d.png), url(img/ggsegExtra.png) background-size: 15% background-position: 41% 43%, 59% 43%, 50% 77% # ggseg-suite .pull-left[ 2d polygons <br> geospatial ] -- .pull-left[ 3d mesh <br> tri-surface ] -- <br><br><br><br><br><br><br><br><br> <br><br> atlas creation / installation --- class: middle, center, dark background-image: url(img/ggseg.png) background-size: 18% background-position: 50% 10% # ## Plotting 2d representations as polygons --- class: middle .pull-left[ ```r library(ggplot2, quietly = TRUE) library(ggseg, quietly = TRUE) plot(dk, show.legend = FALSE) ``` ] .pull-right[ ``` ## Warning: package 'ggseg' was built under R version 4.3.1 ``` <img src="index_files/figure-html/unnamed-chunk-1-1.png" width="100%" /> ] --- ## ggseg - 2d polygons .pull-left[ ```r ggplot() + geom_brain( atlas = dk, position = position_brain(side ~ hemi), show.legend = FALSE ) ``` ] .pull-right[ <img src="index_files/figure-html/unnamed-chunk-2-1.png" width="100%" /> ] --- class: middle, center, dark background-image: url(img/ggseg3d.png) background-size: 18% background-position: 50% 10% ## Plotting 3d triangular meshes --- class: middle .pull-left[ ## Powered by plotly ### Fully interactive ```r library(ggseg3d) ggseg3d(atlas = dk_3d) ``` ] .pull-right[
] --- .pull-left[ ### Problem current solution creates one mesh object _per_ atlas segment - DK: 90 mesh objects x 3 surfaces - Glasser: 395 mesh objects x 3 surfaces Creates slow plotting and large packages. ] .pull-right[ ### Solution New system colours the vertices directly - reduced size through only storing vertex index and colour - ggseg3d alone needs to store the mesh objects for all other atlases to use ] --- .pull-left[ ```r dk dk_3d ``` ] .pull-right[ - current format needs to data objects for an atlas: - 3d-version - 2d version problem: - hard for users to remember and understand solution: - new system can deal with both data in a single object ] --- class: middle, center, dark background-image: url(img/ggsegExtra.png) background-size: 18% background-position: 50% 10% ## Creating and installing atlases --- ## Atlases <img src="https://github.com/ggseg/ggsegYeo2011/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegYeo2011 logo" width="100"/> <img src="https://github.com/ggseg/ggsegICBM/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegICBM logo" width="100"/> <img src="https://github.com/ggseg/ggsegSchaefer/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegSchaefer logo" width="100"/> <img src="https://github.com/ggseg/ggsegChen/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegChen logo" width="100"/> <img src="https://github.com/ggseg/ggsegHO/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegHO logo" width="100"/> <img src="https://github.com/ggseg/ggsegKleist/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegKleist logo" width="100"/> <img src="https://github.com/ggseg/ggsegArslan/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegArslan logo" width="100"/> <img src="https://github.com/ggseg/ggsegFlechsig/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegFlechsig logo" width="100"/> <img src="https://github.com/ggseg/ggsegEconomo/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegEconomo logo" width="100"/> <img src="https://github.com/ggseg/ggsegGlasser/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegGlasser logo" width="100"/> <img src="https://github.com/ggseg/ggsegAal/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegAal logo" width="100"/> <img src="https://github.com/ggseg/ggsegGordon/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegGordon logo" width="100"/> <img src="https://github.com/ggseg/ggsegAicha/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegAicha logo" width="100"/> <img src="https://github.com/ggseg/ggsegCampbell/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegCampbell logo" width="100"/> <img src="https://github.com/ggseg/ggsegIca/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegIca logo" width="100"/> <img src="https://github.com/ggseg/ggsegPower/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegPower logo" width="100"/> <img src="https://github.com/ggseg/ggsegBrodmann/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegBrodmann logo" width="100"/> <img src="https://github.com/ggseg/ggsegBrainnetome/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegBrainnetome logo" width="100"/> <img src="https://github.com/ggseg/ggsegDesterieux/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegDesterieux logo" width="100"/> <img src="https://github.com/ggseg/ggsegJHU/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegJHU logo" width="100"/> <img src="https://github.com/ggseg/ggsegDefaultExtra/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegDefaultExtra logo" width="100"/> <img src="https://github.com/ggseg/ggsegDKT/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegDKT logo" width="100"/> <img src="https://github.com/ggseg/ggsegTracula/raw/HEAD/man/figures/logo.png" align="right" alt="ggsegTracula logo" width="100"/> --- # Making cortical atlases .pull-left[ ## Old way ```r # Make brain atlases into # 3d plotly mesh atlas dt3d <- make_aparc_2_3datlas( annot = "aparc.a2009s" ) # Turn plotly mesh atlas # into 2d polygon atlas dt2d <- make_ggseg3d_2_ggseg(dt3d) ``` ] .pull-right[ ## New way ```r dt <- make_ggseg_aparc( annot = "aparc.a2009s" ) ``` ] ??? Here is an example of the HCP Glasser atlas --- # Creating new subcortical atlases ## Still needs old system .pull-left[ ```r # Make brain atlas image into # 3d plotly mesh atlas make_volumetric_2_3datlas() # Make brain atlas image into # into 2d polygon atlas make_volumetric_ggseg() ``` ] .pull-right[ <img src="aseg_new.png" width="100%" /> ] ??? Here is an example of a pipeline to make the aseg subcortical atlas with the functions. This was made entirely through R, but with function calls from within R to FreeSurfer and ImageMagick. --- class: center, dark, bottom # New vectorised solution coming this fall -- faster -- more unified -- easier to make new atlases