Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove specific regions from aseg_3d #18

Open
guilhermepovala opened this issue Jun 2, 2023 · 2 comments
Open

How to remove specific regions from aseg_3d #18

guilhermepovala opened this issue Jun 2, 2023 · 2 comments

Comments

@guilhermepovala
Copy link

Hello,

I'm using ggseg3d but I would like to remove from the 3D plot some specific regions, like Cerebellum, Brain-Stem, Ventricle...
How can I do that? I don't want to color these regions differently, but remove them completely from the plot.

@drmowinckels
Copy link
Contributor

Hi!

Sure!

I actually though I had made an entry on this in the vignettes, so I'll make sure to add one in the next realease.

library(ggseg3d)
library(dplyr)
library(tidyr)

# vector of labels
labs <- c("Left-Lateral-Ventricle",
          "Left-Inf-Lat-Vent",
          "Left-Cerebellum-Cortex",
          "Left-Pallidum ")

aseg_filt <- aseg_3d |> 
  unnest(ggseg_3d) |> 
  filter(
    # Of you 'dont want the ones in the vector
    !label %in% labs
  ) |> 
  as_ggseg3d_atlas()

ggseg3d(atlas = aseg_filt)

image

aseg_filt_rev <- aseg_3d |> 
  unnest(ggseg_3d) |> 
  filter(
    # Of you 'dont want the ones in the vector
    label %in% labs
  ) |> 
  as_ggseg3d_atlas()

ggseg3d(atlas = aseg_filt_rev)

image

@mayunxiao11
Copy link

How to color these regions differently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants