<div dir="ltr">You can easily test this with paraview. Save your image as vtkImageData and import into paraview.<br><br>After importing click Glyph toolbar button on top right, then you can play around with different settings in the lower left window.<br>
<br>This will give you some idea.<br><br>Jothy<br><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 4:55 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I have an image with 3d scalars:<br>
<br>
  // Create an image<br>
  vtkSmartPointer&lt;vtkImageData&gt; image1 =<br>
    vtkSmartPointer&lt;vtkImageData&gt;::New();<br>
  image1-&gt;SetExtent(0, 1, 0, 1, 0, 0);<br>
  image1-&gt;SetNumberOfScalarComponents(3);<br>
  image1-&gt;SetScalarTypeToFloat();<br>
<br>
  int coord[3]; float* pixel;<br>
<br>
  // Fill the image with vectors<br>
  coord[0] = 0; coord[1] = 0; coord[2] = 0;<br>
  pixel = static_cast&lt;float*&gt;(image1-&gt;GetScalarPointer(coord));<br>
  pixel[0] = 1.0; pixel[1] = 0.0; pixel[2] = 0.0;<br>
<br>
... fill the rest of the image<br>
<br>
<br>
Now I want to glyph arrows to show the vectors:<br>
<br>
I tried this:<br>
<br>
  vtkSmartPointer&lt;vtkArrowSource&gt; arrowSource =<br>
    vtkSmartPointer&lt;vtkArrowSource&gt;::New();<br>
<br>
  vtkSmartPointer&lt;vtkGlyph3DMapper&gt; glyph3Dmapper1 =<br>
    vtkSmartPointer&lt;vtkGlyph3DMapper&gt;::New();<br>
  glyph3Dmapper1-&gt;SetSourceConnection(arrowSource-&gt;GetOutputPort());<br>
  glyph3Dmapper1-&gt;SetInputConnection(image1-&gt;GetProducerPort());<br>
  glyph3Dmapper1-&gt;Update();<br>
<br>
  vtkSmartPointer&lt;vtkActor&gt; actor1 =<br>
    vtkSmartPointer&lt;vtkActor&gt;::New();<br>
  actor1-&gt;SetMapper(glyph3Dmapper1);<br>
<br>
but it colors the arrows rather than orients them. It looks like<br>
vtkGlyph3DMapper wants to use the Vectors attribute to orient the<br>
glyphs, but my ImageData doesn&#39;t have a Vectors since everything is in<br>
the Scalars (but they are not scalars, because they are 3d).<br>
<br>
So I guess two things would solve it:<br>
1) How do you set the vectors of an imageData to be its scalars?<br>
2) How could I tell vtkGlyph3DMapper to orient the arrows by the image scalars?<br>
<br>
Thanks,<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Research Scholar<br>Dept. of Medical Physics<br>Clatterbridge Centre for Oncology<br>UK<br></div><br>
</div>