<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"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></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<vtkImageData> image1 =<br>
vtkSmartPointer<vtkImageData>::New();<br>
image1->SetExtent(0, 1, 0, 1, 0, 0);<br>
image1->SetNumberOfScalarComponents(3);<br>
image1->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<float*>(image1->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<vtkArrowSource> arrowSource =<br>
vtkSmartPointer<vtkArrowSource>::New();<br>
<br>
vtkSmartPointer<vtkGlyph3DMapper> glyph3Dmapper1 =<br>
vtkSmartPointer<vtkGlyph3DMapper>::New();<br>
glyph3Dmapper1->SetSourceConnection(arrowSource->GetOutputPort());<br>
glyph3Dmapper1->SetInputConnection(image1->GetProducerPort());<br>
glyph3Dmapper1->Update();<br>
<br>
vtkSmartPointer<vtkActor> actor1 =<br>
vtkSmartPointer<vtkActor>::New();<br>
actor1->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'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>