Documentation/4.1/Developers/ModuleWizard

From Slicer Wiki
Revision as of 04:42, 12 April 2012 by JChris.FillionR (talk | contribs) (4.0 -> 4.1)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Documentation < 4.1 < Developers < ModuleWizard

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 ./Modules/Loadable/ModuleTemplate
 --templateKey default is dirname of template
 --target default ./Modules/Loadable/<moduleName>

Examples

These can be run from the Slicer4 source directory.

To create a Loadable Extension:

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

To create a Scripted Loadable Extension:

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

To create An EditorExtension

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