Editing
Vtk/ColorLookupTablea
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Generating a Broad Range of Color Table=== Here we will illustrate how to use VisTrail's "vtkLookupTable" module to readily generate a broad range of color tables. For tutorial purposes we will use the "rainbow.vt" vistrail (see …/examples/vtk_examples/Rendering/rainbow.vt) so that immediate parallels can be drawn between our presentation and the explanation of Color Maps that is provided by [http://www.amazon.com/Visualization-Toolkit-Object-Oriented-Approach-Graphics/dp/193093419X/ref=pd_sim_sbs_b_1?ie=UTF8&refRID=0EFGPTSBP5E136WEK4V7 Schroeder, Martin, & Lorensen (2006)] — see their Figure 6-3 and the related code development presented in their §6.6 (especially pp. 196 - 197). A closely related, informative presentation can be found under the subsection labeled "Backing up -- a Colormap" within [http://web.cs.wpi.edu/~matt/courses/cs563/talks/vtk/visualization.html Matthew Ward's posted computer science class lecture notes at Worcester Polytechnic Institute]. <div align="center"> <table border="2" cellpadding="3" width="80%"> <tr> <th align="center"> Rainbow Color Maps </th> </tr> <tr> <td align="center"> [[Image:RainbowFigure6-3.png|700px|Illustrating Rainbow Color Maps]] </td> </tr> <tr> <td align="left"> Snapshot of a two-by-two VisTrails spreadsheet generated using the "rainbow.vt" vistrail, for comparison with Figure 6-3 of [http://www.amazon.com/Visualization-Toolkit-Object-Oriented-Approach-Graphics/dp/193093419X/ref=pd_sim_sbs_b_1?ie=UTF8&refRID=0EFGPTSBP5E136WEK4V7 Schroeder, Martin, & Lorensen (2006)] </td> </tr> </table> </div> <font color="blue">Rainbow image B2:</font> * When the "rainbow.vt" vistrail is loaded and executed without any alterations, the VisTrails pipeline will render the image that appears in the bottom right-hand corner of the above "Rainbow Color Maps" figure — as displayed, it is image B2 in the VisTrails spreadsheet. Selecting/highlighting the "vtkLookupTable" module in the initial pipeline will reveal that the color table used to generate this image was constructed by brute force, as discussed above; the ''Methods'' window contains 256 individually specified colors! (Be patient. After clicking on the "vtkLookupTable" module that exists as part of the default "rainbow" pipeline, VisTrails will spin its wheels and be unresponsive for 10 or more seconds as it loads the extensive set of methods.) <font color="blue">Rainbow image A2:</font> * The rendering that appears in the bottom left-hand corner of the above "Rainbow Color Maps" figure (''i.e.,'' VisTrails spreadsheet image A1) was generated using [[vtk/SimpleCubeTutorial#Deciphering_VTK.27s_default_Lookup_Table|VTK's ''default'' color table]]. ** Image A2 can be generated by selecting/highlighting the "vtkLookupTable" module, deleting the "SetNumberOfColors" method and all 256 "SetTableValue" methods from the VisTrails ''Set Methods'' window, then re-executing the pipeline. (Not recommended, as this is hardly worth the effort!) ** Image A2 can more simply be generated by disconnecting the "vtkLookupTable" module from the "vtkPolyDataMapper" module then re-executing the pipeline. ** Image A2 can also be generated by disconnecting the "vtkLookupTable" module from the "vtkPolyDataMapper" module, creating (by dragging & dropping) a new "vtkLookupTable" module into the pipeline window and connecting it to the "vtkPolyDataMapper" module, then re-executing the pipeline. Drawing on the design and capabilities of the VTK library, VisTrails' "vtkLookupTable" module most broadly facilitates the creation of color maps using HSVA (''i.e.,'' hue, saturation, value, & alpha opacity value) specifications. As [http://www.amazon.com/Visualization-Toolkit-Object-Oriented-Approach-Graphics/dp/193093419X/ref=pd_sim_sbs_b_1?ie=UTF8&refRID=0EFGPTSBP5E136WEK4V7 Schroeder, Martin, & Lorensen (2006)] explain (see p. 196), the procedure for generating lookup table entries is to define pairs of values for HSVA. These pairs define a linear ramp for hue, saturation, value, and opacity and, in turn, these linear ramps are used to generate a table with the number of table entries requested. VTK and, in turn, VisTrails, adopts the following ''default'' HSVA specifications: SetHueRange (0,2/3), SetSaturationRange (1,1), SetValueRange (1,1), & SetAlphaRange (1,1); and the ''default'' size of the color table is SetNumberOfColors(256). <font color="blue">Rainbow image B1:</font> * The rendering that appears in the top right-hand corner of the above "Rainbow Color Maps" figure (''i.e.,'' VisTrails spreadsheet image B1) was generated by VisTrails after the methods shown in the following table were activated inside the "vtkLookupTable" module. <table border="1" cellpadding="5" align="center"> <tr> <td align="center"> C++ Code Using VTK Routines Directly<br> <font size="-2"> [see p. 196 of [http://www.amazon.com/Visualization-Toolkit-Object-Oriented-Approach-Graphics/dp/193093419X/ref=pd_sim_sbs_b_1?ie=UTF8&refRID=0EFGPTSBP5E136WEK4V7 Schroeder, Martin, & Lorensen (2006)]] </font> </td> <td align="center"> Equivalent '''VisTrails'''<br> Set Methods Window </td> </tr> <tr> <td align="left"> <pre> vtkLookupTable *lut=vtkLookupTable::New(); lut->SetHueRange(0.66667, 0.0); lut->SetSaturationRange(1.0, 1.0); lut->SetValueRange(1.0, 1.0); lut->SetAlphaRange(1.0, 1.0); lut->SetNumberOfColors(256); lut->Build(); </pre> <br> <br> <br> <br> <br> <br> <br> <br> </td> <td align="center"> [[Image:RainbowImageB1A.png|150px|Set Methods B1A]] </td> </tr> <tr> <td align="left"> <pre> vtkLookupTable *lut=vtkLookupTable::New(); lut->SetHueRange(0.66667, 0.0); lut->Build(); </pre> </td> <td align="center"> [[Image:RainbowImageB1B.png|150px|Set Methods B1B]] </td> </tr> </table> <font color="blue">Rainbow image A1:</font> * The rendering that appears in the top left-hand corner of the above "Rainbow Color Maps" figure (''i.e.,'' VisTrails spreadsheet image A1) was generated by VisTrails after the methods shown in the following table were activated inside the "vtkLookupTable" module. <table border="1" cellpadding="5" align="center"> <tr> <td align="center"> C++ Code Using VTK Routines Directly<br> <font size="-2"> [see p. 196 of [http://www.amazon.com/Visualization-Toolkit-Object-Oriented-Approach-Graphics/dp/193093419X/ref=pd_sim_sbs_b_1?ie=UTF8&refRID=0EFGPTSBP5E136WEK4V7 Schroeder, Martin, & Lorensen (2006)]] </font> </td> <td align="center"> Equivalent '''VisTrails'''<br> Set Methods Window </td> </tr> <tr> <td align="left"> <pre> vtkLookupTable *lut=vtkLookupTable::New(); lut->SetHueRange(0.0, 0.0); lut->SetSaturationRange(0.0, 0.0); lut->SetValueRange(0.0, 1.0); </pre> <br> <br> <br> <br> <br> </td> <td align="center"> [[Image:RainbowImageA1.png|150px|Set Methods A1]] </td> </tr> </table>
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information