Discussion:
[vtkusers] Questions about vtkGraphLayoutView
emlidal
2012-06-28 12:28:07 UTC
Permalink
Dear all.
I've been experimenting a little with vtkGraphLayoutView in order to
visualize and interact with a (small) tree-graph. I'm working in c++ and
using VTK 5.8.

I've manage to get the basic stuff up and running, i.e., construct a
vtkGraph and visualize it. I've also managed to add interaction, so that I
can select one or more of the nodes in the graph, from this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Graphs/SelectedVerticesAndEdges .
For simplicity we can say the nodes in the tree represent images and the
tree represent some relationship between these images.

However I have some questions that I cannot find answer to, not in the
documentation, the examples or reading the source code.

1. Is it possible to use my own "glyph" for the graph nodes? Today I'm using
my own vtkRenderedGraphRepresentation and there I set the glyph type (using
SetGlyphType(...)), in my case I use glyph type 2. However, what really I
want is to be able to specify my own glyph type, in my case an shrunken
image of the image stored at each graph node. Is this possible, and if so
any hints of how do I go about to accomplish this?

2. Is it possible to specify uneven distance between the nodes in the graph
layout? Say for instance that my tree has only two branches and one branch
as double the amount of nodes than the other branch, something like this:
O
/ \
O O
| |
O O
|
O
|
O

Is it possible to render the graph so that the leaf nodes of the two
branches are on the same "depth-level"? Something like this:
O
/ \
O O
| |
O |
| |
O |
| |
O O

3. The interaction/selection style I'm using is based on
vtkInteractorStyleRubberBand2D and this is nice for making a rectangular
selection in the graph. However, I want to make a freeform lasso selection,
i.e., draw a closed curve around the nodes I want to select (and, thus, not
be limited to rectangular selection only). Is there a lasso
interaction/selection style I have missed or are there any examples of how
to implement this myself?

Sincerely,
Endre


--
View this message in context: http://vtk.1045678.n5.nabble.com/Questions-about-vtkGraphLayoutView-tp5714286.html
Sent from the VTK - Users mailing list archive at Nabble.com.
Jeff Baumes
2012-06-28 17:09:40 UTC
Permalink
Endre,
Post by emlidal
1. Is it possible to use my own "glyph" for the graph nodes? Today I'm using
my own vtkRenderedGraphRepresentation and there I set the glyph type (using
SetGlyphType(...)), in my case I use glyph type 2. However, what really I
want is to be able to specify my own glyph type, in my case an shrunken
image of the image stored at each graph node. Is this possible, and if so
any hints of how do I go about to accomplish this?
This is not directly supported. One approach would be to look into
vtkRenderedGraphRepresentation and replace the glyph filter with your own
filter that will produce a textured image at each desired location.

2. Is it possible to specify uneven distance between the nodes in the graph
Post by emlidal
layout? Say for instance that my tree has only two branches and one branch
O
/ \
O O
| |
O O
|
O
|
O
Is it possible to render the graph so that the leaf nodes of the two
O
/ \
O O
| |
O |
| |
O |
| |
O O
The tree layout does not support this. You are free to run
vtkTreeLayoutStrategy manually, get the output, and tweak the positions, or
create a subclass of vtkTreeLayoutStrategy that performs how you want it
to. If you run the graph layout yourself, make sure to set the layout
strategy to PassThrough on the representation, which will not run any
additional layout.

3. The interaction/selection style I'm using is based on
Post by emlidal
vtkInteractorStyleRubberBand2D and this is nice for making a rectangular
selection in the graph. However, I want to make a freeform lasso selection,
i.e., draw a closed curve around the nodes I want to select (and, thus, not
be limited to rectangular selection only). Is there a lasso
interaction/selection style I have missed or are there any examples of how
to implement this myself?
I am not aware of lasso selection implemented in VTK.

Jeff
David Doria
2012-06-28 17:25:00 UTC
Permalink
Post by Jeff Baumes
Post by emlidal
3. The interaction/selection style I'm using is based on
vtkInteractorStyleRubberBand2D and this is nice for making a rectangular
selection in the graph. However, I want to make a freeform lasso selection,
i.e., draw a closed curve around the nodes I want to select (and, thus, not
be limited to rectangular selection only). Is there a lasso
interaction/selection style I have missed or are there any examples of how
to implement this myself?
I am not aware of lasso selection implemented in VTK.
It sounds like this might be pretty close to a lasso selection?

http://www.vtk.org/doc/nightly/html/classvtkImplicitSelectionLoop.html#details

Perhaps you could use
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/ContourWidget to
produce the points for it?

If you look into vtkImplicitSelectionLoop, it would be great if you
could add an example to the wiki.

David
emlidal
2012-07-03 09:40:45 UTC
Permalink
Thank you for your reply Jeff. I have some follow up questions if I may.
Post by Jeff Baumes
Endre,
Post by emlidal
1. Is it possible to use my own "glyph" for the graph nodes? Today I'm using
my own vtkRenderedGraphRepresentation and there I set the glyph type (using
SetGlyphType(...)), in my case I use glyph type 2. However, what really I
want is to be able to specify my own glyph type, in my case an shrunken
image of the image stored at each graph node. Is this possible, and if so
any hints of how do I go about to accomplish this?
This is not directly supported. One approach would be to look into
vtkRenderedGraphRepresentation and replace the glyph filter with your own
filter that will produce a textured image at each desired location.
I've had a peek into vtkRenderedGraphRepresentation before and it was a
little confusing to understand what to change. As far as I can see I think
that I need to create a new filter to replace the vtkGraphToGlyphs filter in
vtkRenderedGraphRepresentation, is this correct?
Post by Jeff Baumes
2. Is it possible to specify uneven distance between the nodes in the graph
Post by emlidal
layout? Say for instance that my tree has only two branches and one branch
O
/ \
O O
| |
O O
|
O
|
O
Is it possible to render the graph so that the leaf nodes of the two
O
/ \
O O
| |
O |
| |
O |
| |
O O
The tree layout does not support this. You are free to run
vtkTreeLayoutStrategy manually, get the output, and tweak the positions, or
create a subclass of vtkTreeLayoutStrategy that performs how you want it
to. If you run the graph layout yourself, make sure to set the layout
strategy to PassThrough on the representation, which will not run any
additional layout.
I'll think I'll go for the subclassing, is there any reason for not doing
that?

Endre


--
View this message in context: http://vtk.1045678.n5.nabble.com/Questions-about-vtkGraphLayoutView-tp5714286p5714410.html
Sent from the VTK - Users mailing list archive at Nabble.com.

Loading...