<div dir="ltr">The problem is that vtkGraph (the superclass) is abstract and does not specify directionality. You should determine whether vtkPolyDataToGraph outputs a vtkDirectedGraph or vtkUndirectedGraph and store the output in a variable of that type before sending it to write_graph.<div>
<br></div><div>Jeff</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 7, 2013 at 5:01 AM, Dr. Roman Grothausmann <span dir="ltr"><<a href="mailto:grothausmann.roman@mh-hannover.de" target="_blank">grothausmann.roman@mh-hannover.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear mailing list members,<br>
<br>
<br>
It seems there is no vtk-Filter to save a vtkGraph as a graphviz dot-file. Therefore, I tried to create a simple program for that but it fails during compilation with:<br>
<br>
<br>
/usr/include/boost/graph/<u></u>graphviz.hpp:297:5: required from ‘void boost::write_graphviz(std::<u></u>ostream&, const Graph&, typename boost::enable_if_c<boost::is_<u></u>base_and_derived<boost::<u></u>vertex_list_graph_tag, typename boost::graph_traits<Graph>::<u></u>traversal_category>::value, boost::graph::detail::no_<u></u>parameter>::type) [with Graph = vtkGraph*; std::ostream = std::basic_ostream<char>; typename boost::enable_if_c<boost::is_<u></u>base_and_derived<boost::<u></u>vertex_list_graph_tag, typename boost::graph_traits<Graph>::<u></u>traversal_category>::value, boost::graph::detail::no_<u></u>parameter>::type = boost::graph::detail::no_<u></u>parameter]’<br>
/home/grothama/vtk/graphviz-<u></u>vtk/vtp2dot_01.cxx:47:38: required from here<br>
/usr/include/boost/graph/<u></u>graphviz.hpp:255:61: error: no type named ‘directed_category’ in ‘struct boost::graph_traits<vtkGraph*><u></u>’<br>
/usr/include/boost/graph/<u></u>graphviz.hpp:256:42: error: no type named ‘directed_category’ in ‘struct boost::graph_traits<vtkGraph*><u></u>’<br>
make[2]: *** [CMakeFiles/vtp2dot_01.dir/<u></u>vtp2dot_01.cxx.o] Error 1<br>
<br>
<br>
Am I missing something in my code (see attached zip)?<br>
<br>
Any help or hints are very much appreciated<br>
Roman<br>
_____<br>
<br>
<br>
////convert a graph stored in a vtp-file to a dot-file (graphviz)<br>
<br>
<br>
#include <vtkSmartPointer.h><br>
#include <vtkXMLPolyDataReader.h>//for vtp-files<br>
#include <vtkPolyDataToGraph.h><br>
<br>
#include "vtkBoostGraphAdapter.h"<br>
#include <boost/graph/graphviz.hpp> // For writing graphs to a file<br>
<br>
<br>
int main(int argc, char* argv[]){<br>
if( argc != 3 )<br>
{<br>
std::cerr << "Usage: " << argv[0];<br>
std::cerr << " inputMesh";<br>
std::cerr << " outputFile";<br>
std::cerr << std::endl;<br>
return EXIT_FAILURE;<br>
}<br>
<br>
if(!(strcasestr(argv[1],".vtp"<u></u>))) {<br>
std::cout << "The input should end with .vtp" << std::endl;<br>
return -1;<br>
}<br>
<br>
if(!(strcasestr(argv[2],".dot"<u></u>))) {<br>
std::cout << "The input should end with .dot" << std::endl;<br>
return -1;<br>
}<br>
<br>
<br>
vtkSmartPointer<<u></u>vtkXMLPolyDataReader> reader = vtkSmartPointer<<u></u>vtkXMLPolyDataReader>::New();<br>
<br>
//reader->SetFileName(<u></u>inputFileName);<br>
reader->SetFileName(argv[1]);<br>
reader->Update();<br>
<br>
vtkSmartPointer<<u></u>vtkPolyDataToGraph> polyDataToGraphFilter= vtkSmartPointer<<u></u>vtkPolyDataToGraph>::New();<br>
polyDataToGraphFilter-><u></u>SetInputConnection(reader-><u></u>GetOutputPort());<br>
polyDataToGraphFilter->Update(<u></u>);<br>
<br>
vtkGraph* graph= polyDataToGraphFilter-><u></u>GetOutput();<br>
<br>
std::ofstream fout(argv[2]);<br>
boost::write_graphviz(fout, graph);<br>
<br>
<br>
return EXIT_SUCCESS;<br>
}<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
-- <br>
Dr. Roman Grothausmann<br>
<br>
Tomographie und Digitale Bildverarbeitung<br>
Tomography and Digital Image Analysis<br>
<br>
Institut für Funktionelle und Angewandte Anatomie, OE 4120<br>
Medizinische Hochschule Hannover<br>
Carl-Neuberg-Str. 1<br>
D-30625 Hannover<br>
<br>
Tel. <a href="tel:%2B49%20511%20532-9574" value="+495115329574" target="_blank">+49 511 532-9574</a><br>
</font></span><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>
<br></blockquote></div><br></div>