<br>I am posting some more code here. I use this in order to display the trees I generate in 2D.<br>The vertex array, ChannelColors, and Edge Weights are defined somewhere else. This code displays the bfs tree. But if I replace the code under LINE X below in order to display Kruskal's MST with:<br>
<br>view->AddRepresentationFromInput(mst->GetOutput());<br><br>I am getting the following error message:<br>"Need input data to render labels (2)"<br><br>But I am not getting any error messages for the same labels while displaying the bfs tree.<br>
<br>I tried other ways of displaying too.<br>Please help.<br>Thanks alot.<br><br>---- Display Code ---<br><br> VTK_CREATE(vtkBoostBreadthFirstSearchTree, bfsTree);<br> bfsTree->SetInput(g);<br><br> //Create a graph layout view<br>
<br> vtkGraphLayoutView* view = vtkGraphLayoutView::New();<br> view->SetLayoutStrategyToPassThrough();<br><br> //LINE X<br>-----> view->AddRepresentationFromInput(bfsTree->GetOutput());<br> view->SetVertexLabelArrayName("Label");<br>
view->SetVertexLabelVisibility(true);<br> view->SetVertexColorArrayName("ChannelColors");<br> view->SetColorVertices(true);<br> view->SetEdgeColorArrayName("ChannelColors");<br>
view->SetColorEdges(true);<br> //view->SetLayoutStrategyToSimple2D();<br><br> VTK_CREATE(vtkRenderWindow, window);<br> window->SetSize(1000, 1000);<br> <br> view->SetupRenderWindow(window);<br>
view->GetRenderer()->ResetCamera();<br> window->GetInteractor()->Start();<br><br><br><br><div class="gmail_quote">On Tue, Dec 30, 2008 at 10:42 AM, Aytekin Vargun <span dir="ltr"><<a href="mailto:varguna@gmail.com">varguna@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks a lot Jeff,<br>It looks like I had several versions of VTK and this was causing problems.<br>
<br>Now I have another problem. I am trying to use minimum spanning tree programs. I first tried to use vtkBoostPrimMinimumSpanningTree but I am getting the following error message:<br>
<br>"The Prim minimal spanning tree filter is still under development... Use at your own risk." <br><br>I checked where the error message is and then assumed that I was getting this message since the implementation is not complete yet. But should I still see some output on the screen?<br>
<br>I then tried to use vtkKruskalMinimumSpanningTree which looks like in better shape (whose output is a vtkSelectionAlgorithm). But I am failed to display its output since its output is not a tree but a forest whereas Prim's version produces a vtkTree . Then how can I display each subtree? One way of doing this probably is to cast the result to a graph and then display the resulting graph.<br>
<br>I will greatly appreciate if anyone shares his/her experiences.<br>Thanks a lot.<br><br>Here is a simplified piece of code I am trying to run:<br><br> vtkMutableUndirectedGraph* g=vtkMutableUndirectedGraph::New();<br>
<br> // This is used for finding minimum-spanning trees<br> vtkIntArray* edgeWeightsArr = vtkIntArray::New();<br> edgeWeightsArr->SetName("EdgeWeights");<br> <br> VTK_CREATE(vtkRenderer, ren);<br>
<br> VTK_CREATE(vtkPoints, pts);<br> g->AddVertex();<br> pts->InsertNextPoint(0, 1, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.5, 1, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.25, 0.5, 0);<br>
g->AddVertex();<br> pts->InsertNextPoint(0, 0, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.5, 0, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(1, 0, 0);<br> g->AddVertex();<br> pts->InsertNextPoint(0.75, 0.5, 0);<br>
g->SetPoints(pts);<br><br> g->AddEdge(0, 1);<br> edgeWeightsArr->InsertNextValue(1);<br> g->AddEdge(0, 2);<br> edgeWeightsArr->InsertNextValue(1);<br> g->AddEdge(1, 2);<br> edgeWeightsArr->InsertNextValue(1);<br>
g->AddEdge(2, 3);<br> edgeWeightsArr->InsertNextValue(1);<br> g->AddEdge(2, 4);<br> edgeWeightsArr->InsertNextValue(1);<br> g->AddEdge(3, 4);<br> edgeWeightsArr->InsertNextValue(1);<br><br> g->GetEdgeData()->AddArray(edgeWeightsArr);<br>
<br> //VTK_CREATE(vtkBoostPrimMinimumSpanningTree,mst);<br> VTK_CREATE(vtkBoostKruskalMinimumSpanningTree,mst);<br> mst->SetInput(g);<br> mst->SetEdgeWeightArrayName("EdgeWeights");<br> mst->Update();<br>
<br> // HOW TO DISPLAY<br><br><br><br><div class="gmail_quote">On Tue, Dec 23, 2008 at 3:14 PM, Jeff Baumes <span dir="ltr"><<a href="mailto:jeff.baumes@kitware.com" target="_blank">jeff.baumes@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>> When I compile the sample file, I get the first error for the following<br>
> line:<br>
> VTK_CREATE(vtkBoostBiconnectedComponents, biconn);<br>
><br>
> (On CMake, I had set VTK_USE_BOOST set to ON when building VTK)<br>
<br>
</div>First, make sure that your app is linking against vtkInfovis. If it<br>
is, it appears that the Boost algorithms are not being compiled into<br>
the vtkInfovis library you are using. Ensure that the vtkInfovis you<br>
are linking against is the one in the build where you turned<br>
VTK_USE_BOOST on. In Visual Studio, you can check your VTK build by<br>
looking at the source files under vtkInfovis. Make sure the vtkBoost*<br>
files are there.<br>
<font color="#888888"><br>
Jeff<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>My web page: <a href="http://www.cs.rpi.edu/%7Evargua" target="_blank">http://www.cs.rpi.edu/~vargua</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>My web page: <a href="http://www.cs.rpi.edu/~vargua">http://www.cs.rpi.edu/~vargua</a><br>