fury-gl / fury

FURY - Free Unified Rendering in pYthon.
https://fury.gl
Other
226 stars 165 forks source link

In need of per-streamline linewidth #860

Open VincentBeaud opened 5 months ago

VincentBeaud commented 5 months ago

Is your feature request related to a problem? Please describe. I need to visualize tractography streamlines that have different widths (representing axonal diameters), but I can only provide the actor.streamtube function with a single linewidth.

Describe the solution you'd like I'd like for actor functions that accept a linewidth argument (Ex: actor.streamtube, actor.line) to also accept an arraylike version for per-streamline width.

Describe alternatives you've considered

I have tried looping through each streamline and adding them separately to the scene, with no success.


s = window.Scene()
    for i, line in enumerate(tractogram.streamlines[:5]):
        line_actor = actor.streamtube(line, colors=[1., 0., 0.], opacity=0.5, linewidth=diameters[i])
        s.add(line_actor)

When using this alternative:

  • actor.line gets me a memory error:
    malloc(): invalid size (unsorted)
    Abandon (core dumped)
  • actor.streamtube gets me an empty scene, no matter what other actor I add to the scene. It kills the thing 😅

Edit: This solution actually works by changing it to ... actor.streamtube([line], .... The errors were simply related to that. It's a suboptimal solution, but my problem is fixed for now. I'll keep the issue open as the feature still seems relevant and rather quick to add.

Additional context An example of what I'm trying to achieve, but with variable streamline widths:

image