<div dir="ltr">This is great, thanks for sharing.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 2, 2016 at 3:37 AM Grothausmann, Roman Dr. <<a href="mailto:grothausmann.roman@mh-hannover.de">grothausmann.roman@mh-hannover.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just for those who stumble upon this. I got this working in both directions:<br>
<br>
<a href="https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtp2dot.cxx" rel="noreferrer" target="_blank">https://github.com/romangrothausmann/VTK-CLIs/blob/master/vtp2dot.cxx</a><br>
<a href="https://github.com/romangrothausmann/VTK-CLIs/blob/master/dot2vtp.cxx" rel="noreferrer" target="_blank">https://github.com/romangrothausmann/VTK-CLIs/blob/master/dot2vtp.cxx</a><br>
<br>
On 07/02/13 13:29, Jeff Baumes wrote:<br>
> The problem is that vtkGraph (the superclass) is abstract and does not specify<br>
> directionality. You should determine whether vtkPolyDataToGraph outputs a<br>
> vtkDirectedGraph or vtkUndirectedGraph and store the output in a variable of<br>
> that type before sending it to write_graph.<br>
><br>
> Jeff<br>
><br>
><br>
> On Thu, Feb 7, 2013 at 5:01 AM, Dr. Roman Grothausmann<br>
> <__grothausmann.roman@mh-hannover.de__> wrote:<br>
> Dear mailing list members,<br>
><br>
><br>
> It seems there is no vtk-Filter to save a vtkGraph as a graphviz dot-file.<br>
> Therefore, I tried to create a simple program for that but it fails during<br>
> compilation with:<br>
><br>
><br>
> /usr/include/boost/graph/graphviz.hpp:297:5: required from ‘void<br>
> boost::write_graphviz(std::ostream&, const Graph&, typename<br>
> boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag,<br>
> typename boost::graph_traits<Graph>::traversal_category>::value,<br>
> boost::graph::detail::no_parameter>::type) [with Graph = vtkGraph*; std::ostream<br>
> = std::basic_ostream<char>; typename<br>
> boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag,<br>
> typename boost::graph_traits<Graph>::traversal_category>::value,<br>
> boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]’<br>
> /home/grothama/vtk/graphviz-vtk/vtp2dot_01.cxx:47:38: required from here<br>
> /usr/include/boost/graph/graphviz.hpp:255:61: error: no type named<br>
> ‘directed_category’ in ‘struct boost::graph_traits<vtkGraph*>’<br>
> /usr/include/boost/graph/graphviz.hpp:256:42: error: no type named<br>
> ‘directed_category’ in ‘struct boost::graph_traits<vtkGraph*>’<br>
> make[2]: *** [CMakeFiles/vtp2dot_01.dir/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"))) {<br>
> std::cout << "The input should end with .vtp" << std::endl;<br>
> return -1;<br>
> }<br>
><br>
> if(!(strcasestr(argv[2],".dot"))) {<br>
> std::cout << "The input should end with .dot" << std::endl;<br>
> return -1;<br>
> }<br>
><br>
><br>
> vtkSmartPointer<vtkXMLPolyDataReader> reader =<br>
> vtkSmartPointer<vtkXMLPolyDataReader>::New();<br>
><br>
> //reader->SetFileName(inputFileName);<br>
> reader->SetFileName(argv[1]);<br>
> reader->Update();<br>
><br>
> vtkSmartPointer<vtkPolyDataToGraph> polyDataToGraphFilter=<br>
> vtkSmartPointer<vtkPolyDataToGraph>::New();<br>
> polyDataToGraphFilter->SetInputConnection(reader->GetOutputPort());<br>
> polyDataToGraphFilter->Update();<br>
><br>
> vtkGraph* graph= polyDataToGraphFilter->GetOutput();<br>
><br>
> std::ofstream fout(argv[2]);<br>
> boost::write_graphviz(fout, graph);<br>
><br>
><br>
> return EXIT_SUCCESS;<br>
> }<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. __+49 511 532-9574__<br>
><br>
> _______________________________________________<br>
> Powered by __www.kitware.com__<br>
><br>
> Visit other Kitware open-source projects at<br>
> __<a href="http://www.kitware.com/opensource/opensource.html__" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html__</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> __<a href="http://www.vtk.org/Wiki/VTK_FAQ__" rel="noreferrer" 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__" rel="noreferrer" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers__</a><br>
><br>
><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. +49 511 532-2900<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div>