haesleinhuepf / napari-process-points-and-surfaces

Process and analyze surfaces using vedo in napari.
BSD 3-Clause "New" or "Revised" License
21 stars 4 forks source link

Issues with 4D meshes #84

Open kephale opened 1 year ago

kephale commented 1 year ago

Hey Friends!

I ran into an issue using nppas on a 4D mesh (json export of layer.data = https://gist.github.com/kephale/2357e3b9567f3bdedcc43c906a6de245).

The error is:

  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/psygnal/_signal.py", line 950, in _run_emit_loop
    caller.cb(args)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/psygnal/_weak_callback.py", line 265, in cb
    self._f(*self._args, *args, **self._kwargs)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/magicgui/widgets/_function_gui.py", line 218, in _disable_button_and_call
    self.__call__()
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/magicgui/widgets/_function_gui.py", line 331, in __call__
    value = self._function(*bound.args, **bound.kwargs)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/napari_process_points_and_surfaces/_quantification.py", line 134, in _surface_quality_table
    return surface_quality_table(surface, qualities, napari_viewer)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/napari_process_points_and_surfaces/_quantification.py", line 155, in surface_quality_table
    result = add_quality(surface, quality)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/napari_process_points_and_surfaces/_quantification.py", line 90, in add_quality
    mesh = vedo.mesh.Mesh((surface[0], surface[1]))
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/vedo/mesh.py", line 149, in __init__
    self._data = buildPolyData(inputobj[0], inputobj[1])
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/vedo/utils.py", line 585, in buildPolyData
    vertices = make3d(vertices)
  File "/Users/kharrington/mambaforge/envs/nesoi/lib/python3.10/site-packages/vedo/utils.py", line 512, in make3d
    raise ValueError("input shape is not supported.")
ValueError: input shape is not supported.

Since napari supports surfaces that are >3D it seems like a call like this should either throw a warning about the dimension of the input and either fail or show the results for the currently selected timestep.

haesleinhuepf commented 1 year ago

Thanks for pointing this out @kephale ! We're aware of this and actually have a partial solution in napari-stress. See this issue: