Difference between revisions of "User:Tohline/vtk/ColorLookupTablea"

From VistrailsWiki
Jump to navigation Jump to search
(→‎Using VisTrail's vtkLookupTable Module: Another intermediate save)
(Finished describing how to insert a color table into VisTrail's vtkLookupTable module)
Line 3: Line 3:
This presentation is intended to accompany the [[User:Tohline/vtk/SimpleCubeTutorial|"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 [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide,'' authored and published by Kitware, Inc.]
This presentation is intended to accompany the [[User:Tohline/vtk/SimpleCubeTutorial|"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 [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide,'' authored and published by Kitware, Inc.]


==Using VisTrail's vtkLookupTable Module==
In our [[User:Tohline/vtk/SimpleCubeTutorial#Constructing_a_More_Sophisticated_Cube|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 [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide''], we have explained how [[User:Tohline/vtk/SimpleCubeTutorial#Specifying_Colors_of_Cell_Faces_via_a_User-defined_Color_Table|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 [[User:Tohline/vtk/SimpleCubeTutorial#Specifying_Colors_of_Cell_Faces_via_a_User-defined_Color_Table|Example E in our accompanying discussion]]:
In our [[User:Tohline/vtk/SimpleCubeTutorial#Constructing_a_More_Sophisticated_Cube|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 [http://www.kitware.com/products/books/vtkguide.html ''VTK User's Guide''], we have explained how [[User:Tohline/vtk/SimpleCubeTutorial#Specifying_Colors_of_Cell_Faces_via_a_User-defined_Color_Table|the user can define his/her own color table]] inside of an input file that adheres to the ''Simple Legacy Format.''


<div align="center">
<div align="center">
Line 19: Line 18:
</pre>
</pre>
</div>
</div>
==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.
** <font color="red">CAUTION:</font> 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 <font face="Courier">rgba</font> colors.


<div align="center">
<div align="center">
Line 34: Line 47:
</table>
</table>
</div>
</div>
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 &#8212; as in Examples A, B, &amp; C from our accompanying [[User:Tohline/vtk/SimpleCubeTutorial|"Simple Cube" tutorial]] &#8212; 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 [[User:Tohline/vtk/SimpleCubeTutorial#Other_Knobs_to_Twist|related discussion on switching between different color tables]].


=Related Discussions=
=Related Discussions=

Revision as of 01:08, 24 March 2014

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