ITK/Release 4/Modularization/Prototype/Tutorial: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
 
(48 intermediate revisions by one other user not shown)
Line 1: Line 1:
= Overview =
= Overview =
* Toy Example design
* Toy modular ITK design
This tutorial demonstrates the prototype of modularized ITK with a toy example containing seven modules and a testing application.  
This tutorial demonstrates the prototype of modularized ITK with a toy example containing seven modules required to build Nrrd image I/O programs. The seven library modules are:
The seven library modules are:
   * itk-vnl (a subset of numeric libraries of VXL),
   * itk-vnl (a subset of numeric libraries of VXL),
   * kwsys (a supporting library for ),
   * itksys (a system supporting library),
   * itk-common (core classes, macro definitions, typedefs, and other software constructs central to ITK),
   * itk-common (core classes, macro definitions, typedefs, and other software constructs central to ITK),
   * itk-io-common (classes that support the reading and writing of data),
   * itk-io-common (classes that support the reading and writing of data),
   * nrrdio (third-party library),
   * nrrdio (third-party library of nrrd image IO),
   * itk-io-nrrd (itk wrapper of nrrdio).
   * itk-io-nrrd (itk wrapper of nrrdio).
   * itk-zlib (zlib library wrapped up for nirrdio)
   * itk-zlib (zlib library wrapped up for nirrdio)


The application "test-itk-nrrd" module contains one test program that reads and writes images in Nrrd format.
* CMake prototyping
To enable ITK developers download and configure the whole modularized ITK package, we have prototyped several CMake packaging strategies. The major challenge is to manage dependencies between the modules. Two approaches have been proposed so far and are demonstrated in this tutorial.  


* CMake prototyping
One method uses "add_subdirectory" to include ITK modules in correct order according to their dependencies. Git submodule [https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial] is used to obtain all the modules all together with version controls. Here we refer this approach as "itk-complete" approach (Method A), which is designed for ITK developers. Another approach is to use the state-of-the-art cmake function "add_export_project" to automate the process of pulling selected modules from their repositories. Users can select the specific modules they need for their applications from the cmake gui. We refer to this second approach as "itk-optional" approach (Method B).
To enable ITK developers download and configure the whole modularized ITK package, we designed several cmake magics to serve the modularized ITK . The major challenge is to manage dependencies between the modules. Two strategies using CMake have been proposed so far and both are demonstrated in this tutorial. A classic CMake approach is to use "add_subdirectory" to include each module in correct order according to their dependencies. Git submodule is used to obtain all the modules all together with specific versions. Here we refer this approach as "itk-complete" approach (Method A). Another approach is to use the state-of-the-art cmake function "add_export_project" to automate the process of pulling selected modules from their repositories and building them. Users can select the specific modules they need for their applications from the cmake gui.We refer to this second approach as "itk-optional" approach (Method B).


= Requirements =
= Requirements =


