Trigger rendering on Modified

Hello everyone,

I’m currently developing a module that streams 2D images based on custom OpenIGTLink messages. The streaming works good, concurrency is no issue (I use vtkSlicerApplicationLogic::RequestModified from the receiving thread), images are received and the module clones their content continously into the vtkImageData of a vtkMRMLVectorVolumeNode. This vtkImageData object was initialy added with vtkMRMLVolumeNode::SetAndObserveImageData. After each cloning operation vtkObject::Modified() is called on the vtkImageData object.
Here is the problem: the views are only updated/rerenderd when I interact with them.

What do I need to do (besides the Modified() call on the vtkImageData of the vtkMRMLVectorVolumeNode), that all views are updated/rerendered based on the current state of the MRML scene (including the modified node)?

Thanks in advance

What was the reason you had to reimplement receiving of images through OpenIGTLink? OpenIGTLinkIF module was developed exactly for this purpose.

Image update works well if you use OpenIGTLinkIF by doing this:

You may attach a debugger and see better what exact series of steps are performed there.

1 Like

I thought that you would mention OpenIGTLinkIF. Unfortunately I’m bound to a non-standard extension of the Protocol (an extension of the IMAGE Message). That’s why had to implement the streaming by myself.

Adding the Modified Call() to the volume node did the trick. I thought this was done automatically as the class has a custom ImageDataModifiedEvent. Thanks for the quick and helpful response :+1:

For future reference, OpenIGTLinkIF was designed to be extensible. To add support for a new OpenIGTLink node or message type, tou just need to create a simple converter class in your module and register it using a single method call. Small amount of code also means smaller maintenance and bugfixing efforts and you also get new features for free, such as OpenIGTLink 3 compatibility, image compression (available soon), etc. OpenIGTLink3 allows attaching arbitrary metadata (as key:value pairs) to messages, so you need custom messages less often.

1 Like

I didn’t know OpenIGTLinkIF was that extensible. Now that I think about it, it is somehow related to VTK. Of course it is extensible :grin:

I implemeted my own Converter and added a dependecy to OpenIGTLinkIF and the work I did before in 5 days was done in 2 hours (and most likely better done).

I implemeted my own Converter and added a dependecy to OpenIGTLinkIF and the work I did before in 5 days was done in 2 hours (and most likely better done)

Nice work!

Can you share with us what your project is about?

A post was split to a new topic: Showing real-time thermography images as overlay