The Image-Guided Therapy Program (IGTP) is combining advances in imaging and therapeutic technology to develop minimally invasive surgical and interventional techniques.
Read more >
In this tutorial we will go through the basics of making an application in the SIGN framework. The 'helloworld' application that can be found in a subdirectory of the source code will act as an example. To make your own application in The SIGN, there are at least 6 files necessary:
Typically there will be additional code to implement the details of the application. For example, most applications that are developed in the SIGN framework will have a 'process' class to manage the workflow of the application and specific callback responses. In the following, we will describe how to make the files above. The project found under the directory 'helloworld' will be used in this example. To run it goto the helloworld directory and do (it needs the full path for the mrmlfile):
In HelloWorld.cxx the main function starts with checking the command line arguments. Typically three commandline arguments will be given, namely the three configuration files that describe the data and the device configuration. Details about these files are given below. Next, since the SIGN is using KWWidgets (which uses Tcl/Tk), it is necessary to initialize the Tcl interpreter. There are three objects that every application needs:
These objects are created in the main function, and some initialization has to be done on them. The GUI class has to be initialized by calling:
This will ensure that the GUI class has a connection to the context, and it will create all the widgets that constitute the GUI. It is possible to make applications without a GUI, but their functionality will be very limited. The context class has to be initialized by calling:
SetName sets the vtkKWApplication's (superclass of SignContext) name. Init will perform parsing of the configuration files (parameter 1: mrml-file, parameter 2: opentracker file) and set up initial variables. After this, the application can be started by calling Start() on the context. This will give control to the application's event loop, which handles both GUI events and events from external devices (trackers and imagers). To implement application specific code that will be executed beyond this point, callback functions that listen to events from the core of The SIGN or from user defined GUI elements will have to be implemented. This is typically done in a separate class.
The graphical user interface has to be implemented as a class deriving from SignUIBase. The only function that has to be reimplemented is SetupMainWin. This function creates all the widgets and defines the GUI. The GUI can be designed using standard methods in KWWidgets, but there is one important element that has to be added. In order to use the core functionality of SIGN, the widgets Sign2DViewer and/or Sign3DViewer have to be used. A convenience class SignStandardNavigationWidget is used in helloworld, that creates a set of these viewers internally. In order to make the viewers accessible for the applictaion, they have to be added to the map called "ViewerCollection". This can be done by doing
The name "Main3DViewer" in this example, will be used to reference this viewer in the mrml file. The the
The build file for an application in The SIGN can be very simple. Here is an example:
In addition, the directory name where your build file and your code are residing needs to be added to the list of SUBDIRS in the CMakeLists.txt file for the SIGN main project.
A MRML file can be made by writing it from scratch or by using Slicer. MRML files created in Slicer can be read directly into The SIGN. Here is an example:
This reads two models from file as well as a volume from a DICOM directory. It is very important that the ID and the name of every node is unique. These names will be used to connect MRML nodes to trackers and viewers. For more information about MRML, see Slicer's wiki page.
The OpenTracker configuration file reflects the device setup which you will be using in your application. The most common devices to integrate are trackers and imaging devices. Here is an example file:
The configuration section is used to configure modules. After the configuration section, the connections between sources, filter nodes and sinks are defined. See the OpenTracker web pages for more information about modules and nodes. The SIGN implements two different sinks in one module: SignOTSink and SignImageSink. SignOTSink is used for trackers, and SignImageSink is used for imaging devices. In the above setup, a network source is used to capture tracking data from the network (actually from the localhost), this tracking data is then sent to a SignOTSink named "Ball". The system will use the SignOpenTracker mrml node to look for ot that matches the name. This mrml node will make a connection between a tracker node and a mrmo node (e.g. a model will move when the tracker moves). If the name matches a viewer node, this viewer will be controlled by the tracker. A camera (separate MRML node) can also be controlled by a tracker.