[vtkusers] Point rendering : how to filter values with a vtkLookupTable
David.Pont at ForestResearch.co.nz
David.Pont at ForestResearch.co.nz
Wed Feb 4 15:48:02 EST 2004
Hi Aurélien,
The code fragment below constructs a greyscale lookuptable with 5
colors. After the call to Build one color is changed so that alpha is 0.
Data values mapped into this color in the lookuptable will be transparent.
vtkLookupTable *lut1 = vtkLookupTable::New();
lut1->SetRange( 0, 0.5 );
lut1->SetNumberOfColors( 5 );
lut1->SetHueRange( 0, 0 );
lut1->SetSaturationRange( 0, 0 );
lut1->SetValueRange( 0, 1 );
lut1->Build();
lut1->SetTableValue( 1, 0, 0, 0, 0 ); // make one band
disappear, note: rgb values not important
vtkPolyDataMapper *pdm1 = vtkPolyDataMapper::New();
pdm1->SetInput( clpd1->GetOutput() );
pdm1->SetScalarRange( 0, 0.5 );
pdm1->SetLookupTable( lut1 );
pdm1->ScalarVisibilityOn();
You should be able to use appropriate values for SetRange,
SetNumberOfColors, SetTableValue and SetScalarRange to hide parts of your
dataset. This worked for me on polydata surfaces, I am not sure about
rendering points, but I would expect it to work.
bon chance
Dave Pont
REGAT-BARREL
Aurélien To: VTK <vtkusers at vtk.org>
<arbvtk at yahoo.fr> cc:
Sent by: Subject: [vtkusers] Point rendering : how to filter values
vtkusers-admin at vt with a vtkLookupTable
k.org
05/02/2004 03:24
Hello,
I have a vtkStructuredPoints which contains some interesting values but
also some "empty" values (=0) that are viewed in black, all around the
interesting object which is composed by points from values 1 to 255. I
would like to not see points with value zero, in order to "free" the object
inside. I tried to play with a vtkLookupTable in order to assign a null
alpha value to black points (=0) but it didn't work. The mapper seems to
ignore my changes to its lookuptable. Here is an example. How can I filter
black values without modifying my vtkStructuredPoints.
package require vtk
package require vtkinteraction
package require vtktesting
vtkMath math
# 20x10x10 points
set numberOfInputPoints 2000
vtkUnsignedCharArray scalars
for {set i 0} {$i < $numberOfInputPoints} {incr i 1} {
scalars InsertNextTuple1 [math Random 0 255]
}
vtkStructuredPoints cloud
cloud SetDimensions 20 10 10
cloud SetOrigin 0 0 0
cloud SetSpacing 1 1 1
[cloud GetPointData] SetScalars scalars
vtkDataSetMapper mapper
mapper SetInput cloud
mapper SetScalarRange 0 256
vtkActor actor
actor SetMapper mapper
vtkRenderer ren
ren AddActor actor
ren SetBackground 0 0 0
vtkRenderWindow renWin
renWin AddRenderer ren
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
renWin SetSize 500 500
renWin Render
iren Start
wm withdraw .
Later, I would like to create a slider that allows the user to filter
viewed values from 0 to 255. How to do that ?
I attach a screenshot that shows my problem. I have a 3D object but I can't
see it well. Black values are undesirable.
Thanks.
Aurélien
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail(See attached file: bloc.png)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bloc.png
Type: image/png
Size: 25069 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040205/24f1465f/attachment.png>
More information about the vtkusers
mailing list