[vtkusers] Complementary color LUTs
Jothybasu Selvaraj
jothybasu at gmail.com
Wed Apr 20 19:55:29 EDT 2016
Hi David
Though it works, I would like to have the images rendered like the one
shown in Ref.jpg. With the current code it is rendered like the one in the
attached Current.jpg.
Thanks
Jothy
On Thu, Apr 21, 2016 at 9:32 AM, Jothybasu Selvaraj <jothybasu at gmail.com>
wrote:
> Fantastic David!
>
> With the latest modification on table2 you sent, it works well.
>
> I agree, it will be great if VTK can add a class to do this where users
> can choose a set of colors they need to fuse.
>
>
> Thanks a lot!
>
>
> Cheers
>
> Jothy
>
> On Thu, Apr 21, 2016 at 12:45 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> Looks like I was wrong about the second table. It should use this:
>>
>> table2 ->SetValueRange(0.0,1.0);
>> table2 ->SetAlphaRange(0.5,0.5);
>>
>> Ideally, it would be nice if VTK provided a way to simply add the
>> two colors together, but the best you can do is use the alpha to
>> make VTK multiply the images by 0.5 before adding them. As a
>> result, you end up with grey instead of white.
>>
>> - David
>>
>> On Wed, Apr 20, 2016 at 1:15 AM, David Gobbi <david.gobbi at gmail.com>
>> wrote:
>>
>>> Hi Jothy,
>>>
>>> I see this mistake a lot... people try to blend images by setting the
>>> alpha of both images to 0.5. That's wrong. If you want to blend images,
>>> then the first image should be opaque, and the second image should have an
>>> alpha of 0.5.
>>>
>>> C = C1*(1 - alpha2) + C2*alpha2
>>>
>>> The second mistake is that, if you want to blend complimentary colors,
>>> then you don't want the Value of the second image to be the ramp. Instead,
>>> you want the Alpha of the second image to be the ramp.
>>>
>>> // Create a GREEN lookup table
>>> vtkSmartPointer<vtkLookupTable> table =
>>> vtkSmartPointer<vtkLookupTable>::New();
>>> table->SetHueRange(0.33333,0.33333);
>>> table->SetSaturationRange(1.0,1.0);
>>> table->SetValueRange(0.0,1.0);
>>> table->SetAlphaRange(1.0,1.0); // make the bottom image opaque
>>> table->SetRampToLinear();
>>> table->Build();
>>>
>>> // Create a MAGENTA lookup table
>>> vtkSmartPointer<vtkLookupTable>table2 =
>>> vtkSmartPointer<vtkLookupTable>::New();
>>> table2 ->SetHueRange(0.8333,0.8333);
>>> table2 ->SetSaturationRange(1.0,1.0);
>>> table2 ->SetValueRange(1.0,1.0); // use pure magenta, don't mix with
>>> black
>>> table2 ->SetAlphaRange(0.0,1.0); // use an alpha ramp to blend the
>>> images
>>> table2 ->SetRampToLinear();
>>> table2 ->Build();
>>>
>>> - David
>>>
>>>
>>> On Tue, Apr 19, 2016 at 11:43 PM, Jothybasu Selvaraj <
>>> jothybasu at gmail.com> wrote:
>>>
>>>> Hi All
>>>>
>>>> I am trying to overlay 2 registered images using complementary LUTs
>>>> (magenta & green), so that the images will appear white where they match
>>>> perfectly. However, I couldn't get the desired results. The image appears
>>>> magenta where they match.
>>>>
>>>> Can anyone find any mistakes in this?
>>>>
>>>> Below are the LUTs I use:
>>>>
>>>> // Create a GREEN lookup table
>>>>
>>>> vtkSmartPointer<vtkLookupTable> table =
>>>>
>>>> vtkSmartPointer<vtkLookupTable>::New();
>>>>
>>>> table->SetHueRange(0.33333,0.33333);
>>>>
>>>> table->SetSaturationRange(1.0,1.0);
>>>>
>>>> table->SetValueRange(0.0,1.0);
>>>>
>>>> table->SetAlpha(0.5);
>>>>
>>>> table->SetRampToLinear();
>>>>
>>>> table->Build();
>>>>
>>>>
>>>> // Create a MAGENTA lookup table
>>>>
>>>> vtkSmartPointer<vtkLookupTable>table2 =
>>>>
>>>> vtkSmartPointer<vtkLookupTable>::New();
>>>>
>>>> table2 ->SetHueRange(0.8333,0.8333);
>>>>
>>>> table2 ->SetSaturationRange(1.0,1.0);
>>>>
>>>> table2 ->SetValueRange(0.0,1.0);
>>>>
>>>> table2 ->SetAlpha(0.5);
>>>>
>>>> table2 ->SetRampToLinear();
>>>>
>>>> table2 ->Build();
>>>>
>>>>
>>>> Any help is highly appreciated!
>>>>
>>>>
>>>>
>>>> Cheers
>>>>
>>>>
>>>> Jothy
>>>>
>>>>
>>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160421/092e2605/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Ref.jpg
Type: image/jpeg
Size: 38110 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160421/092e2605/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Current.png
Type: image/png
Size: 46068 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160421/092e2605/attachment.png>
More information about the vtkusers
mailing list