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

With VTK 6.3, streamlines color map bar text disappears when using streamtubes #1232

Closed
gauvinalexandre opened this Issue Apr 24, 2017 · 3 comments

Comments

Projects
3 participants
@gauvinalexandre
Copy link
Contributor

gauvinalexandre commented Apr 24, 2017

I have tested this with VTK 5.8 and the bugs does not happen, so it seems to be version specific. Here is the simple code snippet to reproduce de bug:

import numpy as np
from dipy.viz import window, actor
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from dipy.tracking.streamline import transform_streamlines

fetch_bundles_2_subjects()
dix = read_bundles_2_subjects(subj_id='subj_1', metrics=['fa'],
                              bundles=['cg.left', 'cst.right'])

affine = dix['affine']
bundle = dix['cg.left']
bundle_native = transform_streamlines(bundle, np.linalg.inv(affine))
fa = dix['fa']

renderer = window.Renderer()
renderer.set_camera(position=(-176.42, 118.52, 128.20),
                    focal_point=(113.30, 128.31, 76.56),
                    view_up=(0.18, 0.00, 0.98))

stream_actor = actor.line(bundle_native, fa, linewidth=0.1)
bar = actor.scalar_bar()

renderer.add(stream_actor)
renderer.add(bar)
window.record(renderer, out_path="streamlines.png", size=(600, 600))

renderer.clear()

stream_actor = actor.streamtube(bundle_native, fa, linewidth=0.1)
bar = actor.scalar_bar()

renderer.add(stream_actor)
renderer.add(bar)
window.record(renderer, out_path="streamtubes.png", size=(600, 600))

I'm running on dipy from the master branch updated at the moment of submitting this issue.

@gauvinalexandre gauvinalexandre changed the title In VTK 6.3, Streamlines color map bar text disappears when using streamtubes In VTK 6.3, streamlines color map bar text disappears when using streamtubes Apr 24, 2017

@gauvinalexandre gauvinalexandre changed the title In VTK 6.3, streamlines color map bar text disappears when using streamtubes With VTK 6.3, streamlines color map bar text disappears when using streamtubes Apr 24, 2017

@MarcCote

This comment has been minimized.

Copy link
Contributor

MarcCote commented Apr 25, 2017

It seems that enabling the Backface Culling for the streamtubes is causing the problem.
See actor.GetProperty().BackfaceCullingOn() in https://github.com/nipy/dipy/blob/master/dipy/viz/actor.py#L343

I'm no expert in rendering, is the backface culling needed, what does it do exactly?

@gauvinalexandre

This comment has been minimized.

Copy link
Contributor

gauvinalexandre commented Apr 25, 2017

Wow! How did you guess that!? Thanks for the hint. How can colorbar labels be affected by backface culling?

Backface culling accelerates the rendering process by omitting the back faces... AND THE COLORBAR LABELS apparently. :P.
I just did a quick test: 725ms (BFC) vs. (730) (Without). Pretty consistently faster he!?

I'm not sure if it's a VTK bug or we are not doing things in the right way.

@skoudoro

This comment has been minimized.

Copy link
Member

skoudoro commented Sep 20, 2018

This issue was moved to fury-gl/fury#9

@skoudoro skoudoro closed this Sep 20, 2018

@skoudoro skoudoro moved this from Issues to Done in Viz Module Oct 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment