Build an desktop application using vtk

Hi,

I’m going to create an application for windows and macOS. I want to use the vtk library to visualize some data in this application. I’m not sure which framework to use to create my GUI. Can anybody tell me what will be the easiest way to do it?

I know pretty much java, but I haven’t understood how to call from java the vtk functions and classes…
Activiz seems to be a good option in C# but I can’t find how much does it cost ?

Last question, does someone kown a good tutorial or explanation to help me in my adventure?

Thanks,

I’d recommend Qt myself. VTK does support wrapping in Java, but I’m not familiar with it myself. @Sebastien_Jourdain @toddy

Hi @FrancoisW
You haven’t said if your application is to be open source or commercial.

If you go down the C++ route, using QT for commercial purposes requires a license but Paraview provides an example of how to do it. Otherwise you can use wxWidgets and find your own way. Also setting VTK_MODULE_ENABLE_VTK_GUISupportMFC=ON in cmake generates a vtkMFCWindow class in the source, which shows how to wrap vtkWin32OpenGLRenderWindow.

AFAIK Activiz licenses cost €500 to €1000 per annum and Activiz doesn’t handle string conversion to/from UTF-8 for VTK, so you’re stuck with ANSI text only.

If you’re already familiar with Java that might be your best bet. You can build VTK with VTK_WRAP_JAVA=ON and study some of the examples.
https://vtk.org/Wiki/VTK/Java_Wrapping

You have to create/compile the VTK jar manually on Windows. VTK 9 and Java- vtk.jar not automatically generated. Also location of wrapper dlls - #19 by toddy

FYI Fixed VTK Java Wrappers on macOS

Hi @toddy,

First, thanks for your very usefull answer.
My application won’t be open source, I’m not sure I’ll chose QT.
I’ve seen I can “find my own way” using wxWidget, but I find the “look and feel” of this framework a litte bit outdated.

Before asking this question, I was almost convinced to use Java. Your answer conforts me in my opinion. But generate the .jar on my own scares me a litte.
With your links, I’ll try to generate the vtk.jar, and see if I can do what I’d like to do.
Thanks again!

1 Like

Another option could be to use a web front-end using something like trame. But at the end, it depends on what you are comfortable with and what is your plan in term of deployment and futures opportunities.

Commercial Qt license is actually not required.

Qt can be obtained under an LGPL or a commercial license. The Qt company is encouraging (sometimes borderline bullying) users to purchase commercial license, but this is unnecessary for most companies. You can build a closed source commercial application using Qt’s LGPL license.

Requirements to fulfill if you use the LGPL license:

  • You must make publicly available all changes that you make to Qt itself. Since you just use Qt, you would normally never need to modify Qt and so there is nothing to disclose.
  • You must use Qt as a shared library (instead of statically linking it to your application). There are very rare occasions when linking mode makes significant practical difference and shared library is often the preferred linking option anyway, so it is generally very easy to fulfill this requirement.
  • There are a very few optional Qt components that is distributed using commercial or GPL license (charts, virtual keyboard, etc.). They are such niche features that it is highly unlikely that you would need to use them.
  • Allow users to replace Qt shared libraries. This is not an issue for desktop applications, because the files are stored on the user’s computer. On embedded systems, you need to let the user access Qt shared libraries.
  • Qt company recently made long-term support releases only available for commercial Qt licensees. This is just an inconvenience: if you run into any Qt bug that bothers your users then you need to upgrade to the latest Qt version, or you need to backport the fix manually to your Qt version.

Avoiding these slight inconveniences would probably worth $10 or so per developer per month for most companies, but the Qt company charges an exorbitant $300 per developer per month for a commercial license. Therefore, many (probably most) software development companies go with the LGPL license instead.

2 Likes

Good to know. I thought Qt was GPL or commercial.