Update volume node


I want to display data as i receive them. So i created a volume node and each time i receive data i do a SetAndObserveImageData with the new data. Like this :


It kind of works but to have the display updated i need to hide and show the node, or to zoom on the window or click anything to have the window updated.

I searched and tried several kind of update command on the scene, node or displayNode. I did not manage to have it auto updated for now.

Is this possible ? Am I doing it the right way ?

Looks like you never call EndModify to match up with your StartModifify (these are used to make bulk changes to several nodes with only a single event)

Ok, in fact my main problem was a thread problem. I receive image data via websocket running in a separate tread and that was this tread tryng to update the node. And the node hierachy is managed i guess by the main thread. The solution in a simple signal/slot and make sure that the operation on the node are made by the main thread.

I had various not predictable behaviours and this kind of error/warning :

HasItemAttribute: Failed to find subject hierarchy item by ID 94424278946520
Input port 0 of algorithm vtkImageMapToWindowLevelColors(0x55914d195a70) has 0 connections but is not optional.
Input port 0 of algorithm vtkImageThreshold(0x55914d19d860) has 0 connections but is not optional.
QObject::startTimer: Timers cannot be started from another thread
QObject::killTimer: Timers cannot be stopped from another thread
Cannot make QOpenGLContext current in a different thread

One last question, it work without StartModify and EndModify, so what is the purpose of thoses functions ?

They are only for efficiency - should work the same without them.