[vtkusers] all my streamlines are in white :(
Yifei Li
yifli82 at gmail.com
Wed Nov 9 13:50:23 EST 2011
Marcelino,
Thank you for your help, but my problem persists.
Setting a lookup table failed (although, like you said, it's not necessary
since vtkPolyDataMappe already has one).
Then I tried vtkAssignAttribute, it does not work for me either. I
guess aa.Assign("SCALARS",
"VECTORS", "POINT_DATA") means treat the point data (velocity vectors)
in the grid as scalars, which makes sense to me.
I took a look at another example
Examples/VisualizationAlgorithms/Python/OfficeTube.py, the only thing
that's relevant to streamline coloring is
mapStreamTube.SetScalarRange(reader.GetOutput().GetPointData().GetScalars().GetRange()),
where mapStreamTube is a PolyDataMapper
What I have in my program is very similar to the above:
streamMapper.SetScalarRange(0.0,
grid.GetPointData().GetVectors().GetMaxNorm())
I print out the the value of GetMaxNorm() and it is not zero.
On Wed, Nov 9, 2011 at 11:47 AM, Marcelino Rodriguez Cancio <
marcelinorc at uclv.edu.cu> wrote:
> 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> 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] *En
> nombre de *Yifei Li
> *Enviado el:* martes, 08 de noviembre de 2011 08:24 p.m.
> *Para:* 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/
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111109/d310f1ad/attachment.htm>
More information about the vtkusers
mailing list