* A computer with a network connection
* A computer with a network connection  
* A build environment (gcc / VS)
* A build environment (gcc / VS)
* CMake 2.8.2 installed([http://www.cmake.org/cmake/resources/software.html])
* CMake 2.8.2 installed([http://www.cmake.org/cmake/resources/software.html])
* Git 1.7.x.x installed ([http://git-scm.com/download])
* Git 1.7.x.x installed ([http://git-scm.com/download])


= Git repositories of individual modules =
= Build and test toy modular ITK=
The repositories of the seven modules in the toy modular ITK are listed as follows. They can be build separately with manually specified (via cmake) paths for their required depending modules.
 
#itk-vnl
  git://kwsource.kitwarein.com/itk/itk-vnl.git
 
#kwsys
  git://kwsource.kitwarein.com/itk/kwsys.git
 
#itk-zlib
  git://kwsource.kitwarein.com/itk/itk-zlib.git
 
#nrrdio
  git://kwsource.kitwarein.com/itk/nrrdio.git
 
#itk-common
  git://kwsource.kitwarein.com/itk/itk-common.git
 
#itk-io-common
  git://kwsource.kitwarein.com/itk/itk-io-common.git
 
#itk-io-nrrd
  git://kwsource.kitwarein.com/itk/itk-io-nrrd.git


Tests of each modules can be found on the dashboard:
== Method A: itk-complete ==
  http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization


= Method A: itk-complete =
Download the itk-complete superproject package to the source directory (/src) using Git :
git clone git://www.kitware.com/itk/itk-complete.git
In the created itk-complete directory: ".gitsubmodule" file contains all submodules' urls; "itk-depends" module contains the dependencies among the modules and cmake codes to configure the superproject according to the dependencies. You will also see empty directories created for the seven modules.


Download the itk-complete package using Git to the source directory (/src):
Download toy modular ITK modules using [https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial git submodule] :
git clone git://kwsource.kitwarein.com/itk/itk-complete.git
Download toy modular ITK modules using git submodule:
  # enter the itk-complete directory  
  # enter the itk-complete directory  
  cd itk-complete
  cd itk-complete
  # add the submodule repository URLs
  # add the submodule repository URLs
  git submodule init
  git submodule init
  # clone the repositories and check out the commits specified in the superproject
  # clone the repositories and check out the commits specified in the superproject
  git submodule update  
  git submodule update  
Now you have all the source codes ready for building the toy modular ITK.


Build itk-complete project in the build directory (/bin)
Build itk-complete project in the build directory (/bin):
  #CMake configure and generate
  # CMake configure and generate
  cd /bin/itk-complete
  cd /bin/itk-complete
  ccmake /src/itk-complete
  ccmake /src/itk-complete
  # compile
  #compile and build
  make
  make
Till now you have successfully build the modular ITK project from source codes. Their dependencies are automatically configured according to the predefined dependencies in the package.


Test itk-complete with an example application  
Test itk-complete with an example application:
   # get the test package app-itk-complete
   # get the test package app-itk-complete
   git clone git://kwsource.kitwarein.com/itk/app-itk-complete.git
   git clone git://kwsource.kitwarein.com/itk/app-itk-complete.git
    
 
   # cmake configure and generate
   cd /bin/app-itk-complete
   cd /bin/app-itk-complete
   ccmake /src/app-itk-complete
   ccmake /src/app-itk-complete
    
   # build and test
   make
   make test
Two tests in the application are both related to nrrd image IO. The "itkNrrdVectorImageReadWriteTest" tests with a vector nrrd input image which is automatically downloaded from  [http://midas.kitware.com/item/view/268 MIDAS database]  at the testing time ([http://www.itk.org/Wiki/ITK_Release_4/Modularization/Prototype/Tutorial#Tests_with_MIDAS_data Test with MIDAS data]).
 
== Method B: itk-optional ==


= Method B: itk-optional =
Download the itk-optional package using Git to the source directory (/src):  
git clone git://www.kitware.com/itk/itk-optional.git


== Download ==
# add the submodule repository URLs
cd /src/itk-optional
git submodule init
# clone the repositories and check out the commits specified in the superproject
git submodule update 


* How to download the modularized code
Build itk-optional project in the build directory (/bin):
# CMake configure and generate
cd /bin/itk-optional


== Configure ==
ccmake /src/itk-optional
# compile
make
You will notice the modules are downloaded (as external projects) at the build time. The source codes are downloaded to the default binary directory where you build the project.


* How to configure the modularized code
Test itk-complete with an example application:
** CMake commands...
  # get the test package app-itk-optional
  git clone git://itk.org/itk/app-itk-optional.git
  # configure and build
  cd /bin/app-itk-optional
  ccmake /src/app-itk-optional
  make test


== Build ==
== Module-by-module ==
The repositories of the seven modules in the toy modular ITK are listed as follows. They can be build separately with manually specified (via cmake gui) paths for their required depending modules.


* How to build the modularized code
#itk-vnl
  git://www.kitware.com/itk/itk-vnl.git


== Test ==
#itksys
  git://www.kitware.com/itk/itksys.git


* How to submit a build to the ITK Dashboard
#itk-zlib
* and where to find it.
  git://www.kitware.com/itk/itk-zlib.git


  http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization
  #nrrdio
  git://www.kitware.com/itk/nrrdio.git


#itk-common
  git://www.kitware.com/itk/itk-common.git


= CDash Tests =
#itk-io-common
url for the nightly run
  git://www.kitware.com/itk/itk-io-common.git


#itk-io-nrrd
  git://www.kitware.com:itk/itk/itk-io-nrrd.git


= Reference =
CTest results of those modules can be found on the dashboard:
http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization


  https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
= Tests with MIDAS data =
The testing data in this tutorial are all stored remotely in MIDAS.
Details of how to use MIDA data in testing can be found at:
http://www.kitware.com/midaswiki/index.php/MIDAS%2BCTest

Latest revision as of 16:00, 9 December 2011

Overview

  • Toy modular ITK design

This tutorial demonstrates the prototype of modularized ITK with a toy example containing seven modules required to build Nrrd image I/O programs. The seven library modules are:

 * itk-vnl (a subset of numeric libraries of VXL),
 * itksys (a system supporting library),
 * itk-common (core classes, macro definitions, typedefs, and other software constructs central to ITK),
 * itk-io-common (classes that support the reading and writing of data),
 * nrrdio (third-party library of nrrd image IO),
 * itk-io-nrrd (itk wrapper of nrrdio).
 * itk-zlib (zlib library wrapped up for nirrdio)
  • CMake prototyping

To enable ITK developers download and configure the whole modularized ITK package, we have prototyped several CMake packaging strategies. The major challenge is to manage dependencies between the modules. Two approaches have been proposed so far and are demonstrated in this tutorial.

One method uses "add_subdirectory" to include ITK modules in correct order according to their dependencies. Git submodule [1] is used to obtain all the modules all together with version controls. Here we refer this approach as "itk-complete" approach (Method A), which is designed for ITK developers. Another approach is to use the state-of-the-art cmake function "add_export_project" to automate the process of pulling selected modules from their repositories. Users can select the specific modules they need for their applications from the cmake gui. We refer to this second approach as "itk-optional" approach (Method B).

Requirements

  • A computer with a network connection
  • A build environment (gcc / VS)
  • CMake 2.8.2 installed([2])
  • Git 1.7.x.x installed ([3])

Build and test toy modular ITK

Method A: itk-complete

Download the itk-complete superproject package to the source directory (/src) using Git :

git clone git://www.kitware.com/itk/itk-complete.git

In the created itk-complete directory: ".gitsubmodule" file contains all submodules' urls; "itk-depends" module contains the dependencies among the modules and cmake codes to configure the superproject according to the dependencies. You will also see empty directories created for the seven modules.

Download toy modular ITK modules using git submodule :

# enter the itk-complete directory 
cd itk-complete
# add the submodule repository URLs
git submodule init
# clone the repositories and check out the commits specified in the superproject
git submodule update 

Now you have all the source codes ready for building the toy modular ITK.

Build itk-complete project in the build directory (/bin):

# CMake configure and generate
cd /bin/itk-complete
ccmake /src/itk-complete
# compile
make

Till now you have successfully build the modular ITK project from source codes. Their dependencies are automatically configured according to the predefined dependencies in the package.

Test itk-complete with an example application:

 # get the test package app-itk-complete
 git clone git://kwsource.kitwarein.com/itk/app-itk-complete.git
 # cmake configure and generate
 cd /bin/app-itk-complete
 ccmake /src/app-itk-complete
 # build and test
 make test

Two tests in the application are both related to nrrd image IO. The "itkNrrdVectorImageReadWriteTest" tests with a vector nrrd input image which is automatically downloaded from MIDAS database at the testing time (Test with MIDAS data).

Method B: itk-optional

Download the itk-optional package using Git to the source directory (/src):

git clone git://www.kitware.com/itk/itk-optional.git
# add the submodule repository URLs
cd /src/itk-optional
git submodule init
# clone the repositories and check out the commits specified in the superproject
git submodule update  

Build itk-optional project in the build directory (/bin):

# CMake configure and generate
cd /bin/itk-optional
ccmake /src/itk-optional
# compile
make

You will notice the modules are downloaded (as external projects) at the build time. The source codes are downloaded to the default binary directory where you build the project.

Test itk-complete with an example application:

 # get the test package app-itk-optional
 git clone git://itk.org/itk/app-itk-optional.git
 # configure and build
 cd /bin/app-itk-optional
 ccmake /src/app-itk-optional
 make test

Module-by-module

The repositories of the seven modules in the toy modular ITK are listed as follows. They can be build separately with manually specified (via cmake gui) paths for their required depending modules.

#itk-vnl
  git://www.kitware.com/itk/itk-vnl.git
#itksys
 git://www.kitware.com/itk/itksys.git
#itk-zlib
 git://www.kitware.com/itk/itk-zlib.git
#nrrdio
  git://www.kitware.com/itk/nrrdio.git
#itk-common
 git://www.kitware.com/itk/itk-common.git
#itk-io-common
 git://www.kitware.com/itk/itk-io-common.git
#itk-io-nrrd
 git://www.kitware.com:itk/itk/itk-io-nrrd.git

CTest results of those modules can be found on the dashboard:

http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization

Tests with MIDAS data

The testing data in this tutorial are all stored remotely in MIDAS. Details of how to use MIDA data in testing can be found at:

http://www.kitware.com/midaswiki/index.php/MIDAS%2BCTest