Difference between revisions of "Slicer3:SkeletonGenerator"

From NAMIC Wiki
Jump to: navigation, search
(New page: ==Introduction== The Skeleton Generator is a simple program to generate template codes for 3D Slicer module and help developers to get started on their development. A source code generated...)
 
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
The Skeleton Generator is a simple program to generate template codes for 3D Slicer module and help developers to get started on their development. A source code generated by the Skeleton Generator can immediately be compiled and executed as a 3D Slicer module, thus developers can create their own modules by just modifying the codes.
+
The Skeleton Generator is a simple program to generate template codes for 3D Slicer module and help developers to get started on their development. A source code generated by the Skeleton Generator can immediately be compiled and executed as a 3D Slicer module. The developers can create their own modules by just modifying the codes.
  
 +
==Getting Started==
 +
===Requirement===
 +
The Skeleton Generator is written in Tcl. You need to have a Tcl interpreter to run the program on you computer. The program generates a Slicer3 Module C++ code, which can be compiled on Windows/Linux/Mac OS X.
 +
 +
===Get the program===
 +
The program is available in the NA-MIC SandBox repository. You can obtain the source code by using Subversion. In case of Linux and Mac OS X, simply type following command in the terminal:
 +
 +
  svn co http://svn.na-mic.org/NAMICSandBox/trunk/IGTLoadableModules/SkeletonGenerator SkeletonGenerator
 +
 +
===How to use it===
 +
You must have a Slicer source directory. We suppose that the Slicer source directory is <working directory>/Slicer3 and Skeleton Generator in <working directory>/SkeletonGenrator. If you want to create a new module named "NewModule"
 +
 +
  $ cd <working directory>/Slicer3/Module
 +
  $ <working directory>/SkeltonGenerator/generate.tcl --name=NewModule
 +
 +
Skeleton Generator creates a directory named "NewModule" and generates template codes there.
 +
 +
  $ cd NewModule
 +
  $ ls
 +
  CMakeLists.txt            vtkNewModuleGUI.h
 +
  NewModule.txt              vtkNewModuleLogic.cxx
 +
  vtkNewModuleConfigure.h.in vtkNewModuleLogic.h
 +
  vtkNewModuleGUI.cxx        vtkNewModuleWin32Header.h
 +
 +
===Compile the module===
 +
First you need to edit CMakeLists.txt in Slicer3 modules directory (<working directory>/Slicer3/Modules/CMakeLists.txt
 +
to add the new module directory. In subdirs () section, where all module names are listed, add
 +
  NewModule
 +
 +
Then run make in Slicer3 module build directory (<working directory>/Slicer3-build/Modules). On Linux and Mac OS X,
 +
  $ cd <working directory>/Slicer3-build/Modules
 +
  $ make
 +
 +
For Windows, open the project file in Slicer3-build/Modules from Visual Studio, and build the project.
 +
 +
The make / Visual Studio will call CMake to generate appropriate Makefile/project file in <working directory>/Slicer3-build/Modules/NewModules.
 +
Once you confirm that the building process finishes without errors, launch Slicer and check the module selector.
 +
 +
==Future work==
 +
*Provide several module styles e.g. wizard-based GUI (The program already has a mechanism to choose a style from different template codes, but only a simple template is provided currently.)
 +
* Note: relies on 'sed' so may not work on windows.
  
 
==People==
 
==People==
 
*[[User:Tokuda| Junichi Tokuda]]
 
*[[User:Tokuda| Junichi Tokuda]]

Latest revision as of 03:20, 15 April 2010

Home < Slicer3:SkeletonGenerator

Introduction

The Skeleton Generator is a simple program to generate template codes for 3D Slicer module and help developers to get started on their development. A source code generated by the Skeleton Generator can immediately be compiled and executed as a 3D Slicer module. The developers can create their own modules by just modifying the codes.

Getting Started

Requirement

The Skeleton Generator is written in Tcl. You need to have a Tcl interpreter to run the program on you computer. The program generates a Slicer3 Module C++ code, which can be compiled on Windows/Linux/Mac OS X.

Get the program

The program is available in the NA-MIC SandBox repository. You can obtain the source code by using Subversion. In case of Linux and Mac OS X, simply type following command in the terminal:

 svn co http://svn.na-mic.org/NAMICSandBox/trunk/IGTLoadableModules/SkeletonGenerator SkeletonGenerator

How to use it

You must have a Slicer source directory. We suppose that the Slicer source directory is <working directory>/Slicer3 and Skeleton Generator in <working directory>/SkeletonGenrator. If you want to create a new module named "NewModule"

 $ cd <working directory>/Slicer3/Module
 $ <working directory>/SkeltonGenerator/generate.tcl --name=NewModule

Skeleton Generator creates a directory named "NewModule" and generates template codes there.

 $ cd NewModule
 $ ls
 CMakeLists.txt             vtkNewModuleGUI.h
 NewModule.txt              vtkNewModuleLogic.cxx
 vtkNewModuleConfigure.h.in vtkNewModuleLogic.h
 vtkNewModuleGUI.cxx        vtkNewModuleWin32Header.h

Compile the module

First you need to edit CMakeLists.txt in Slicer3 modules directory (<working directory>/Slicer3/Modules/CMakeLists.txt to add the new module directory. In subdirs () section, where all module names are listed, add

 NewModule

Then run make in Slicer3 module build directory (<working directory>/Slicer3-build/Modules). On Linux and Mac OS X,

 $ cd <working directory>/Slicer3-build/Modules
 $ make

For Windows, open the project file in Slicer3-build/Modules from Visual Studio, and build the project.

The make / Visual Studio will call CMake to generate appropriate Makefile/project file in <working directory>/Slicer3-build/Modules/NewModules. Once you confirm that the building process finishes without errors, launch Slicer and check the module selector.

Future work

  • Provide several module styles e.g. wizard-based GUI (The program already has a mechanism to choose a style from different template codes, but only a simple template is provided currently.)
  • Note: relies on 'sed' so may not work on windows.

People