Difference between revisions of "Slicer3:Loadable Modules:HOWTO"

From Slicer Wiki
Jump to: navigation, search
Line 36: Line 36:
 
== CMakeLists.txt ==
 
== CMakeLists.txt ==
  
Now, edit the module's CMakeLists.txt file to call the Loadable Module Generator.  NOTE:  The macro should be placed after TCL wrapping is done, as it adds to the source variable.
+
Now, edit the module's CMakeLists.txt file to call the Loadable Module Generator.  NOTE:  The macro should be placed after TCL wrapping is done, as it adds to the source variable. For more details, check the [http://na-mic.org/ViewVC/index.cgi/trunk/Modules/GradientAnisotropicDiffusionFilter/CMakeLists.txt?view=markup&sortby=file GAD module CMakeLists.txt] file, as it provides a good starting point.
 
   
 
   
 
For example:
 
For example:
  
 
   generatelm(OpenIGTLink_SRCS OpenIGTLink.txt)
 
   generatelm(OpenIGTLink_SRCS OpenIGTLink.txt)

Revision as of 03:59, 30 May 2008

Home < Slicer3:Loadable Modules:HOWTO

In order to allow a module to be detected and loaded at runtime (without explicitly being called from the main() routine in Applications/GUI/Slicer3.cxx), do the following:

vtkModuleNameGUI

For your vtkSlicerModuleGUI-derived class, declare and implement:

 virtual void SetModuleLogic(vtkSlicerLogic*)

This is necessary so that the Loadable module code does not need to cast the Logic pointer returned from the defined entry point.

ModuleName.txt

Create ModuleName.txt in the module's directory. ModuleName should follow the naming convention for the *GUI and *Logic classes.

For these two clases:

vtkOpenIGTLinkLogic
vtkOpenIGTLinkGUI

Create:

OpenIGTLink.txt

This file contains naming directives, as well as lists dependencies. At a minimum, the module name must be specified:


 Name: Open IGT Link

Additionally:


 GUIName: OpenIGT
 Dependency: Module One
 Dependency: Module Two

CMakeLists.txt

Now, edit the module's CMakeLists.txt file to call the Loadable Module Generator. NOTE: The macro should be placed after TCL wrapping is done, as it adds to the source variable. For more details, check the GAD module CMakeLists.txt file, as it provides a good starting point.

For example:

 generatelm(OpenIGTLink_SRCS OpenIGTLink.txt)