Asynchronous streaming of data from a pipeline

Hi Developers

I am trying to make a Filter without any output ports and provide it with a Start() method and a Frequency property for setting up how often Update() is called and an internal thread will stream data across the network using e.g. OpenIGTLink.

Option 1:
My first solution was to add a method for providing the module with an interactor and simply create a repeating timer and use a mutex for data exchange between the thread executing Update and an internal thread for streaming data using OpenIGTLink. This works, but it is not very elegant.

I would like a solution which works without an interactor the user needs to provide for the module. Can you use some sort of default interactor? Basically I need a mechanism for calling Update from the main thread or the thread used for setting up the given pipeline?

Option 2:
I created a user event and an event thread invoking this event. It was my hope that in the Execute() method in a handler derived from vtkCommand I could call Update on the pipeline. Unfortunately this callback is executed in my own event thread. I hoped that it would work similarly to the signal/slot mechanism in Qt, where I can specify a queued connection…

What would be the VTK way of making a module which Updates with a specified frequency?

Thanks in advance
Jens Munk Hansen

Data collection from devices into buffers (and optionally processing, synchronization, mixing, etc. of the data streams) and then broadcasting the data to clients via OpenIGTLink on separate threads is implemented in the VTK-based Plus toolkit.

If you use Qt then you can use the VTK+Qt based OpenIGTLinkIO package that is somewhat more generic (supports more VTK data types) and uses Qt signal/slot mechanism, but does not have data acquisition the sophisticated buffered data streams support as Plus.

Plus toolkit might completely solve your task, as it can already collect images from BK ultrasound (both OEM and CameraLink interfaces) and many trackers and other sensors and stream that through OpenIGTLink. But if you want to have a small single-purpose application then you can just copy the relevant parts from Plus or OpenIGTLinkIO.

Thank you. I am aware of the Plus Toolkit. I think that I will look into OpenIGTLinkIO and copy the relevant parts. I am thinking of a setup with a data sink where the streaming is deferred to another thread and exposed using a SyncIGTLinkIO() method. If the module is part of the rendering pipeline, I can call the SyncIGTLinkIO() using a repeating timer created on the interactor. If it is used in a background process, I will call the SyncIGTLinkIO() using the thread I used for setting up the pipeline.