Paraview Java

Hello Everyone,
I am considering using Paraview as a data viewer in a Java project, so in a Java dedicated window (probably a Java Swing JFrame/etc) and I was wondering whether it was possible and if there were a dedicated tutorial about that (at least for a hello world).

I have configured my Paraview build with the VTK Java option, and it indeed created a few *.java files in the …\pv\pv\VTK\Wrapping\Java folder.
But it’s a bit unclear to me whether it’s only a VTK option or a Paraview one too.
When I configured the build the CMake it looked like it made something about both VTK and Paraview, so it looks promising, but I don’t know for sure.
image

So my questions are:

  • is there a java Paraview wrapper or is it just the VTK layer?
  • In python there is the paraview.simple module, and so is there an equivalent in Java by any chance?

Also, I would have thought there might be a *.jar generated but I couldn’t find any (only .java)
=> Is there an official java Paraview Hello World of some sort available?

Thanks in advance!

Hi @Julien

I’m afraid Java wrapping of VTK is not usable at ParaView level. I see two ways forward.

  1. pvpython

Use ParaView python bindings as ParaViewWeb does in order to use ParaView in your application. You probably can call on python from Java.

https://kitware.github.io/paraview-docs/latest/python/

  1. Use libf3d java wrapping. F3D is a VTK based 3D viewer that may be what you are looking for if you just want to visualize data. No processing of data possible.

hth

1 Like

Well, thank you very much already! I am going to take a look at the two options your are referring to.

I had already guessed I could probably use a python wrapping layer in between but I would have to have a look at the details and see if it would not be too hard to maintain (and possibly a performance trade off, but probably nothing noticeable as it would be just a high level binding anyway)

On the other hand I guess Paraview has an API directly in C++, hasn’t it? (with similar functionalities as the python version, which is probably just calling the C++ API underneath?)
That would mean I could do a (limited) Java binding with JNI (or maybe even JNA over the standards DLL, I don’t know)

Do you confirm it would be easy enough and realistic to build and maintain such JNI binding? (I have already made a JAWT binding of a basic in house 3D engine and it works well in our Java Swing application)
Is there a known C++ good/simple example of an instanciation of a Paraview 3d window you would be aware of? I am going to have a look at that as well.

Thanks! :slight_smile:

PS: our program will need a 3D viewer with some features as slice planes, animations and so on.

Yes

Do you confirm it would be easy enough and realistic to build and maintain such JNI binding?

This will be a very hard work and unless it is automated and part of ParaView, a nightmare to maintain.

Is there a known C++ good/simple example of an instanciation of a Paraview 3d window you would be aware of?

I’m afraid not.

1 Like

Oh, neat, now this looks promising! …

… shucks! :cry:

All right!

So, probably python binding :smiley:
Still, I am wondering what the python binding implementation looks like, as I imagine it could be used as a model to generate a java version look alike … I will have a quick look too, just in case.

Thank you very much!