ggseg / ggsegExtra

Repository for extra atlases for the ggseg-package
https://ggseg.github.io/ggsegExtra/
Other
52 stars 18 forks source link

make_ggseg3d_2_ggseg :GL_INVALID_OPERATION : glBufferData: #30

Closed WillForan closed 2 years ago

WillForan commented 3 years ago

We're trying to get a 2d atlas for 100Parcels_7Networks in Schaefer2018. But I get GL_INVALID_OPERATION errors on all the linux machines I've tried.

Have I missed a critical step? Or maybe there's a opengl dependency or driver issue?

Thanks!!

Full script is mkggseg_Y100N7.R

Y100N7_2datlas <- make_ggseg3d_2_ggseg(output_dir="2d_orca",
                                       ggseg3d_atlas=Y100N7_segs,
                                       ncores=1)

● 1/7 Snapshotting views of entire atlas to 2d_orca/Yeo100N7 [184671:0104/101130.485758:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command ✔ Snapshots complete ● 2/7 Snapshotting individual regions to 2d_orca/Yeo100N7/img [185471:0104/101221.492563:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command [186456:0104/101321.881990:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command [186947:0104/101352.025082:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command ...

Y100N7_2datlas
 # Yeo100N7 cortical brain atlas
  regions: 0 
  hemispheres: left, right 
  side views: lateral, medial 
  palette: yes 
  use: ggplot() + geom_brain() 
 ----
 # … with 5 variables: hemi <chr>, side <chr>, region <chr>, label <chr>,
 #   roi <chr>

I think the 3d altas was created successfully: image

is_ggseg3d_atlas(Y100N7_segs) # TRUE

Y100N7_segs
 # A tibble: 6 x 4
   atlas       surf     hemi  ggseg_3d         
   <chr>       <chr>    <chr> <list>           
 1 Yeo100N7_3d inflated left  <tibble [51 × 7]>
 2 Yeo100N7_3d inflated right <tibble [51 × 7]>

Y100N7_segs$ggseg_3d[[1]]$annot %>% head
[1] "Background+FreeSurfer_Defined_Medial_Wall"
[2] "7Networks_LH_Vis_1"                       
[3] "7Networks_LH_Vis_2"                       
[4] "7Networks_LH_Vis_3"                       
[5] "7Networks_LH_Vis_4"                       
[6] "7Networks_LH_Vis_5" 

p <- ggseg3d::ggseg3d(d %>% filter(grepl('RH_',region)),
                       atlas=mesh_dt, color="T_Value",
                       hemisphere=c("right"))
htmlwidgets::saveWidget(p, selfcontained=T, file=file.path(getwd(),"/example/index.html"))
drmowinckels commented 3 years ago

To me, this looks like there is some issue with Orca. It's failing at the stages where Orca is called to snapshot the 3d brain.

Have you successfully installed Orca?

https://github.com/plotly/orca#installation

WillForan commented 3 years ago

That it! Thanks! Looks like this is an open ocra issue https://github.com/plotly/orca/issues/127 orca graph '{ "data": [{"y": [1,2,1]}] }' -o /tmp/test_orca.png shows the same error.

I put orca 1.1.1's appimage first in the path, and I no longer see any explicit errors! But the 2d atlas has NA for all the regions. Is this still an orca issue?

 Y100N7_2datlas <- make_ggseg3d_2_ggseg(output_dir="2d_orca",
                                       ggseg3d_atlas=Y100N7_segs,
                                       ncores=1)

● 1/7 Snapshotting views of entire atlas to 2d_orca/Yeo100N7
✔ Snapshots complete                     %
● 2/7 Snapshotting individual regions to 2d_orca/Yeo100N7/img    %
✔ Region snapshots complete        %
● 3/7 Isolating regions to 2d_orca/Yeo100N7/masks %
● & writing masks to 2d_orca/Yeo100N7/regions   %
✔ isolation complete  %
● 4/7 Extracting contours from regions   %
  |==================================================| 100%, Elapsed 00:48 %
✔ contours complete
● 5/7 Smoothing contours  %
✔ Smoothing complete     %
● 6/7 Reducing vertexes   %
✔ Vertexes reduced
● 7/7 Making data frame
● Atlas is complete with 203990 vertices, try re-running steps 6:7 with a higher 'tolerance' number.

# Yeo100N7 cortical brain atlas
  regions: 0 
  hemispheres: left, right 
  side views: lateral, medial 
  palette: yes 
  use: ggplot() + geom_brain() 
----
# … with 5 variables: hemi <chr>, side <chr>, region <chr>, label <chr>,
#   roi <chr>

 Y100N7_2datlas$data
Simple feature collection with 119 features and 5 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 0 ymin: 0 xmax: 1391.491 ymax: 205.6408
CRS:            NA
# A tibble: 119 x 6
   hemi  side   region label roi                                        geometry
 * <chr> <chr>  <chr>  <chr> <chr>                                <MULTIPOLYGON>
 1 left  later… NA     NA    0001  (((79.64439 38.07477, 79.59772 38.02271, 79.…
 2 left  later… NA     NA    0003  (((266.9941 48.09276, 266.9425 48.07395, 266…
 3 left  later… NA     NA    0005  (((288.2415 95.83296, 288.2062 95.82157, 288…
 4 left  later… NA     NA    0008  (((269.4712 110.7737, 269.4209 110.7577, 269…
 5 left  later… NA     NA    0009  (((262.6399 138.7354, 262.6184 138.7092, 262…
 6 left  later… NA     NA    0011  (((177.4792 113.6642, 177.4118 113.6466, 177…
 7 left  later… NA     NA    0012  (((162.7484 108.9667, 162.6644 108.9519, 162…
 8 left  later… NA     NA    0013  (((143.4708 130.1558, 143.4036 130.1258, 143…
 9 left  later… NA     NA    0014  (((143.6357 170.6134, 143.5566 170.6245, 143…
10 left  later… NA     NA    0015  (((142.9635 197.7712, 142.8841 197.7331, 142…
# … with 109 more rows
drmowinckels commented 3 years ago

great. That's one problem solved.

I'm a little baffled as to why the regions should end up with NA, with they are correct in the corresponding 3d atlas. The region names are ok in the 3d, but end with with NA in the 2d?

WillForan commented 3 years ago

Thanks for the feedback!

I think my environment is still incomplete/unstable. I'll update if I can figure out what's going on.

I changed the output directory and I'm stuck on snapshotting eternally.

make_ggseg3d_2_ggseg(output_dir="2d_orca_retry20210114", ggseg3d_atlas=Y100N7_3d, ncores=1)

1/7 Snapshotting views of entire atlas to 2d_orca_retry20210114/Yeo100N7

At least it looks like R is able to call orca. But all the processes are "sleeping"

pstree -Tp 29950
R(29950)───node(30286)───electron(30294)─┬─chrome-sandbox(30296)───electron(30297)───+
                                         ├─electron(30330)
                                         └─electron(30337)

pstree -p 29950|grep -Po '\d+'|sed 's:.*:/proc/&/status:'|xargs grep -hE Name\|State|paste - -
Name:   R       State:  S (sleeping)
Name:   node    State:  S (sleeping)
Name:   electron        State:  S (sleeping)
Name:   chrome-sandbox  State:  S (sleeping)
Name:   electron        State:  S (sleeping)
Name:   electron        State:  S (sleeping)
Name:   llvmpipe-0      State:  S (sleeping)
....
drmowinckels commented 3 years ago

as a test, try setting ncores = 1. There might be a parallellization issue

drmowinckels commented 3 years ago

Hi!

We have released a bunch of Schaefer atlases recently. You might find all you need there if you are still struggling. https://github.com/ggseg/ggsegSchaefer