[vtkusers] Casting output of vtkExtractSelection

Jeff Baumes jeff.baumes at kitware.com
Wed Apr 21 09:07:35 EDT 2010


On Tue, Apr 20, 2010 at 7:25 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> 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?

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



More information about the vtkusers mailing list