Difference between revisions of "OpenIGTLink/Slicer"

From NAMIC Wiki
Jump to: navigation, search
Line 19: Line 19:
  
 
==Connectors==
 
==Connectors==
To manage multiple OpenIGTLink communications simultaneously, the OpenIGTLink Interface module handles a OpenIGTLink connection as a "connector". One connector can establish connection with only one external hardware / software to exchange data, and the users can add connectors from the graphical user interface as much as they need. Each connector can be configured as either TCP/IP server or client independently. Note that this does not mean directions of data stream; it just determines whether the module or the external software / hardware waits for (listens to) the other side to initiate the connection. Once the connection is established, there is no difference between server and client connectors.
+
To manage multiple OpenIGTLink communications simultaneously, the OpenIGTLink Interface module handles an OpenIGTLink connection as a "connector". One connector can establish connection with only one external hardware / software to exchange data, and the user can add connectors from the graphical user interface (GUI) as much as he/she need. Each connector can be configured as either TCP/IP server or client independently. Note that this does not mean directions of data stream; it just determines whether the module or the external software / hardware waits for (listens to) the other side to initiate the connection. Once the connection is established, there is no difference between server and client connectors.
  
From the developers' point of view, a connector is handled as an instance of vtkIGTLConnector class, which is defined in Modules/OpenIGTLinkIF/vtkIGTLConnector.cxx and vtkIGTLConnectors.h. The class has a thread to monitor a communication with an external hardware / software.  
+
The figure bellow shows an example schematic diagram where multiple devices are communicating with the 3D Slicer through the OpenIGTLink Interface. Each connector serves as an interface between external device to convert OpenIGTLink message to MRML node or vice versa.
  
 
[[Image:Slicer3_OpenIGTLinkIF_Architecture.png]]
 
[[Image:Slicer3_OpenIGTLinkIF_Architecture.png]]
 +
 +
From the developers' point of view, a connector is handled as an instance of vtkIGTLConnector class, which is defined in Modules/OpenIGTLinkIF/vtkIGTLConnector.cxx and vtkIGTLConnectors.h. The class has a thread to monitor communication with an external hardware / software.
 +
 +
==Event-driven==
 +
The OpenIGTLink Interface module is driven by two types of events: arrivals of OpenIGTLink messages and update events in MRML scene. The module monitors incoming messages, and once it receives a message, it starts deserializing the message to import the data into MRML scene as a MRML node.  Other software modules in 3D Slicer can recognize that the data is imported into the MRML scene by catching the MRML event. The module also monitors events from MRML nodes, which the user has registered as nodes to export. When one of the nodes is updated from somewhere in the 3D Slicer, the module catches the update event and start serializing the data into OpenIGTLink message. the serialized data is transfered to the device through OpenIGTLink connection.
 +
This event-driven architecture allows other software modules in the 3D Slicer to exchange various kinds of data with external hardware and software without accessing API of OpenIGTLink interface (in other words, with few modification of the codes).
  
 
=Install the Software=
 
=Install the Software=

Revision as of 17:25, 3 December 2008

Home < OpenIGTLink < Slicer

<< OpenIGTLink

Overview

The 3D Slicer OpenIGTLink Interface Module is a program module for that can handle network communications between 3D Slicer and external software / hardware using OpenIGTLink protocol. The module provides following functions:

  • Data import: The module can import position, linear transform and image data from OpenIGTLink-compliant software / hardware to the MRML scene.
  • Data export: The module can export linear transform and image data from the MRML scene.
  • Multi-connection: The module can manage multiple OpenIGTLink connections at the same time.
  • Locator visualization: The user can choose one of linear transforms in the MRML scene to visualize its position and orientation in the 3D space.
  • Slice driving: The module can control volume re-slicing plane based on linear transform in the MRML scene.


OpenIGTLink Slicer Screenshot.png

Architecture

Overview

The OpenIGTLink Interface module is designed to adapt to the 3D Slicer’s scene graph mechanism called Medical Reality Modeling Language (MRML) architecture. MRML provides a unified way to handle various kinds of data including images, transforms, and models in the IGT setting as MRML nodes. In order to manage multiple nodes, all MRML nodes have a tree structure. For example, the user can apply a transform to an image by placing it under the transform node as a child node. When the OpenIGTLink module receives an OpenIGTLink message, it creates a MRML node with the same name as the "device name" in the message and imports the data to the node. If a node with the same name and data type already exists, the module simply updates the data. The module also can export the data from a MRML node through the OpenIGTLink interface. This mechanism maximizes the flexibility to import/export data to/from the 3D Slicer, since users can configure the MRML node tree interactively without changing the source code of the software. In addition, this mechanism make it easy for other software modules to exchange data with external software or hardware through OpenIGTLink.

