Clarification and help using vtkLookupTable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Clarification and help using vtkLookupTable

Neel Patel 0-0-0
Hi All,

     I'm trying to use vtkLookupTable to add color in my image, something like what they show on the weather forecasts. From what I understand, SetRange(0,255) means that any pixel value in the image that is in between the min and max, will be assigned a value that has been set by SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255, 1). To test this out I made a simple lookupTable where everything except for 0 was given a rgb value of 255, 0, 0;

 vtkLookupTable table = vtkLookupTable.New();
            table.SetRange(0, 255);
            table.SetTableValue(0, 0, 0, 0, 0);
           
            for (int i = 1; i < 255; i++)
            {
                table.SetTableValue(i, 255, 0, 0, 0.3);
            }
            table.SetRampToLinear();
            table.Build();

This however still gives me and image with red, green, and blue showing up instead of just red. Also just to note this is on top of a black/white image, so there aren't any other places from which the colors could come from. Any help would be appreciated. Thanks.

                           Regards,
                                Neel Patel

     
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clarification and help using vtkLookupTable

David E DeMarle
Take out the calls to set ramp and especially build. Build replaces all of the value:colors you've set with automatically generated ones.

On Aug 7, 2017 8:04 PM, "Neel Patel 0-0-0" <[hidden email]> wrote:
Hi All,

     I'm trying to use vtkLookupTable to add color in my image, something
like what they show on the weather forecasts. From what I understand,
SetRange(0,255) means that any pixel value in the image that is in between
the min and max, will be assigned a value that has been set by
SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255, 1). To
test this out I made a simple lookupTable where everything except for 0 was
given a rgb value of 255, 0, 0;

 vtkLookupTable table = vtkLookupTable.New();
            table.SetRange(0, 255);
            table.SetTableValue(0, 0, 0, 0, 0);

            for (int i = 1; i < 255; i++)
            {
                table.SetTableValue(i, 255, 0, 0, 0.3);
            }
            table.SetRampToLinear();
            table.Build();

This however still gives me and image with red, green, and blue showing up
instead of just red. Also just to note this is on top of a black/white
image, so there aren't any other places from which the colors could come
from. Any help would be appreciated. Thanks.

                           Regards,
                                Neel Patel





--
View this message in context: http://vtk.1045678.n5.nabble.com/Clarification-and-help-using-vtkLookupTable-tp5744313.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Clarification and help using vtkLookupTable

Neel Patel 0-0-0
Got it. I assumed that build created the table with all the set values. Thanks David!
Loading...