[vtkusers] how to change vtkImageBlend opacity

David Gobbi david.gobbi at gmail.com
Mon Mar 7 08:53:08 EST 2016


Hi Muhammad,

The vtkImageBlend filter does not add an alpha component to the image.  If
the first input to vtkImageBlend is RGB, then the output is RGB.  This
filter will blend its inputs together, but given just one input, the output
will just be a copy of the input.

If your image is greyscale, you can use vtkImageMapToColors to add an alpha
component, by using the SetOutputFormatToRGBA() option.

 - David

On Mon, Mar 7, 2016 at 4:05 AM, Muhammad Jawad <softplanner at gmail.com>
wrote:

>
> Dear Vtk users,
>
> I am using vtkimageblend class for multiple volumes and want to change
> opacity of volumes. Here I put the small code for single volume for
> simplicity.
>
> ImageViewer is working fine but opacity is not working.
>
>
> Any body have an idea that what I'm doing wrong here ?
>
>
> vtkSmartPointer<vtkImageBlend> blend = vtkSmartPointer<vtkImageBlend>::New();
>
>
> blend->SetInputData(0, reader->GetOutput());
>
>
> blend->SetOpacity(0, 0.3);
>
>
> vtkSmartPointer<vtkImageViewer2> imgViewer = vtkSmartPointer<vtkImageViewer2>::New();
>
>
> imgViewer->SetInputData(blend->GetOutput());
>
>
> imgViewer->UpdateDisplayExtent();
>
>
>
>
>
> --
>
> Regards,
>
> Muhammad Jawad
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160307/ecb52112/attachment.html>


More information about the vtkusers mailing list