Intro Thoughts

Status Quo

library(tidyverse)
knitr::opts_chunk$set(error = T)

Experiment

library(tidyverse)
library(ggbrat)
library(ggplot2)
library(ggregions)


yeo <- load_atlas("Yeo2011_7Networks_N1000")

net_names <- data.frame(names = c('Vis', 'SomMot', 'DorsAttn','SalVentAttn','Limbic', 'Cont', 'Default'),
                    region = c("7Networks_1", "7Networks_2", "7Networks_3", "7Networks_4", "7Networks_5",
                               "7Networks_6", "FreeSurfer_Defined_Medial_Wall" ))


yeo$atlas |> #<<
  left_join(net_names) 
## Joining with `by = join_by(region)`
## Error in `as_tibble()`:
## ! All columns in a tibble must be vectors.
## ✖ Column `geometry` is a `sfc_GEOMETRY/sfc` object.
'yeo$atlas |> #<<
  mutate(row = row_number()) |>
  left_join(net_names) |> 
  ggplot() +
  geom_sf(layout = "fixed") + #<<
  facet_wrap(~names) + #<<
  geom_sf(fill = "red") + #<<
  theme_void()' |> 
  ggram::ggram(code = _, title = "Exploring the Yeo brain atlas via ggbrat", 
               subtitle = "Use `layout = 'fixed'` for reference/'ghost' layer")
## Joining with `by = join_by(region)`
## Error in `as_tibble()`:
## ! All columns in a tibble must be vectors.
## ✖ Column `geometry` is a `sfc_GEOMETRY/sfc` object.
yeo$atlas |> #<<
  left_join(net_names) |>
  select(names, geometry) |> 
  set_regions()
## Joining with `by = join_by(region)`
## Error in `as_tibble()`:
## ! All columns in a tibble must be vectors.
## ✖ Column `geometry` is a `sfc_GEOMETRY/sfc` object.
tribble(~region,
        "Vis") |>
  ggplot() + 
  aes(region = region) + 
  stamp_region() + 
  geom_region(fill = "violet")
## Warning in layer_sf(geom = GeomSfDarker, data = ref_data, mapping = mapping, :
## Ignoring unknown parameters: `aes_name`
## Coordinate system already present.
## ℹ Adding new coordinate system, which will replace the existing one.

library(ggbrat)
lobes <- load_atlas("lobes")
 
lobes$atlas |> 
  mutate(region = region |> 
           str_remove("LOBE.") |> 
           str_to_sentence() |> 
           str_replace("\\.", " ")) |> 
  select(region, geometry) |>
  set_regions()
  
library(ggbrat)
lobes <- load_atlas("lobes")

lobes$atlas |> 
  mutate(region = region |> 
           str_remove("LOBE.") |> 
           str_to_sentence()) |> 
  select(region, geometry) ->
lobes_ref

  
'
library(ggregions)
set_regions(lobes_ref)

tribble(~region,
        "Temporal",
        "Limbic",
        "Occipital")  |> 
  ggplot() +
  stamp_region() + 
  aes(region = region, 
       fill = region) + 
  geom_region()' |> 
  ggram::ggram(code = _, widths = c(2,1))
## Warning in layer_sf(geom = GeomSfDarker, data = ref_data, mapping = mapping, :
## Ignoring unknown parameters: `aes_name`
## Coordinate system already present.
## ℹ Adding new coordinate system, which will replace the existing one.
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_hline()`).

Closing remarks, Other Relevant Work, Caveats