Difference between revisions of "Documentation/4.1/Developers/ModuleWizard"

From Slicer Wiki
Jump to: navigation, search
(Prepend documentation/versioncheck template. See http://na-mic.org/Mantis/view.php?id=2887)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
<noinclude>{{documentation/versioncheck}}</noinclude>
 
== Background ==
 
== Background ==
  
Line 17: Line 18:
  
 
  ModuleWizard [--template <dir>] [--templateKey <key>] [--target <dir>] <moduleName>
 
  ModuleWizard [--template <dir>] [--templateKey <key>] [--target <dir>] <moduleName>
   --template default ./Modules/Loadable/ModuleTemplate
+
   --template default ./Extensions/Testing/LoadableExtensionTemplate
 
   --templateKey default is dirname of template
 
   --templateKey default is dirname of template
 
   --target default ./Modules/Loadable/<moduleName>
 
   --target default ./Modules/Loadable/<moduleName>
Line 24: Line 25:
  
 
These can be run from the Slicer4 source directory.
 
These can be run from the Slicer4 source directory.
 +
 +
To create a [[Documentation/{{documentation/version}}/Developers/Modules#Command_Line_Interface_.28CLI.29|CLI]] Extension:
 +
 +
  ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate --target ../MyFooExtension MyFooExtension
  
 
To create a [[Documentation/{{documentation/version}}/Developers/Tutorials/CreateLoadableModule|Loadable]] Extension:
 
To create a [[Documentation/{{documentation/version}}/Developers/Tutorials/CreateLoadableModule|Loadable]] Extension:
  
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/LoadableExtensionTemplate --target ../MyFooExtension MyFooExtension
+
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/LoadableExtensionTemplate --target ../MyBarExtension MyBarExtension
  
 
To create a [[Documentation/{{documentation/version}}/Developers/Modules#Scripted_Modules|Scripted Loadable]] Extension:
 
To create a [[Documentation/{{documentation/version}}/Developers/Modules#Scripted_Modules|Scripted Loadable]] Extension:
  
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/ScriptedLoadableExtensionTemplate --target ../MyBarExtension MyBarExtension
+
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/ScriptedLoadableExtensionTemplate --target ../MyBorExtension MyBorExtension
  
 
To create an [[Documentation/{{documentation/version}}/Developers/EditorExtension|EditorEffect]] Extension
 
To create an [[Documentation/{{documentation/version}}/Developers/EditorExtension|EditorEffect]] Extension
 
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/EditorExtensionTemplate --target ../MyEditorEffect MyEditorEffect
 
   ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/EditorExtensionTemplate --target ../MyEditorEffect MyEditorEffect

Latest revision as of 07:30, 14 June 2013

Home < Documentation < 4.1 < Developers < ModuleWizard


For the latest Slicer documentation, visit the read-the-docs.


Background

Slicer modules typically consist of several files of various types, such as CMake files, source files, and binary files.

In many cases, the names of the files and the names of text strings inside the files are related and need to be in sync in order for things to compile.

Also, it is not uncommon to want to use one module as the starting point for implementing similar functionality.

Terminology

  • The template is a directory containing a slicer module
  • The templateKey is a text string, typically the name of the module, that is used in both filename and identifiers inside the module.
  • The target is a directory where you want the new module to be placed
  • The moduleName is the string that you want to use in place of the templateKey

Usage

ModuleWizard [--template <dir>] [--templateKey <key>] [--target <dir>] <moduleName>
 --template default ./Extensions/Testing/LoadableExtensionTemplate
 --templateKey default is dirname of template
 --target default ./Modules/Loadable/<moduleName>

Examples

These can be run from the Slicer4 source directory.

To create a CLI Extension:

 ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate --target ../MyFooExtension MyFooExtension

To create a Loadable Extension:

 ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/LoadableExtensionTemplate --target ../MyBarExtension MyBarExtension

To create a Scripted Loadable Extension:

 ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/ScriptedLoadableExtensionTemplate --target ../MyBorExtension MyBorExtension

To create an EditorEffect Extension

 ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/EditorExtensionTemplate --target ../MyEditorEffect MyEditorEffect