[vtkusers] vtkImagePlaneWidget Transparency/Windowing Problems
Miroslav Drahos
mdrahos at thinksurgical.com
Mon Apr 27 14:46:15 EDT 2015
Hi David,
glad it worked for you. To control the opacity of individual voxels, you could use vtkImageMapToColors to map the scalars through a lookup table and the output be RGBA, where A is alpha (opacity).
HTH,
Miro
________________________________________
From: David Kushner [root at davidkushner.me]
Sent: Saturday, April 25, 2015 12:18 AM
To: Miroslav Drahos
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] vtkImagePlaneWidget Transparency/Windowing Problems
Brilliant, thanks Miro. Your suggestion worked well. I was hoping to be able to map 0-values (pure black) to total transparency while applying the 0.5 opacity to the remaining image. Is there a way to accomplish this specifically? This is just icing on the cake, I quite like the result I get with your suggestion but the background is still occluding some details of the planes behind.
Thanks again!
On Fri, Apr 24, 2015 at 3:02 PM, Miroslav Drahos <mdrahos at thinksurgical.com<mailto:mdrahos at thinksurgical.com>> wrote:
Try
planeWidget->GetTexturePlaneProperty()->SetOpacity(0.5);
Best,
Miro
________________________________________
From: vtkusers [vtkusers-bounces at vtk.org<mailto:vtkusers-bounces at vtk.org>] On Behalf Of David Kushner [root at davidkushner.me<mailto:root at davidkushner.me>]
Sent: Friday, April 24, 2015 2:18 PM
To: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
Subject: [vtkusers] vtkImagePlaneWidget Transparency/Windowing Problems
I'm currently building an application based heavily on the source provided in the QtVTKRenderWindows example (https://github.com/Kitware/VTK/blob/master/Examples/GUI/Qt/FourPaneViewer/QtVTKRenderWindows.cxx) using VTK 6.1. The only appreciable difference between my implementation and the one laid out in the example is the fact that, rather than using the vtkDICOMImageReader class, I'm loading our DICOM CT image in with ITK 4.8 and then converting it to the corresponding VTK image format using the itk::ImageToVTKImageFilter. I'm not sure if this is relevant to the issue I'm having, but I figure it couldn't hurt.
The issue is, though the image loads and renders just fine, the windowing applied to the image does not display transparency for out-of-window values as I would expect (and maybe this expectation is completely silly). The pixel type I'm using for the images, since they are CT scans, is `signed short`. The result I am seeing when I start my application is this:
[cid:ii_14ced4775ccffd82]
(http://i.imgur.com/vRkN0Ak.png)
Apologies if it is inappropriate to paste images inline or at all. As you can see, though the background values contained in the CT slice solid black, they are not exhibiting transparency as I would expect (or hope to achieve). Would anyone have some advice on how to achieve a transparency effect with this setup? I've tried a number of things from fiddling with the windowing of the plane widgets, the windowing values and color map of the renderer itself and then converting the image to an RGBA image before sending it on to the plane widgets. None of these seemed to have any effect on the outcome; the planes still rendered as opaque.
Any help would be GREATLY appreciated. It seems to me to be such a simple task yet I've mired myself in the complexities of ITK/VTK.
More information about the vtkusers
mailing list