Read position from txt file

Hello everybody,
I want to develop a system that read a position from a file in real time, through OpenIGTlink, and send it to the Slicer.
The file has to be read at the same time that it is modified. I found a node “vtkMRMLStorableNode::GetModifiedSinceRead()” that do this, but it works in real time and with openigtlink?
Do you think that it’s better and easier to implement a thread for the writing-reading-sending process?
Thanks for your helping.

PlusServer application in Plus toolkit can already read positions and orientations (and images) from text files and send them to Slicer through OpenIGTLink. No need to develop any new software for this. PlusServer can also connect to real hardware (tracking system, sensors, imaging devices, etc).

I don’t think that i can use PlusServer app, because my device is not compatible with it.

What device do you have? You can either add support for your device (more learning, less coding), or implement a PlusServer clone that can communicate with your device and send OpenIGTLink messages to Slicer.

Actually, I already develop a c++ code that acquire the position from the device and save it on a file, so i just want to find an optimal way to transfer this position on 3Dslicer. Do you think that i should implement a thread?
However, as a second way, your suggestion is very interesting. Can you please give me more information about that?
Thanks for your helping.

Follow examples in OpenIGTLink library for creating a simple server or client that sends tracking data. Slicer can connect to that using OpenIGTLinkIF module and takes care of multithreading and real-time scene updates.

1 Like