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

From KitwarePublic
Jump to navigationJump to search
 
(72 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Overview ==
= Overview =
* Toy Example design: this tutorial demonstrates the prototype of modularized ITK with an toy example containing six modules and a testing application. The toy modular ITK package contains six library modules and a test application, which reads and writes images in Nrrd format.
* Toy modular ITK design
They are listed as follows:
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),
   * 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)


* CMake prototyping
* CMake prototyping
To enable ITK developers download and configure the whole modularized ITK package, redesigning the cmake configurations of the modularized ITK is necessary. The major challenge is to manage dependencies between the modules. A classic CMake approach is to use "add_subdirectory" to include each module in correct order according to their dependencies. Here we refer this approach as "sub directory" approach (Method A). Another approach is to use the state-of-the-art cmake function "add_export_project" to automate the process of pulling codes and data from their repositories. We refer to this second approach as "export project" approach (Method B).
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([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=
*itk-vnl
 
  git://kwsource.kitwarein.com/itk/itk-vnl.git
== Method A: itk-complete  ==
*kwsys
  git://kwsource.kitwarein.com/itk/kwsys.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
*test-itk-nrrd
  git://kwsource.kitwarein.com/itk/test-itk-nrrd.git


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.


= Method A: Sub-Directory Approach =
Download toy modular ITK modules using [https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial git submodule] :
To enable downloading and configure the whole modularized ITK package for usual ITK developers, the classic CMake approach is to
# enter the itk-complete directory
use "add_subdirectory" to include each module in correct order according to their dependencies.
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.


== Download ==
Build itk-complete project in the build directory (/bin):
Git repository:
# CMake configure and generate
*itk-devel
cd /bin/itk-complete
  git://kwsource.kitwarein.com/itk/itk-devel.git
ccmake /src/itk-complete
*itk-depends
# compile
  git://kwsource.kitwarein.com/itk/itk-depends.git
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.  


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


* How to configure the modularized code
  # cmake configure and generate
** CMake commands...
  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]).


== Build ==
== Method B: itk-optional ==


* How to build the modularized code
Download the itk-optional package using Git to the source directory (/src):
git clone git://www.kitware.com/itk/itk-optional.git


== Test ==
# 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 submit a build to the ITK Dashboard
Build itk-optional project in the build directory (/bin):
* and where to find it.
# CMake configure and generate
cd /bin/itk-optional


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


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