[vtkusers] converting vtkGraph to boostGraph to use with OpenGraphFixedTracking from D. Doria

Dr. Roman Grothausmann grothausmann.roman at mh-hannover.de
Wed Feb 6 09:30:19 EST 2013


Dear mailing list members,


How can I use a vtkGraph as a boostGraph which is needed for 
OpenGraphFixedTracking from D. Doria 
(http://www.midasjournal.org/browse/publication/828)?
I looked at vtkBoostBreadthFirstSearch.cxx and included vtkBoostGraphAdapter.h 
(see below) and copied it to the project dir (seems this header-file is not 
installed with VTK, why?) but I still get an error:

error: invalid user-defined conversion from ‘vtkGraph*’ to ‘const Graph& {aka 
const boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, 
boost::no_property, EdgeVisibility>&}’ [-fpermissive]

What am I missing?

Any help or hints are very much appreciated
Roman

______________________________________


#include "vtkBoostGraphAdapter.h"

#include <vtkXMLPolyDataReader.h>//for vtp-files (cannot contain 3D cells?)
#include <vtkPolyDataToGraph.h>

#include <vtkGraphToPolyData.h>
#include <vtkXMLPolyDataWriter.h>//for vtp-files

...

   // Read the graph
   //Graph graph = ReadGraph(inputFileName);

   vtkSmartPointer<vtkXMLPolyDataReader> reader = 
vtkSmartPointer<vtkXMLPolyDataReader>::New();

   //reader->SetFileName(inputFileName);
   reader->SetFileName(argv[1]);
   reader->Update();

   vtkSmartPointer<vtkPolyDataToGraph> polyDataToGraphFilter= 
vtkSmartPointer<vtkPolyDataToGraph>::New();
   polyDataToGraphFilter->SetInputConnection(reader->GetOutputPort());
   polyDataToGraphFilter->Update();

   vtkGraph* graph= polyDataToGraphFilter->GetOutput();

   //vtkBoostUndirectedGraph g(graph);

   //vtkUndirectedGraph *g = vtkUndirectedGraph::SafeDownCast(graph);
   //Graph openedGraph = OpenGraphFixedTracking(g, numberOfIterations);
   //Graph openedGraph = OpenGraphFixedTracking(boost::graph_traits<graph>, 
numberOfIterations);
   Graph openedGraph = OpenGraphFixedTracking(graph, numberOfIterations);
   //WriteGraph(openedGraph, outputFileName);

   vtkSmartPointer<vtkGraphToPolyData> graphToPolyData= 
vtkSmartPointer<vtkGraphToPolyData>::New();
   graphToPolyData->SetInput(openedGraph);
   graphToPolyData->Update();

   vtkSmartPointer<vtkXMLPolyDataWriter> writer= 
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
   //writer->SetFileName(outputFileName);
   writer->SetFileName(argv[2]);
   writer->SetInputConnection(graphToPolyData->GetOutputPort());
   writer->Write();


-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-9574
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GraphOpeningTrackingExample_01.cxx
Type: text/x-c++src
Size: 3412 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130206/895258ce/attachment.cxx>


More information about the vtkusers mailing list