[vtkusers] all my streamlines are in white :(
Marcelino Rodriguez Cancio
marcelinorc at uclv.edu.cu
Wed Nov 9 11:47:59 EST 2011
Yifei,
>> no lookup table is set for the streamMapper. Why?
Because vtkPolyDataMapper has a default vtkLookUpTable.
If I'm correct vtkPolyDataMapper colors via the active scalars of the dataset. A common trick is to color the vectors by their magnitude (although this may not be want you want). You may achieve this using vtkAssingAtributte with something like the following:
aa = vtkAssignAttribute()
aa. SetInput(grid)
#Not so sure how to do this in Python since I have only worked in C++ and TCL
aa.Assign("SCALARS", "VECTORS", "POINT_DATA")
streamer.SetInputConnection(aa.GetOutputPort())
Hope it helps
Marcelino
De: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] En nombre de Yifei Li
Enviado el: miércoles, 09 de noviembre de 2011 10:07 a.m.
Para: vtkusers at vtk.org
Asunto: Re: [vtkusers] all my streamlines are in white :(
Marcelino,
Thank you. I'll try you suggestion.
But at the same time, if you take a look at the example that comes with VTK Examples/GUI/Python/StreamlinesWithLineWidget.py, no lookup table is set for the streamMapper. Why?
Yifei
On Wed, Nov 9, 2011 at 8:16 AM, Marcelino Rodriguez Cancio <marcelinorc at uclv.edu.cu<mailto:marcelinorc at uclv.edu.cu>> wrote:
Yifei:
I think you need to add a vtkLookUpTable:
lut = vtkLookupTable()
lut.SetHueRange(667, 0.0)
lut.Build()
streamMapper.SetLookupTable(lut)
Greetings
Marcelino
De: vtkusers-bounces at vtk.org<mailto:vtkusers-bounces at vtk.org> [mailto:vtkusers-bounces at vtk.org<mailto:vtkusers-bounces at vtk.org>] En nombre de Yifei Li
Enviado el: martes, 08 de noviembre de 2011 08:24 p.m.
Para: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
Asunto: [vtkusers] all my streamlines are in white :(
Hi all,
I want streamlines to be colored according to scalar values, but they are all white. Can someone help me figure out what's wrong with my code? Thanks -Yifei
# vector field data
grid = vtkStructuredGrid()
grid.SetPoints(points)
grid.GetPointData().SetVectors(vectors)
....
streamer = vtkStreamTracer()
...
# show streamlines using ribbon
rf = vtkRibbonFilter()
rf.SetInputConnection(streamer.GetOutputPort())
streamMapper = vtkPolyDataMapper()
streamMapper.SetInputConnection(rf.GetOutputPort())
# I thought the following lines should make it
streamMapper.ScalarVisibilityOn()
streamMapper.SetScalarRange(0.0, grid.GetPointData().GetVectors().GetMaxNorm())
________________________________
-Universidad Central "Marta Abreu" de Las Villas. http://www.uclv.edu.cu
-Participe en Universidad 2012, del 13 al 17 de febrero de 2012. Habana.Cuba. http://www.congresouniversidad.cu
-Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu/
________________________________
-Universidad Central "Marta Abreu" de Las Villas. http://www.uclv.edu.cu
-Participe en Universidad 2012, del 13 al 17 de febrero de 2012. Habana.Cuba. http://www.congresouniversidad.cu
-Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu/
________________________________
-Universidad Central "Marta Abreu" de Las Villas. http://www.uclv.edu.cu
-Participe en Universidad 2012, del 13 al 17 de febrero de 2012. Habana.Cuba. http://www.congresouniversidad.cu
-Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu/
________________________________
-Universidad Central "Marta Abreu" de Las Villas. http://www.uclv.edu.cu
-Participe en Universidad 2012, del 13 al 17 de febrero de 2012. Habana.Cuba. http://www.congresouniversidad.cu
-Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111109/6e8be37b/attachment.htm>
More information about the vtkusers
mailing list