[vtkusers] Casting output of vtkExtractSelection

David Doria daviddoria+vtk at gmail.com
Tue Apr 20 19:25:28 EDT 2010


I am trying to use the Kruskal minimum spanning tree filter. It is a
subclass of vtkSelectionAlgorithm, so I'm not sure how to get the
output. I tried this:

 vtkSmartPointer<vtkBoostKruskalMinimumSpanningTree> kruskalFilter =
    vtkSmartPointer<vtkBoostKruskalMinimumSpanningTree>::New();
 kruskalFilter->SetInputConnection(reader->GetOutputPort());
 kruskalFilter->SetEdgeWeightArrayName("Weights");
 kruskalFilter->Update();

 vtkSmartPointer<vtkExtractSelection> extractSelection =
     vtkSmartPointer<vtkExtractSelection>::New();
 extractSelection->SetInput(0, reader->GetOutput());
 extractSelection->SetInput(1, kruskalFilter->GetOutput());
 extractSelection->Update();

vtkTree* mst = vtkTree::SafeDownCast(extractSelection->GetOutput());

but mst is NULL. I also tried casting it to a vtkGraph and
vtkDirectedGraph, but they all end up NULL.

Anyone know how to get the output properly?

Thanks,

David



More information about the vtkusers mailing list