[vtkusers] vtkLookupTable... cannot manually create table for red and blue values
Luca Pamparana
deluded.soul at gmail.com
Mon Sep 4 10:35:27 EDT 2006
Ok, this is bizarre...
This code suffers from the same problem:
// This works fine... builds a red map... works fine.
lut->SetHueRange(0.0, 0.0);
lut->SetSaturationRange(1.0, 1.0);
lut->SetValueRange(0.0, 1.0);
lut->SetAlphaRange(1.0, 1.0);
lut->SetNumberOfColors(256);
lut->SetRampToLinear();
lut->SetTableRange(range[0], range[1]);
lut->Build();
// This should be green... all I see is a black screen...
vtkLookupTable * lut = vtkLookupTable::New();
lut->SetHueRange( 1.0/3.0, 1.0/3.0);
lut->SetSaturationRange(1.0, 1.0);
lut->SetValueRange(0.0, 1.0);
lut->SetAlphaRange(1.0, 1.0);
lut->SetNumberOfColors(256);
lut->SetRampToLinear();
lut->SetTableRange(range[0], range[1]);
lut->Build();
This happens with any DICOM data set I load... Could this be due to the
data?
Cheers,
Luca
On 9/4/06, Luca Pamparana <deluded.soul at gmail.com> wrote:
>
> Hi Obada,
>
> Thanks for replying!
>
> I actually have those calls and the code for constructing the red color
> map is the same as for the green and blue... I just have no idea why it
> would do this!
>
> Would someone happen to know how I can use the HSV values for setting the
> color map?
>
> I am currently doing...
>
> vtkLookupTable * lut = vtkLookupTable::New();
> lut->SetHueRange( 2.0/3.0, 2.0/3.0);
> lut->SetSaturationRange(0.0, 1.0);
> lut->SetValueRange(0.0, 1.0);
> lut->SetAlphaRange( 1.0, 1.0);
> lut->SetNumberOfColors(256);
> lut->SetTableRange(range[0], range[1]);
> lut->Build();
>
> What I want is a pure blue mapping. The resulting image is a bit of a
> weird blue color.
>
> On 9/4/06, Obada Mahdi <omahdi at gmx.de> wrote:
>
> > 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
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060904/5619f56d/attachment.htm>
More information about the vtkusers
mailing list