Connectors

To manage multiple OpenIGTLink communications simultaneously, the OpenIGTLink Interface module handles an OpenIGTLink connection as a "connector". One connector can establish connection with only one external hardware / software to exchange data, and the user can add connectors from the graphical user interface (GUI) as much as he/she need. Each connector can be configured as either TCP/IP server or client independently. Note that this does not mean directions of data stream; it just determines whether the module or the external software / hardware waits for (listens to) the other side to initiate the connection. Once the connection is established, there is no difference between server and client connectors.

The figure bellow shows an example schematic diagram where multiple devices are communicating with the 3D Slicer through the OpenIGTLink Interface. Each connector serves as an interface between external device to convert OpenIGTLink message to MRML node or vice versa.

Slicer3 OpenIGTLinkIF Architecture.png

From the developers' point of view, a connector is handled as an instance of vtkIGTLConnector class, which is defined in Modules/OpenIGTLinkIF/vtkIGTLConnector.cxx and vtkIGTLConnectors.h. The class has a thread to monitor communication with an external hardware / software.

Event-driven

The OpenIGTLink Interface module is driven by two types of events: arrivals of OpenIGTLink messages and update events in MRML scene. The module monitors incoming messages, and once it receives a message, it starts deserializing the message to import the data into MRML scene as a MRML node. Other software modules in 3D Slicer can recognize that the data is imported into the MRML scene by catching the MRML event. The module also monitors events from MRML nodes, which the user has registered as nodes to export. When one of the nodes is updated from somewhere in the 3D Slicer, the module catches the update event and start serializing the data into OpenIGTLink message. the serialized data is transfered to the device through OpenIGTLink connection. This event-driven architecture allows other software modules in the 3D Slicer to exchange various kinds of data with external hardware and software without accessing API of OpenIGTLink interface (in other words, with few modification of the codes).

Install the Software

From binaries

The module is available only in Slicer 3.3 source distribution. For Slicer 3.2, please see old page.

Build from the source

Building instruction can be found in OpenIGTLink/Slicer/Build.

Install Tracker Simulator to Testing the OpenIGTlink interface module

To test the OpenIGTLink interface module (or other OpenIGTLinkcomplaint devices and software), tracking simulator software is provided as an example program of the OpenIGTLink library (note that the OpenIGTLink library is different from the OpenIGTLink interface module in 3D Slicer).

From binaries

Obtain a binary file for your environment.

From Source

The instruction can be found in OpenIGTLink/Library/build. Please make sure that you enable "build examples" option.


Testing Open IGT Link Module -- Show Tracking Device in the 3D Space

Set up Open IGT Link Module

  1. Select "OpenIGTLink" from "Modules:" menu
  2. Open "Connector Browser" frame, and press "Add" button below the "Connectors" list to add a new connector
  3. Configure and start the connector. Choose "Server" check box in the "Type" option, then clinck "Active" check box. Now the Slicer is ready to accept connections through Open IGT Link.

Run Tracker Simulator

To send dummy coordinate data to the Slicer running on localhost with frame rate of 10 fps, run:

$ ./TrackerSim  10  c  localhost 18944

Visualize Tracker Position

To see the coordinate from the Tracker Simulator,

  1. Open "Visualization / Slice Control" frame in the OpenIGTLink module interface.
  2. Click the "Show Locator" check button. A locator model shows up on the 3D viewer.
  3. Open "Data" module. Choose "Data" from "Modules:" menu.
  4. Edit MRML tree. Put "IGTLocator" under the "Tracker" by dragging "IGTLocator" node.
  5. You should see the locator model moves in the 3D viewer.


Testing Open IGT Link Module -- Reslice 3D image

We can reslice 3D image according to the locator position with following steps:

  1. Load 3D volume from the "Volumes" module.
  2. Start Tracking as we did in the previous section.
  3. In the "Visualization / Slice Control" frame in the OpenIGTLink module interface, click Red menu and choose "Locator".
  4. The image in the left 2D slice viewer (Red) should start to move. You can change the orientation by changing slice orientation menu in the 2D slice viewer.
  5. If you click the "Oblique" check button in the "Visualization / Slicer Control" frame, the slice orientation is set according to the locator orientation.
  6. You can use other 2D viewers (Yellow and Green) by choosing "Locator" from the Yellow and Green menu in the "Visualization / Slice Control" frame.



Loadmap


Other Resources

People