[vtkusers] Titan and graph/tree Infoviz

Bladek, Anthony Anthony.Bladek at pnl.gov
Fri Mar 26 16:36:42 EDT 2010


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100326/2a8001ca/attachment.htm>


More information about the vtkusers mailing list