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

Dipy visualization: it does not seem possible to position tensor ellipsoid slice in fvtk #644

Closed
mick-d opened this Issue May 12, 2015 · 1 comment

Comments

Projects
2 participants
@mick-d

mick-d commented May 12, 2015

I am trying to display tensor information with fvtk.tensor and add other information such as streamlines or FA slices but they do not align. It seems like fvtk.tensor does not have a parameter to set the 3D position of a slice.

For example I do not see any option to change the z-position of the axial slice below in the visualization. Plotting another axial slice (iAxial = 25) will simply be overlaid over the previous one (iAxial = 20).

iAxial = 20
fvtk.add(r, fvtk.tensor(tenfit.evals[:,:,iAxial:iAxial+1], tenfit.evecs[:,:,iAxial:iAxial+1], RGB_scaled[:,:,iAxial:iAxial+1], sphere))
iAxial = 25
fvtk.add(r, fvtk.tensor(tenfit.evals[:,:,iAxial:iAxial+1], tenfit.evecs[:,:,iAxial:iAxial+1], RGB_scaled[:,:,iAxial:iAxial+1], sphere))
fvtk.show(r)

@mick-d mick-d changed the title from Dipy visualization: is it possible to position tensor ellipsoid slice in fvtk? to Dipy visualization: it does not seem possible to position tensor ellipsoid slice in fvtk May 12, 2015

@dmreagan dmreagan added this to Issues in Viz Module Dec 1, 2017

@skoudoro

This comment has been minimized.

Member

skoudoro commented Apr 20, 2018

Hi @mick-d, I know this is a quite old issue :-) but currently, You can easily set your slice with tensor_slicer.display_extent. I close this issue but feel free to reopen it if needed. you have an example on this test or below:

from dipy.viz import actor, window
from dipy.data import get_sphere
import numpy as np

# setup the data
evals = np.array([1.4, .35, .35]) * 10 ** (-3)
evecs = np.eye(3)
mevals = np.zeros((3, 2, 4, 3))
mevecs = np.zeros((3, 2, 4, 3, 3))
mevals[..., :] = evals
mevecs[..., :, :] = evecs
sphere = get_sphere('symmetric724')
affine = np.eye(4)
    
renderer = window.Renderer()
tensor_actor = actor.tensor_slicer(mevals, mevecs, affine=affine, sphere=sphere,  scale=.3)
I, J, K = mevals.shape[:3]
renderer.add(tensor_actor)
renderer.reset_camera()
renderer.reset_clipping_range()

tensor_actor.display_extent(0, 1, 0, J, 0, K)
window.show(renderer, reset_camera=False)

@skoudoro skoudoro closed this Apr 20, 2018

@skoudoro skoudoro moved this from Issues to Done in Viz Module Apr 20, 2018

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