User:Tohline/vtk/ColorLookupTablea

From VistrailsWiki
< User:Tohline
Revision as of 01:08, 24 March 2014 by Tohline (talk | contribs) (Finished describing how to insert a color table into VisTrail's vtkLookupTable module)
Jump to navigation Jump to search

Color Lookup Tables

Whitworth's (1981) Isothermal Free-Energy Surface
|   Tiled Menu   |   Tables of Content   |  Banner Video   |  Tohline Home Page   |

This presentation is intended to accompany the "Simple Cube" tutorial that we have written as an aid for individuals who are trying to fully utilize the capabilities of VisTrails in their research. It is intended to build upon the information that can be obtained from the VTK User's Guide, authored and published by Kitware, Inc.

In our accompanying discussion, we have explained how VTK's default color table can be relied upon to assign colors to POLYGONS, based on the scalar values with which each POLYGON has been labeled. Then, following an example used in the VTK User's Guide, we have explained how the user can define his/her own color table inside of an input file that adheres to the Simple Legacy Format. By way of illustration, the following short LOOKUP_TABLE has been extracted from Example E in our accompanying discussion:

LOOKUP_TABLE my_table 8
0.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
1.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 0.0 1.0 1.0
0.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0

Using VisTrail's vtkLookupTable Module

Brute Force Definition of Color Table

As is illustrated by the following snapshot of the full VisTrails builder window, the same user-defined color table can be injected into the VisTrails rendering pipeline by using VisTrail's vtkLookupTable module.

  • In the left-hand "Modules" segment of the VisTrails builder window, find the vtkLookupTable module and drag it into the pipeline segment of the window.
  • Link the standard output from the vtkLookupTable module to the appropriate input channel of the vtkPolyDataMapper module, as shown.
  • Click on (i.e., select) the vtkLookupTable module then locate and drag/drop the following Methods into the "Set Methods" segment of right-hand window:
    • One instance of the SetNumberOfColors method.
    • Eight instances of the SetTableValue method.
    • CAUTION: After dropping (approximately) the third instance of SetTableValue into the "Set Methods" window, you will likely discover that the window is completely filled (as illustrated in the screen shot, below) but that VisTrails does not activate scrolling. Hence, it isn't possible to drop the fourth instance of the method below the third instance. What VisTrails expects you to do, instead, is drop all subsequent instances of the SetTableValue method onto the header bar at the top of the window segment that reads, "Set Methods." VisTrails will then insert each additional method into its proper location, at the end of the stack of activated methods.
  • In keeping with the above-provided example Lookup Table, type in the following:
    • Type the integer "8" into the SetNumberOfColors method window.
    • In each instance of the SetTableValue method, (A) use the top "Integer" text window to label, in sequence, each color table value with the appropriate integer number, <math>~0 - 7</math>; and (B) use the four "Float" text windows to enter the assigned rgba colors.


VisTrails Screen Snapshot

Employing the vtkLookupTable Module

The new Lookup Table that is now provided by VisTrail's vtkLookupTable module will be treated by the VisTrails pipeline as the default Lookup Table. VTK will use this new color table when rendering the POLYGONS if it is instructed to refer to the default table. This can be accomplished via an explicit instruction inside the user-provided input data file — as in Examples A, B, & C from our accompanying "Simple Cube" tutorial — or by activating the "SetLookupTableName" method in the vtkPolyDataReader module and typing the string "default" into the provided text window. This discussion should be considered a supplement to our related discussion on switching between different color tables.

Related Discussions