natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
64 stars 29 forks source link

plotly wire3d() no longer working after upgrading from nat 1.8.22 to 1.10.4 #513

Closed Jsalas424 closed 1 year ago

Jsalas424 commented 1 year ago

I recently started a new R project and as usual updated my packages beforehand. I've no found that I can no longer perform a routine in 1.10.4 that I am perfectly able to do in 1.8.22.

Here's what that looks like:

options(nat.plotengine = 'plotly')
wire3d(mesh$getMesh(),
       add = FALSE) |>
  add_trace(
    name = "Original Faces",
    type = "mesh3d",
    data = mesh_faces,
    x = mesh_vertices$surf_x, y = mesh_vertices$surf_y, z = mesh_vertices$surf_z,
    i = ~v1-1, j = ~v2-1, k = ~v3-1,
    flatshading = TRUE, # we don't want smoothing
    showlegend=T
  )

which produces the following photo when I'm in a version controlled project running v1.8.22:

image

When the same data is run in v1.10.4 I get the following: Error: Don't know how to add traces to an object of class: rglLowlevelrglIdnumeric

I realized that if I just the following code I can get my mesh in v.1.8 but get nothing at all in v1.10. So here is the problem:

options(nat.plotengine = 'plotly')
wire3d(mesh$getMesh(),
       add = FALSE) 
image

The mesh$getMesh() is from cgalMeshes which contructs an R6 object that hold all the mesh data for some context. Here is the dput output ofmesh$get_mesh() which is just vertices and indices as expected: https://pastebin.com/YFcwqmzU

God bless version control!

"R version 4.3.1 (2023-06-16) Beagle Scouts" "RStudio Version 2023.6.1.524 Mountain Hydrangea"

Jsalas424 commented 1 year ago

I read the version outputs backwards, once I got everything up to 1.10.4 with natmanager::install(pkgs = 'nat') I was back in business. All I showed here is that 1.8.22 isn't compatible with my setup.

jefferis commented 1 year ago

Glad that it worked out. Thanks for your interest in nat.