Difference between revisions of "Tracker Daemon"

From NAMIC Wiki
Jump to: navigation, search
Line 1: Line 1:
 
= Purpose =
 
= Purpose =
  
Tracker Daemon is created for the communication between Slicer 3 and IGSTK through socket connection. For now, a program built on top of IGSTK can send tracking data to Slicer 3, which then updates the locator and related images accordingly. In the future, Tracker Daemon will be used to receive realtime images.
+
Tracker Daemon is created for the communication between Slicer 3 and IGSTK through socket connection. For now, a program built on top of IGSTK can send tracking data to Slicer 3, which then updates the locator and related images accordingly. In the future, Tracker Daemon will be used to receive realtime images. See [[OpenIGTLink]] for the new version of this Daemon.
  
 
= Recipe for using Tracker Daemon=
 
= Recipe for using Tracker Daemon=

Revision as of 19:34, 10 January 2008

Home < Tracker Daemon

Purpose

Tracker Daemon is created for the communication between Slicer 3 and IGSTK through socket connection. For now, a program built on top of IGSTK can send tracking data to Slicer 3, which then updates the locator and related images accordingly. In the future, Tracker Daemon will be used to receive realtime images. See OpenIGTLink for the new version of this Daemon.

Recipe for using Tracker Daemon

Prepare VTK & IGSTK

  • Rerun CMake in the VTK that you used for building IGSTK and turn "VTK_USE_PARALLEL" ON. Then compile VTK (no need to make a clean build, it will just build the vtkParallel library).
  • Put the igstkTracker.cxx file from the NAMIC sandbox directory NAMICSandBox/trunk/IGSTK-Slicer-IntegrationViaSockets/IGSTKAdaptor into the IGSTK/Source directory. (replacing the existing one). Rerun CMake on IGSTK, then build IGSTK.

Prepare NAMICSandbox Integration Code

  • Configure the directory NAMICSandBox/trunk/IGSTK-Slicer-IntegrationViaSockets with CMake, provide in IGSTK_DIR the directory where you build IGSTK, and provide ITK_DIR and VTK_DIR as the directories that you used for building IGSTK. They don't have to be the same that you used for building Slicer.

Prepare Slicer IGT

Download Slicer IGT

Download Slicer IGT by using the following command

   svn co http://www.na-mic.org/svn/Slicer3/branches/IGT Slicer3

Build Slicer IGT

Simply run the script


 ./Slicer3/Scripts/getbuildtest.tcl


This Tcl script will download all necessary libraries, will configure them and will initiate the build of Slicer.


For more details on how to build it, please see the full page

Testing

First Test

Once you build from step above, you will get three executables:

  • igstkTrackerToolSocketRelayTest1.exe,
  • igstkTrackerToolSocketRelayTest2.exe
  • igstkTransformSocketListener.exe

First, test your system by running the following commands:

  1. igstkTransformSocketListener.exe 16666
  2. igstkTrackerToolSocketRelayTest2.exe localhost 16666

Preferably, run each command on a different console.

That should print out the following output on the console of command (1):


$ Port = 16666
0 : 1 0 0 0 1 0 0 0 1 0 100 0
1 : 1 0 0 0 1 0 0 0 1 0.999983 99.995 0
2 : 1 0 0 0 1 0 0 0 1 1.99987 99.98 0
3 : 1 0 0 0 1 0 0 0 1 2.99955 99.955 0
4 : 1 0 0 0 1 0 0 0 1 3.99893 99.92 0
5 : 1 0 0 0 1 0 0 0 1 4.99792 99.875 0
6 : 1 0 0 0 1 0 0 0 1 5.9964 99.8201 0
7 : 1 0 0 0 1 0 0 0 1 6.99428 99.7551 0

This is a made-up tracker that provides position in a circle. If this works fine, then move to the following test:

Second Test

  • Kill the two commands above.
  • Run, in separate consoles the following commands:
  1. igstkTransformSocketListener.exe 16666
  2. igstkTrackerToolSocketRelayTest1.exe localhost 16666


Note that now in (2) you use the executable with "1". This execuatble will initialize the Aurora Tracker in serial port 0, and start grabbing transforms and sending them through the socket. In console (a), you should see transform values comming in, but this time, the values will match the movements of the Aurora Tracker Tool.

  • If this works fine, then move to the real final test;
  • Kill the two commands above

Third Test

Start Slicer IGT, and follows Steve recipe:

  1. create a transform called "tracker"
  2. load a dataset or a moder and make it a child of the "tracker" transform that you just created
  3. Open the Interactor window and from there start the tracker daemon by using the following commands:
    1. source $::SLICER_BUILD/../Slicer3/Modules/TrackerDaemon/Tcl/trackerd.tcl
    2. trackerd_start


Once Slicer is ready waiting for transforms, then do in a console the following command:


  igstkTrackerToolSocketRelayTest1.exe  localhost 8529


Note that this time we use a different port number. At that point, the Aurora tracker should be initialized (beeping), and Slicer should popup a message asking for authorization to let somebody connect in "127.0.0.1". If you click on "OK" in that message, then Slicer should start receiving the transforms from the socket, and you should see the volume moving as you move the Tracket tool.

Discussion

Luis: We were discussing yesterday the socket API with Andinet and Matt, and they pointed out that we should include the TimeStamp in the stream that is sent through the socket.

Slicer can decide later how to use this TimeStamp values.

Currently, this Time Stamp comes down to two doubles that mark the beginning and the end of the time window in which the Transform is known to be valid.

The values are in milliseconds, and are provided by the itk::RealTimeClock, which can actually be mapped back to a {hour, day, month, year} set of values if necessary.

That will make possible to synchronize with video inputs and with Transforms sent from other trackers. All of this under the assumption that if the Tracker is running in a different computer, then the two computers have been time-synchronized.

Screenshots