Hello,<br> Looks like this email didn't go through (sorry if is a duplicate). I have a question about displaying vector fields in VTK using glyphs. Given a vector field (generated in ITK)<br><br>field.vtk<br> BINARY<br> DATASET STRUCTURED_POINTS<br> DIMENSIONS 256 256 20<br> SPACING 1 1 2<br> ORIGIN 0 0 0<br> POINT_DATA 1310720<br> SCALARS scalars float 3<br><br>When I try to visualize it in VTK, all the glyphs point to the same direction. (along the same axis)<br><br>I was wondering if anyone knows what could be wrong. Here is the code I'm using. In Paraview the fields and arrows look fine.<br><br>Thanks!<br>-J<br><br>=====================<br><br>#Create the reader for the data<br>reader = vtk.vtkStructuredPointsReader()<br>reader.SetFileName(sys.argv[1])<br>reader.Update()<br><br>#Create arrows<br>arrow = vtk.vtkArrowSource()<br><br>#Mask input
points<br>maxnpts=5000<br>mask_pts = vtk.vtkMaskPoints()<br>mask_pts.SetOnRatio( 10 );<br>mask_pts.RandomModeOn();<br>mask_pts.SetMaximumNumberOfPoints(maxnpts);<br>mask_pts.SetInputConnection( reader.GetOutputPort() );<br>mask_pts.Update()<br><br>#Create glyphs<br>glyph = vtk.vtkGlyph3D()<br>glyph.ScalingOn();<br>glyph.SetScaleFactor(1.35);<br>glyph.SetColorModeToColorByScale();<br>glyph.SetScaleModeToScaleByScalar();<br>glyph.SetVectorModeToUseVector();<br>glyph.SetInputConnection( mask_pts.GetOutputPort() );<br>glyph.SetSource( arrow.GetOutput() );<br>glyph.OrientOn();<br><br>glyphmapper = vtk.vtkPolyDataMapper()<br>glyphmapper.SetInputConnection(glyph.GetOutputPort());<br>glyphactor = vtk.vtkActor()<br>glyphactor.SetMapper(glyphmapper)<br><br># Create the standard renderer, render window and interactor<br>ren = vtk.vtkRenderer()<br>renWin = vtk.vtkRenderWindow()<br>renWin.AddRenderer(ren)<br><br>iren =
vtk.vtkRenderWindowInteractor()<br>iren.SetRenderWindow(renWin)<br>iren.AddObserver("KeyPressEvent", Keypress)<br><br>ren.AddActor(glyphactor)<br><br>ren.SetBackground(1.0, 1.0, 1.0)<br>renWin.SetSize(600, 600)<br>renWin.Render()<br><br>def CheckAbort(obj, event):<br> if obj.GetEventPending() != 0:<br> obj.SetAbortRender(1)<br> <br>renWin.AddObserver("AbortCheckEvent", CheckAbort)<br><br>iren.Initialize()<br>renWin.Render()<br>iren.Start()<p> 
<hr size=1>Never miss a thing. <a href="http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs"> Make Yahoo your homepage.</a>