Best way of visualizing exported animated scenes

Unfortunately, I believe I cannot share the original .vtkjs as it includes the patient geometry. However, I have created an equivalent .vtkjs from synthetic data, I hope it is still useful. I share it as a drive link as I had issues uploading it directly to this discussion.

On the other hand, I don’t know if I fully understand what you mean by cleaning the .vtkjs file.

2 Likes

Thanks for sharing your data and that is indeed what I think. So if you unzip the vtkjs file (rename + unzip) you will find an index.json at the root of the package.

The screenshot below was taken from your dataset and if you go into the animation structure, you can for each timeSteps either remove or empty the camera entry.

HTH,

Seb

Modified version: index.json.zip (402.2 KB)

Ok, I have slightly modified the vtkjs_helper.py file to erase all camera data before saving the root index.json file. Now it works like a charm. Thanks to everyone involved in this thread! Here’s the updated file in case anyone else is interested.

vtkjs_helper.py (10.7 KB)

Finally, I just wanted to ask how I can best contribute to fixing the bug involving the root index.json ordering and closing. I have limited experience contributing to such large projects, so should I report the bug or shall I attempt a merge request with my updated code?

This is great to hear.

Yes, please create a merge request directly (flagging this discourse discussion is enough).

I’m making an MR for you but why did you do that change?

+                #objNameToUrls.GetUrlName(currentObjName), str(timeStep).zfill(3), "index.json"
                 objNameToUrls.GetUrlName(currentObjName), str(timeStep), "index.json"

That part I think was to get the timesteps in proper order. Was 3 too small?

At first, I tried ordering the folders by adding extra digits. But I was not sure in which part of the code the folders were actually named so I realized it was much simpler to just use natural ordering for the folders (the functions I added on the top). It seems that I forgot to delete the previous failed approach.

Great, sorry I miss read my diff. :wink:

1 Like

If you agree with that change on my MR, I can merge it. Down the road we would need an option on PV to toggle remove_camera_animation flag.

@Julien_Finet do you think someone on your team could tackle it once that VTK get picked up by PV?

It’s doable indeed.

Sorry to bother you again. I was trying to export some vorticity-related volumetric animations alongside the pathlines and I keep getting this error.

Generic Warning: In C:\glr\builds\paraview\paraview-ci\build\superbuild\paraview\src\Remoting\Animation\vtkSMAnimationSceneWebWriter.cxx, line 216
Failed to bundle vtkjs file

Traceback (most recent call last):
  File "C:\Program Files\ParaView 5.10.0-RC2-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\vtkmodules\web\vtkjs_helper.py", line 197, in zipAllTimeSteps
    addDirectoryToZip(
  File "C:\Program Files\ParaView 5.10.0-RC2-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\vtkmodules\web\vtkjs_helper.py", line 118, in addDirectoryToZip
    rootTimeStepSection[objName]["actor"] = obj["actor"]
KeyError: 'actor'
debug: In unknown, line 0
debug: Save animated scene failed!

In principle it should be possible to export volumetric renderings, right?

Indeed, it should be possible.
You might have to debug what’s going on. Maybe print out obj to see what’s available in it.

Ok, it seems that vtkjs_helper expects the key "actor" but in the volume rendering index.json it says "volume" instead. Is it as easy as changing the key from "volume" to "actor" in each index.json file?


image

1 Like

@Adrien_Boucaud

I tried changing it but I’m getting some bizarre results in Glance.

It also seems that is not properly saving the point data such as the velocity. They are nowhere to be found on the index.json.

index.zip (428.5 KB)

Hello @Xabier_Morales_Ferez ,

Can you try replacing this section in the helper:

rootTimeStepSection[objName]["actor"] = obj["actor"]

with something similar to this:

if obj["actor"]:
  rootTimeStepSection[objName]["actor"] = obj["actor"]
if obj["volume"]:
  rootTimeStepSection[objName]["volume"] = obj["volume"]

Though I remember testing animated volume exports (with animated pwf) and having it work, so I’m not certain that this is the fix.

Hi @Adrien_Boucaud !

This is basically what I tried and I got the results I show above.

try:
    rootTimeStepSection[objName]["actor"] = obj["actor"]
    rootTimeStepSection[objName]["actorRotation"] = obj["actorRotation"]
except:
    rootTimeStepSection[objName]["volume"] = obj["volume"]
    rootTimeStepSection[objName]["volumeRotation"] = obj["volumeRotation"]

I think there must be something else wrong as the point data is not present in the root index.json.

Can you share the contents of the “volume” JSON object ?

I shared it here.

Sorry, I didn’t see it.

Can you share as well a picture of the scene in Paraview ?

Don’t worry :slightly_smiling_face:. It is the basic volumetric rendering: