[vtkusers] Titan and graph/tree Infoviz
Jeff Baumes
jeff.baumes at kitware.com
Sat Mar 27 19:26:17 EDT 2010
Try adding the lines
reader.OutputPedigreeIdsOn();
reader.GeneratePedigreeIdsOn();
This will add pedigree ids to your table, and the error should go
away. GroupLeafVertices needs an array with ids in it to help in
bookkeeping.
Jeff
On Fri, Mar 26, 2010 at 4:36 PM, Bladek, Anthony <Anthony.Bladek at pnl.gov> wrote:
> All,
> I am a new to vtk and the Titan extensions I am having trouble producing
> a tree visualization. Specifically, I am trying to use vtkGroupLeafVertices
> based upon a table of data. Much like the example shown in the slides from
> Information_Visualization_in_VTK.ppt (A Titan presentation) I have 3
> columns in a table and I want the first level of the tree (past the root) to
> be drawn from one column of the table and the next level to be drawn from
> another column. As far as I can find there are no examples on how to set up
> and use vtkGroupLeafVertices so I am at a bit of loss on how to start. I
> am using the java wrappers for VTK and here is what I have so far.
>
> //snip
> // read in the csv file
> vtkDelimitedTextReader reader = new
> vtkDelimitedTextReader();
> reader.DetectNumericColumnsOn();
> reader.SetFieldDelimiterCharacters(",");
> reader.SetFileName(OutputConnectionCountGraphCSVFileName);
> reader.SetHaveHeaders(true);
> reader.Update();
>
> // create a table
> vtkTable table = reader.GetOutput();
> int numCols = table.GetNumberOfColumns();
> System.out.println("number of columns: " + numCols);
> // turn it into a tree
> vtkTableToTreeFilter treeFilter = new
> vtkTableToTreeFilter();
> treeFilter.SetInputConnection(reader.GetOutputPort());
> treeFilter.Update();
> vtkTree tree = new vtkTree();
> tree = treeFilter.GetOutput();
>
> int vertCount = tree.GetNumberOfVertices();
> int edgeCount = tree.GetNumberOfEdges();
>
> // group the vertices here
> //don’t have actually any idea how to set this up.
> // code below produces error "Pedigree ids not assigned to
> vertices on input graph."
> // must be missing something…
> vtkGroupLeafVertices vertices = new
> vtk.vtkGroupLeafVertices();
> vertices.SetInputConnection(treeFilter.GetOutputPort());
> //input the tree
> vertices.SetInputArrayToProcess(0,0,0,0, "Session
> Count");//group by number of connections
> vertices.SetInputArrayToProcess(1,0,0,0, "Source"); // then
> by source
> vertices.SetInputArrayToProcess(1,0,0,0, "Destination");
> then by destination
> vertices.Update();
>
> //…. Put the vertices into the layout or view or ??
> // end snip
>
> Any help or any example to follow would be greatly appreciated.
>
> Thanks…
>
> Anthony
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list