[vtkusers] vtkImageBlend output alpha
Mike Withascarf
mikewithascarf at yahoo.com
Thu Jul 20 14:00:34 EDT 2017
Thanks, that's the workaround I'm using for the moment.
Mike
From: David Gobbi <david.gobbi at gmail.com>
To: Mike Withascarf <mikewithascarf at yahoo.com>
Cc: "vtkusers at vtk.org" <vtkusers at vtk.org>
Sent: Thursday, July 20, 2017 8:33 AM
Subject: Re: [vtkusers] vtkImageBlend output alpha
Hi Mike,
There is no way to change this behavior for vtkImageBlend. One solution is to use a dummy image as input 0 (same dimensions as your first image, but with RGBA set to 0,0,0,1 for all pixels), and then add your two images as inputs 1 and 2.
- David
On Wed, Jul 19, 2017 at 10:49 AM, Mike Withascarf via vtkusers <vtkusers at vtk.org> wrote:
Hi, I'm using vtkImageBlend to blend two vtkImageMapToColors. Right now if I change the opacity map of the first vtkImageMapToColors (via lookup table), it adjusts the entire alpha of the output (so for example hiding the first one hides both of them). Is there a way to prevent vtkImageBlend from assigning the opacity of the first element to the output? I've tried using the "compound" blending mode in case that would help, but the screen is blank then. Any help would be great!
This is a simplified version of the code I'm using:
vtkSmartPointer<vtkImageMapToC olors> imapper1 = vtkSmartPointer<vtkImageMapToC olors>::New();imapper1->SetLookupTable(lut1) ;imapper1->PassAlphaToOutputOn( );imapper1->SetInputData(image1) ;imapper1->Update();
vtkSmartPointer<vtkImageMapToC olors> imapper2 = vtkSmartPointer<vtkImageMapToC olors>::New();imapper2->SetLookupTable(lut2) ;imapper2->PassAlphaToOutputOn( );imapper2->SetInputData(image2) ;imapper2->Update();
vtkSmartPointer<vtkImageBlend> blend = vtkSmartPointer<vtkImageBlend> ::New();blend->AddInputConnection(imap per1->GetOutputPort());blend->SetOpacity(0, 1.0);blend->AddInputConnection(imap per2->GetOutputPort());blend->SetOpacity(1, 1.0);
// If I now render and adjust lut1, it affects the output of blend so the imapper2 image gets affected
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170720/598d7000/attachment.html>
More information about the vtkusers
mailing list