[vtk-developers] Is vtkDataArray GetLookupTable() ever used?

David Gobbi david.gobbi at gmail.com
Thu Nov 8 12:02:29 EST 2012


Hi John,

My preferences are in the opposite direction... I'd prefer the lookup
tables to be even further from the data, i.e. in the vtkProperty
instead of in the vtkMapper.  I disagree that having the lookup table
as a member of the vtkDataArray object is "good design", a data
array should simply be a data array.

But I see your point about the mappers.  There is no way for the
mapper to specify a lookup table per attribute or per array name.
So switching the array you are looking at necessitates switching
the lookup table, or at least changing the range.  Maybe the mappers
could be improved in this respect?

Regardless, the complete lack of tests for the data array's lookup
table is very worrisome.  The code that handles this lookup table
could break or even be removed completely and the dashboards
would not show anything.

 - David

On Thu, Nov 8, 2012 at 1:59 AM, John Platt <jcplatt at dsl.pipex.com> wrote:
> Hi David,
>
> Yes.
>
> I find this a very useful feature and use it to share the same LUT across
> data arrays for each of the grids in the visualisation. It seems a safe and
> well designed way to ensure all the mappers produce the correct colours.
>
> It is also very convenient when switching attribute data (cell/point,
> scalars/vectors) not to have to find the new range then hunt down the
> mapper's and change the range.
>
> Here are a couple of my use cases:
>
> 1. Point data is discontinuous across some element boundaries in a finite
> element analysis (typically the field
> gradients). My solution is to create separate unstructured grids for the
> elements where the point data is continuous. By using the same LUT for the
> point data in each of the grids, I can easily create a single legend for all
> the grids and manipulate the range without reference to any of the mapper's.
>
> 2. Animation of transient data. Data for each time step is stored at the
> start as field data all sharing the same LUT. Animation proceeds by simply
> assigning the field data as attribute data. Again, no knowledge of the
> mapper is required.
>
> It is the separation of the data from the mapper which makes these cases
> easy to deal with. I suppose the question should be whether the LUT is a
> property of the data or the mapper. In my view it is the former but you have
> far more experience.
>
> Thanks for your consideration.
>
> John.
>
>
>
> ----- Original Message ----- From: "David Gobbi" <david.gobbi at gmail.com>
> To: "VTK Developers" <vtk-developers at vtk.org>
> Sent: Wednesday, November 07, 2012 9:15 PM
> Subject: [vtk-developers] Is vtkDataArray GetLookupTable() ever used?
>
>
>> The vtkDataArray::LookupTable seems to be a purely legacy feature.
>> So I'm wondering if it can be removed, to eliminate the dependency
>> of vtkDataArray on vtkLookupTable.  This would, in fact, completely
>> remove the dependency of _all_ Common classes on vtkLookupTable,
>> except for the ones in Common/Color.
>>
>> Most tellingly, VTK's xml reader/writers completely ignore the data
>> array lookup tables.  When the data arrays are saved in a file, their
>> lookup tables are not saved.  So these lookup tables do not seem to
>> be considered an important part of the data set.
>>
>> Only the following files call vtkDataArray::GetLookupTable():
>>
>> Common/Core/vtkDataArray.h
>> Common/Core/vtkDataArray.cxx
>> Common/Core/Testing/Cxx/otherArrays.cxx
>> Common/DataModel/vtkDataSetAttributes.cxx
>> IO/Geometry/vtkIVWriter.cxx
>> IO/Legacy/vtkDataReader.cxx
>> IO/Legacy/vtkDataWriter.cxx
>> IO/MINC/vtkMNIObjectWriter.cxx
>> Rendering/Core/vtkMapper.cxx
>> Rendering/Core/vtkPolyDataMapper2D.cxx
>> Rendering/Core/vtkScalarsToColorsPainter.cxx
>>
>> No test failures occurred after I commented out the GetLookupTable()
>> lines of code in the above files.  This indicates that the data array
>> lookup
>> tables are completely untested.
>>
>> In summary: if the vtkDataArray::LookupTable is removed, then
>> vtkLookupTable and all its associated classes can be cleanly moved
>> from Common/Core to Common/Color.  If people aren't comfortable with
>> doing the removal in VTK 6.0, it would probably be worthwhile to at
>> least deprecate the data array Get/SetLookupTable() methods now
>> so they can be removed in VTK 6.2.
>>
>>  - David



More information about the vtk-developers mailing list