[vtkusers] Casting output of vtkExtractSelection

David Doria daviddoria+vtk at gmail.com
Wed Apr 21 11:31:48 EDT 2010


> vtkExtractSelection currently does not support graphs. Marcus may
> actually be working on a fix for this in the coming days while fixing
> an unrelated issue. For now you can use vtkExtractSelectedGraph.
>
> Jeff
>

Thanks Jeff, I wasn't aware of that filter.

However, I now have the output as a vtkDirectedGraph, but not yet a vtkTree.

The output of the following is:

  cout << "selection output is type: " <<
extractSelectedGraph->GetOutput()->GetClassName() << endl;

  cout << "selection output has " <<
extractSelectedGraph->GetOutput()->GetNumberOfVertices() << "
vertices." << endl;
  cout << "selection output has " <<
extractSelectedGraph->GetOutput()->GetNumberOfEdges() << " edges." <<
endl;

  vtkSmartPointer<vtkTree> mst =
      vtkSmartPointer<vtkTree>::New();
  mst->CheckedShallowCopy(extractSelectedGraph->GetOutput());

  cout << "mst is of type " << mst->GetClassName() << endl;
  cout << "mst has " << mst->GetNumberOfVertices() << " vertices." << endl;
  cout << "mst has " << mst->GetNumberOfEdges() << " edges." << endl;


selection output is type: vtkUndirectedGraph
selection output has 12 vertices.
selection output has 11 edges.
mst is of type vtkTree
mst has 0 vertices.
mst has 0 edges.

It is an MST algorithm, so the output should definitely be a vtkTree, right?

Thanks,

David



More information about the vtkusers mailing list