[vtkusers] Blended image display

David Gobbi dgobbi at irus.rri.ca
Thu Jun 21 12:29:02 EDT 2001


On Thu, 21 Jun 2001, Matthieu Ferrant wrote:

> In 3D, everything is fine with a pipeline like the one you propose.

I use 3D rendering to display 2D images all the time.  On many computer
systes 3D OpenGL rendering is actually much faster than 2D OpenGL
rendering (thanks to the PC video-game market).

> However, in 2D, using a similar pipeline, you have to either use a
> vtkPolyDataMapper2D for the planeSource, but then the vtkActor2D and the
> vtkImageActor don't take textures, or the vtkImageMapper which
> apparently doesn't allow you to display more than one image (as I
> mentioned in the previous e-mail), unless you first blend them into a
> single one with vtkImageBlend. One of the issues with vtkImageBlend is
> that I couldn't blend a gray-scale image with a color one.

It works fine.  You just have to
1) make sure the color input comes first (i.e. use as input 0)
2) make sure that the images have the same scalar type, use
   vtkImageCast to change the type of the greyscale image if
   necessary

You can also pass the greyscale image through vtkImageMapToColors,
this is nice because you can set up an alpha ramp instead of just
using a constant opacity value.

Also, the blending operation should come after the vtkImageReslice
operation to get the highest efficiency.  That means you will
need a separate vtkImageReslice filter for each image (unless one
or both of the images is just a 2D image)

 - David


> David Gobbi wrote:
> >
> > Using vtkTexture, vtkPlaneSource, vtkTextureMapToPlane, vtkDataSetMapper &
> > vtkActor inside a vtkRenderer will allow interactive blending by changing
> > the actor opacities.  This will probably also work with vtkImageActor, which
> > would be a lot easier.
> >
> >  - David
> >
> > On Thu, 21 Jun 2001, Matthieu Ferrant wrote:
> >
> > > Hi,
> > >
> > > I would like to know if it is possible to blend and visualize two images
> > > within a single vtkImager. I have tried to create two 2D actors for both
> > > images, setting their respective opacities to 0.5, but I can only see
> > > the last image I add to the vtkImager. I also tried playing with
> > > SetDisplayLocationToBackground but that wouldn't change anything. I did
> > > experiment with the vtkImageBlend filter, but I'd like something more
> > > interactive (i.e. be able to slide from one image to another with
> > > varying opacity).
> > >
> > > What would be the best way to do this ?
> > >
> > > thanks,
> > >
> > > matt
> > >
> > >
> > > --
> > > M.Ferrant, Ph.D.
> > > UCL/TELE Room A-157 Place du Levant, 2 B-1348LLN - Belgium
> > > Tel. +32-10-478073 Fax. : +32-10-472089
> > > http://www.tele.ucl.ac.be/MEMBERS/Ferrant_Matthieu_e.html
> > >
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> > > Follow this link to subscribe/unsubscribe:
> > > http://public.kitware.com/mailman/listinfo/vtkusers
> > >
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
>
> --
> M.Ferrant, Ph.D.
> UCL/TELE Room A-157 Place du Levant, 2 B-1348LLN - Belgium
> Tel. +32-10-478073 Fax. : +32-10-472089
> http://www.tele.ucl.ac.be/MEMBERS/Ferrant_Matthieu_e.html
>





More information about the vtkusers mailing list