[vtkusers] vtkLookupTable... cannot manually create table for red and blue values

Obada Mahdi omahdi at gmx.de
Mon Sep 4 09:41:42 EDT 2006


Hi Luca,

here are some suggestions:

On 04.09.2006, at 11:55, Luca Pamparana wrote:
> Someone please help me with this vtkLookupTable problem. I was  
> trying all weekend but cannot figure out what I am doing wrong!
>
> I am constructing a vtkLookupTable manually as follows:
>
>
> double * range = reader->GetOutput()->GetScalarRange();

Just to be sure: Is the output of `reader' up-to-date?  Try a
"reader->Update()", at least before using `range' below.

> vtkLookupTable * greenMap = vtkLookupTable::New();
> greenMap->SetNumberOfTableValues(256);
> greenMap->Build();
>
[calls to greenMap->SetTableValue()]
> greenMap->SetAlphaRange(1.0,1.0);
>
> greenMap->SetTableRange(range[0], range[1]);

 From the documentation and source code it seems that values provided by
SetAlphaRange() etc. are used when constructing the lookup table in
vtkLookupTable::Build() (based on linear ramps), so they should  
probably go
before the call to Build().


Try doing something like this:

| double* range;
| vtkLookupTable* greenMap;
|
| reader->Update();
| range = reader->GetOutput()->GetScalarRange();
| greenMap = vtkLookupTable::New();
| greenMap->SetNumberOfTableValues(256);
| greenMap->SetAlphaRange(1.0, 1.0);
| greenMap->SetTableRange(range[0], range[1]);
| greenMap->Build();
|
| [for loop with calls to SetTableValue()]

> I see nothing but a black screen. However, when I generate the  
> table for
> red... like:
[...]
> then my image is mapped correctly to red values...
No idea about this one.

I have no experience actually using vtkLookupTable; if the  
suggestions above
do not help, I could try and have a closer look (maybe the output of
greenMap->PrintSelf(cerr, vtkIndent(0))
can help in understanding what goes wrong, and whether the lookup  
table is
the problem after all).


Regards

Obada



More information about the vtkusers mailing list