Skip to content

VTK: New 2D API, Canvas and Charting Features

Since joining Kitware in October, one of the first projects I was tasked with is revamping the 2D charting capabilities in VTK and ParaView. At first I was a little daunted as it meant digging through many of the internals of VTK, and breaking an assumption that is made in many parts of VTK - that everything being rendered is 3D.

A large portion of this work is also being driven by the InfoVis features in VTK, along with project Titan that we work on with some really interesting people from Sandia National Labs. The project grew quite a bit from its original scope, and I have now added some new 2D API that uses OpenGL as a backend, with the scope to add further backends in the future. I have been working on optimizing the OpenGL case so that large data sets can be rendered interactively, and small data sets can be rendered with minimal lines of code whilst giving pleasing visual results.

ParaView with 2D API canvas based VTK chart

Then when considering user interaction with these 2D elements we decided that a higher level API would be useful, that could contain objects and propagate mouse events to items in the scene. So I set about prototyping a new canvas based API. At this point I had enough new infrastructure that I felt it was about time I got back to my original task of implementing some efficient, well rendered 2D charts in VTK. Once I had my initial prototype in place it was time to expose this in ParaView and see how everything fitted together. As you can see in the screenshot above, things are shaping up very nicely. The new chart is in the bottom right widget, the chart above is the existing chart widget.

I have really enjoyed my first few months at Kitware, and have found my first project both challenging and rewarding. It is great to be working on real problems that have a broader impact, and as I flesh out these features I will try to maintain cross platform, high performance interactive charts. I think I have also added some useful new 2D focused API that can also be rendered over the top of VTK's existing 3D visualizations, opening the door to some very exciting new views on data.

As a physicist I also feel it is interesting the symmetry - Qt adds 3D to a 2D toolkit, and at the same time I am adding 2D to a 3D toolkit. Hope you all have a Merry Christmas, and a Happy New Year. I will be tracking Santa with my son this evening!

Disclaimer: The opinions and musings in this post are mine, and not those of my employer. Any mistakes/inaccuracies are also mine, that said I would love to hear what people think of this new work.


No Trackbacks


Display comments as Linear | Threaded

JRM on :

JRMHi, this look great and I'm looking forward using it but as much attention is given to the technical side I think it would be good to spend a little time on how to make great plots. For example the fact that both axis are not starting at 0 is a big no-no.

The read of "Now You See It: Simple Visualization Techniques for Quantitative Analysis" by Stephen Few isn't a waste of time as it gives plenty of visual cues that help make good statistical representations

Marcus D. Hanwell on :

Marcus D. HanwellNot starting at zero is a big no-no in certain areas, but for many applications not starting at zero is essential. That is why I think that this should be a configurable, not everything interesting happens around zero. It is the same with having a nice mathematical plot where the axes cross in the center at zero - great for some areas, and not for others.

I have been working on maintaining a flexible approach to accommodate multiple applications. I wanted to post relatively early to solicit wider feedback while there is still some room to change things. I have been reading around, and my educational background is Physics where we are quite strict about our plots usually. I am looking at several sources for inspiration, and will see if I can get hold of the book you mention.

blondebuilder on :

blondebuilderI like this one. I am using VTK a lot, but none of its 2D functionality as I was not able to produce graphs in quality good enough for publishing. I am using Matplotlib for 2D now. Is development more focused on interactivity or visual features (tags, legends)?
In witch version will it be available? Cannot wait to try it out.
Merry Christmas

Marcus D. Hanwell on :

Marcus D. HanwellRight now I am very focused on interactivity, but visual features also remain important for this too. Using an abstraction for all rendering calls means that further backends can be added in the future, one I would especially like to add is SVG output for example although I cannot give a definite timeline of when that would be added.

If all goes to plan these features will be in the next minor release versions of VTK and ParaView. I will post updates here and on the mailing lists when I can give more definite time frames. All of the code is committed, and so available if you use CVS head right now.

Merry Christmas.

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Form options