Developer tutorial

Getting started

To develop a new IGT application, two steps are recommended:

  1. Use existing modules to achieve your goal; maybe add minimal new modules for algorithms not already implemented in Slicer
  2. When the workflow is proven, make a Guidelet-based module that hides the default 3D Slicer GUI and creates a user-friendly GUI instead

Guidelets are python scripted modules. SlicerIGT contains a template module, called Guidelet. Guidelet contains the most commonly needed functions of IGT applications, so make sure you subclass your module classes from Guidelet classes. You can hide any of the default widgets, and add more widgets for your application. Computation-heavy modules can be written as C++ modules, and called from the Guidelet-based GUI when needed.

It is recommended that you first get familiar with python scripting in Slicer.  Follow the Hello Python Tutorial on the Slicer website.

Read about Slicelets (simplified user interface for the Slicer application).

You can copy and modify any Guildelet-based module, or get started from a minimal example guidelet.

Source code of SlicerIGT

If you have built Slicer on your computer, then you can also built the SlicerIGT extension. Visit the SlicerIGT GitHub page.

Code snippets for use in the Python interactor

LandmarkRegistrationExperiment.py – Creates random data for fiducial (landmark) registration, and computes the registration transform.

PrePostMultiply.py – Shows the difference between PreMultiply and PostMultiply methods of VTK transforms.

ObserveTransformNode.py – Observer updates a transform whenever another observed transform is modified.

CreateTpsWithFiducials.py – Creates two fiducial lists and a deformable (TPS) transform between them. The fiducials can be dragged, and the deformable transformation updates and real time.

ModelDistanceColorMap.py – Demonstrates how to show the distance between two models as a color map on one of the models.

How to…

change default settings

To read what are default application settings, look at the addValuesToDefaultConfiguration method in SlicerIGT/Guidelet/GuideletLoadable.py.

To change these default values, or to add your own settings, edit the addValuesToDefaultConfiguration method in your own guidelet-based module source code. E.g.

def addValuesToDefaultConfiguration(self):
  GuideletLogic.addValuesToDefaultConfiguration(self)
  ...
  settingList = {
    ...
    'LiveUltrasoundNodeName': 'Image_Tracker',
    ...

change widget styles

Make a copy of the default stylesheet file (Guidelet/GuideletLib/Resources/StyleSheets/DefaultStyle.qss) and put it in your module Resources/StyleSheets folder. Modify this style sheet according to the Qt tutorials.

Set this new style sheet file to be used in your module:

def addValuesToDefaultConfiguration(self):
  ...
  settingList = {
    'StyleSheet' : moduleDirectoryPath +\
    'Resources/StyleSheets/UsNeedleTutorStyle.qss',
  ...

 

toolkit for navigated interventions