vtkPolyData with text embedded.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

vtkPolyData with text embedded.

matheus_viana
Hi guys. Does anyone know if it is possible to save a polydata file with text embedded? Basically, I have a graph in 3D and I'd like to save also the label of each node. I know that there exist the vtkTextActor that is very useful to display texts in the scene, but I'm not sure if it might be useful for my purpose.

Many thanks,
Matheus
Reply | Threaded
Open this post in threaded view
|

Re: vtkPolyData with text embedded.

David Doria-2-3
On Tue, Feb 26, 2013 at 1:09 PM, matheus_viana <[hidden email]> wrote:
Hi guys. Does anyone know if it is possible to save a polydata file with text
embedded? Basically, I have a graph in 3D and I'd like to save also the
label of each node. I know that there exist the vtkTextActor that is very
useful to display texts in the scene, but I'm not sure if it might be useful
for my purpose.

Many thanks,
Matheus

A PolyData (.vtp) file simply stores a list of coordinates/points and their connectivity, along with any other information you want to store with each point/cell. So you cannot store the text as it would be seen with a vtkTextActor, but you can store the label in the PointData associated with the points in the PolyData. Something like this: http://www.vtk.org/Wiki/VTK/Examples/Cxx/VTKConcepts/Scalars where you would use some kind of a string array instead of the numeric arrays in that example. You would then be responsible for displaying those values yourself when you open the vtp file at a later time.

David
 

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: vtkPolyData with text embedded.

matheus_viana
Thanks for your help David. I understood your point, but the problem is that I'd like to send the file to a collaborator who is using Paraview to visualize the graph.

I found a solution (not so elegant) that could work, but instead of sending one file, I should send two files.

The first one correspond to the regular polydata file containing the edges and nodes.

The second one is an OBJ file that would be created by the method vtkOBJExporter. This file contains only the vtkTextActors for the labels which were rendered offline.

Thus it is possible to use Paraview to overlay the PolyData and Labels (OBJ file).

What do you think?
Reply | Threaded
Open this post in threaded view
|

Re: vtkPolyData with text embedded.

matheus_viana
David, I've just figured out another solution that seems to be better. One could use the class vtkVectorText and then include all the labels in the same PolyData file containing edges and nodes.
Reply | Threaded
Open this post in threaded view
|

Re: vtkPolyData with text embedded.

David Doria-2-3
On Tue, Feb 26, 2013 at 2:06 PM, matheus_viana <[hidden email]> wrote:
David, I've just figured out another solution that seems to be better. One
could use the class vtkVectorText and then include all the labels in the
same PolyData file containing edges and nodes

Just be careful with that - if you want to do any further processing on the data, you will now have lots of extraneous points/surfaces.

Are you working in VTK directly and then trying to export so your colleague can view in Paraview? Or are you also working in Paraview?

David

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: vtkPolyData with text embedded.

matheus_viana
Would have no problem because I'm working directly in VTK. The Paraview is just for visualizing the Graph. No further analyze will be done over this data.