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

From KitwarePublic
Jump to navigationJump to search
 
(84 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Overview ==
= Overview =
This tutorial demonstrates the prototype of modularized ITK with an toy example containing six modules and a testing application. The test application "itkNrrdImageIOTest" reads and writes images in Nrrd format. The five library modules that are required to build the test application are:
* Toy modular ITK design
* itk-vnl (a subset of numeric libraries of VXL)
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:
* kwsys (a supporting library for )
  * itk-vnl (a subset of numeric libraries of VXL),
* itk-common (core classes, macro definitions, typedefs, and other software constructs central to ITK)
  * itksys (a system supporting library),
* itk-io-common (classes that support the reading and writing of data)
  * itk-common (core classes, macro definitions, typedefs, and other software constructs central to ITK),
* nrrdio (third-party library)
  * itk-io-common (classes that support the reading and writing of data),
* itk-io-nrrd (itk wrapper of nrrdio).
  * 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 [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).


= 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
* CMake 2.8.2 installed([http://www.cmake.org/cmake/resources/software.html])
* Git installed
* Git 1.7.x.x installed ([http://git-scm.com/download])


= Method A: Subdirs =
= Build and test toy modular ITK=


== Download ==
== Method A: itk-complete  ==


Git repositories:
Download the itk-complete superproject package to the source directory (/src) using Git :  
git://kwsource.kitwarein.com/itk/nrrdio.git
git clone git://www.kitware.com/itk/itk-complete.git
git://kwsource.kitwarein.com/itk/itk-common.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.  
git://kwsource.kitwarein.com/itk/itk-io-common.git
git://kwsource.kitwarein.com/itk/kwsys.git
git://kwsource.kitwarein.com/itk/itk-io-nrrd.git
git://kwsource.kitwarein.com/itk/test-itk-nrrd.git


Download toy modular ITK modules using [https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial 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.


== Configure ==
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.


* How to configure the modularized code
Test itk-complete with an example application:
** CMake commands...
  # get the test package app-itk-complete
  git clone git://kwsource.kitwarein.com/itk/app-itk-complete.git


== Build ==
  # 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  [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]).


* How to build the modularized code
== Method B: itk-optional ==


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


* How to submit a build to the ITK Dashboard
# add the submodule repository URLs
* and where to find it.
cd /src/itk-optional
git submodule init
# clone the repositories and check out the commits specified in the superproject
git submodule update 


  http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization
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.


= Method B: Superbuild =
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


== Download ==
== 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 download the modularized code
#itk-vnl
  git://www.kitware.com/itk/itk-vnl.git


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


* How to configure the modularized code
#itk-zlib
** CMake commands...
  git://www.kitware.com/itk/itk-zlib.git


== Build ==
#nrrdio
  git://www.kitware.com/itk/nrrdio.git


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


== Test ==
#itk-io-common
  git://www.kitware.com/itk/itk-io-common.git


* How to submit a build to the ITK Dashboard
#itk-io-nrrd
* and where to find it.
  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
  http://www.cdash.org/CDash/index.php?project=Insight#ITKv4_Modularization


== Reference ==
= Tests with MIDAS data =
 
The testing data in this tutorial are all stored remotely in MIDAS.
  https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
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