Display both 3D polydata and 2D "projected" images preserving the geometrical relations

(Suguru Dobashi) #1

Hello everyone,

I have one 3D poly-data and several related 2D images obtained by some projection from certain angles, like X-ray images.
(2D images are not constructed directly from the 3D poly-data but provided from the outside.)
I want to display both 3D and 2D images in the same render window interactively preserving the geometrical relations:
I attached an image to illustrate the desired situation.

Specifically, if a 2D image is to be obtained by some projection operation from the direction
v = [sin(t)cos(u), sin(t) sin(u), sin(t)],
the 2D image should be placed so that its normal vector is parallel to v.
Also, in the interaction, both 3D and 2D are expected to move consistently.

I could display both 3D poly data and the projected 2D image
if the projection direction is X-, Y-, or Z- direction by using vtkPolyDataMapper and vtkDataSetMapper.
However, I want to place several 2D projected images
with each normal vector being any given projection directions.

Is there a way to realize such a display style in VTK?

I appreciate any suggestion.
Thanks in advance.

(Andras Lasso) #2

These all look very doable using VTK. Read the VTK textbook and check out VTK examples to see exactly how you can set this up.

(Marco Musy) #3

…i have a very similar example in vtkplotter if your happy to work with python:

from vtkplotter import *

vp = Plotter(axes=3, bg='white')

for i in range(18):
    a = vp.load(datadir+"images/dog.jpg")
    a.crop(bottom=0.2).alpha(0.5).rotateX(20*i) # crop 20%


(Suguru Dobashi) #4

Thank you very much for your response.

I found the method vtkImageData::SetDirectionMatrix in the GitHub version (maybe not yet implemented in VTK 8.2).
This method was the key to achieve my aim.

(Suguru Dobashi) #5

Thank you very much for your help.

This is exactly what I wanted to, though I’m now developing in C++.

The vtkplotter seems very useful for prototyping and to provide working examples.

Many thanks!

1 Like