This ITK Software Guide is the handbook for developing software with ITK.
It is divided into two companion books.
The first book covers building and installation, general architecture and design, as well as the process of contributing in the ITK community.
The second book covers detailed design and functionality for reading and writing images, filtering, registration, segmentation, and performing statistical analysis.
This repository contains the source code for the Software Guide.
A combination of CMake
Superbuild
infrastructure, Python extraction scripts, and LaTeX
formatting are required to render the entire ITK Software Guide.
CMakeLists.txt
files are placed in the directories
involved on the build process. As any other CMake-managed process, the results
of the build process are put in a binary tree corresponding to the source tree.
The following dependencies are required to build ITK Software Guide on Linux or Windows platforms:
- Git
- Python
- ImageMagick: Windows installer can be found here.
- LaTeX and BibTeX. See the preamble of the
./SoftwareGuide/Latex/00-Preamble-Common.tex
file for the full list of required LaTeX packages. Among these packages, the Minted package for syntax highlighting in its turn depends on a Python package Pygments. Instructions for installing Minted and Pygments packages on Windows are available here. - dvips, ps2pdf. While on Linux platforms these tools are usually included with most distributions, on Windows platforms they are usually included in MikTex Latex distribution.
ITK Software Guide is generated with Latex by using input from a variety of source code files and images:
- LaTeX files found in
./SoftwareGuide/Latex
. - JPEG, PNG and EPS files in
./SoftwareGuide/Art
. - PNG files generated as the result of compiling and running the examples included in the ITK source code.
- ITK examples source code
.cxx
files where the comments delimited withBeginLaTeX
,EndLaTeX
andBeginCodeSnippet
,EndCodeSnippet
have been written specifically to be included in the ITK Software Guide; the regular LaTeX files in./SoftwareGuide/Latex
include the LaTeX files generated from the ITK examples source code.
Following is a brief description of the build process:
- The source code of
ITK
is downloaded and built (including ITK examples) in the binary output directory. - JPEG and PNG files in the
./SoftwareGuide/Art
directory are converted to EPS using ImageMagick tools; the resulting EPS files are saved in theArt
directory in the binary output directory. - PNG files are generated by running ITK examples and converted to EPS using
ImageMagick; the resulting EPS files are saved in
Art/Generated
directory of the binary output directory. - A Python script
./SoftwareGuide/Examples/ParseCxxExamples.py
is invoked to extract the comments in the ITK examples source file delimited withBeginLaTeX
,EndLaTeX
andBeginCodeSnippet
,EndCodeSnippet
and generate LaTeX files which are copied into theExamples
subdirectory of the binary output directory. - The top-level LaTeX file
./SoftwareGuide/LaTeX/ITKSoftwareGuide-Book1.tex
is compiled with a series of calls tolatex
,bibtex
,latex
,makeindex
,dvips
, andps2pdf
to generate the PDF file.
All the dependencies described above are available pre-installed in a Docker image.
- Download and install Docker.
- If on Mac or Windows, start a
boot2docker
shell.
$ git clone https://github.com/InsightSoftwareConsortium/ITKDevelopmentEnvironment.git
$ cd ITKDevelopmentEnvironment/Docker
$ ./build.sh itksoftwareguide-edit && ./run.sh itksoftwareguide-edit
- Go get a coffee and curl up with a good book -- it will take a while.
- Connect to your system with your browser at
http://host:port
, where host islocalhost
on Linux and the output ofboot2docker ip
on MacOS and Windows. On Windows, make sure to runboot2docker ip
from a normal Git bash shell. port is the result ofdocker port itksoftwareguide-edit 3000
run inside the docker environment. An example:http://192.168.59.103:49153
.y Both the username and password to connect are "itk". - To view the built PDF's, navigate to
bin/ITKSoftwareGuide/SoftwareGuide/Latex/
, click on the PDF, then the download button. - To edit the sources, edit the files in
src/ITKSoftwareGuide/SoftwareGuide/Latex/
. - To build changes, run
make
from the directory/home/src/itk/bin/ITKSoftwareGuide
using a terminal available from the Term button of the web interface. - To commit a patch and submit it to Gerrit, use the same contribution process
described below in the directory
/home/itk/src/ITKSoftwareGuide
.
Following is the description how to configure and build ITK Software Guide using CMake:
- Run cmake-gui and specify input and binary output directories. Alternatively, create the binary output directory and run
$ ccmake source_dir
where source_dir is the full path of the ITKSoftwareGuide
directory.
2. Configure and generate the project for the target platform.
3. Build SuperBuild\_ITKSoftwareGuide
project as appropriate for the target
platform.
-
Build process will fail if CMake is unable to locate any of the dependencies. In this case a close examination of the error messages might provide a clue as to which dependency is failing.
-
Frustrated by the build taking a long time to complete ... no solution here 😊.
Contributions are welcome and appreciated!
The following commands illustrate patch submission to GitHub:
$ git clone https://github.com/InsightSoftwareConsortium/ITKSoftwareGuide.git
$ cd ITKSoftwareGuide
$ ./Utilities/SetupForDevelopment.sh
$ git checkout -b my-topic
# make changes to local file(s)
$ git add -- changedFileName
$ git commit
$ git review-push
For more detailed instructions, see the CONTRIBUTING.md file.