# Installing and Compiling itk

This document provides basic instructions for downloading and compiling itk on Windows and Unix machines.

It is assumed that you have a login and password for accessing the itk CVS repository. If you have problems with your login or password, please contract Ken Martin ken.martin@kitware.com

If you have problems or questions with this document, please contact Stephen R. Aylward, UNC-CH, aylward@unc.edu

If you have problems or questions during compilation, please send a detail description to the itk mail list: insight-developers@www.itk.org

## I. Dowloading itk

# CVS

Itk is distributed and updates are maintained using a CVS server. CVS and details regarding its usage are available on the WWW:

CVS Home and Unix Software:

http://www.cvshome.org/

PC Software:

http://www.wincvs.org/ (a stand-alone GUI)

http://www.geocities.com/kaczoroj/CvsIn/ (a plug-in for VC++)

CVS Instructions

http://cvsbook.red-bean.com/cvsbook.html

Three issues must be address when using CVS to obtain a software archive

1) Specifying the CVS server

2) Obtaining (“check out”) the initial installation

3) Performing subsequent “upgrades” to get the latest version of the software

This paper doesn’t address adding software to the repository.

Platform-specific instructions for specifying a server and doing a check-out:

# Unix

> alias cvsI “cvs –d :pserver:YourLogin@www.itk.org:/insight/cvsroot”

> cvsI login

…enter password

> cvsI checkout Insight

An environment variable could be used instead of the alias in the above sequence of commands, but if you access multiple CVS archives (using different servers), we have found using aliases to be easiest to switch between servers versus changing environment variables.

### Windows: Option 1: Using WinCVS

Get WinCVS: www.wincvs.org

Menu: Admin/Preferences…

Tab: General

Set:

CVSROOT: :pserver:YourLogin@www.itk.org:/insight/cvsroot

Authentication: “passwd” file on cvs server

Menu: Admin/Loing…

Enter password

Menu: Admin/Command line…

Cvs checkout Insight

### Windows: Option 2:: Using CVS via CYGWIN (pc unix) recommended

Get Cygwin

http://sources.redhat.com/cygwin/download.html

Use setup.exe

Get latest development snapshot (considered to be V1.1)

Get /usr/local/ stuff for Cygwin

http://cygutils.netpedia.net/V1.1/usr-local/index.html

includes cvs and vim

Then do Unix installation (see above)

We strongly recommend this approach. This version of CVS is very stable and Cygwin is an excellent unix-like environment for the PC. Via this approach you will also have access to a number of other useful tools such as g++, grep, sed, vim, etc on the PC. Since itk doesn’t provide a GUI, having a good command-line interface is essential.

Performing “upgrades” to get the latest version of the software

You can view the latest modifications to the repository via the www at http://www.itk.org/cgi-bin/itkcvsweb.cgi/

If you want to upgrade your local version to the most recent release, do the following:

Unix and Windows: Cygwin

From within the Insight directory (at any level, all things from that level in the directory hierarchy and down are upgraded)

> cvsI update

Windows: WinCVS

With the Insight directory selected (all things from that level in the directory hierarchy and down are upgraded)

Press the Upgrade button – green down-arrow button at the top of the WinCVS window

## II. Compilation

With itk, it is easy to create installations/libraries for multiple platform. This is implemented by locating source separate from object files. This separation also helps simplify/localize CVS interactions.

So, at the same level as the Insight directory, create directories for the object files for each platform you will be compiling for.

E.g.,

~/src/Insight (the CVS repository)

~/src/Insight-VC++/

~/src/Insight-Cygwin/

~/src/Insight-Sun/

Platform specific instructions are below:

# Windows: VC++

This process will have you create a program that you will run that will in-turn create workspace and project files, specialized for your directory structure, that will create the library files and several test programs.

Open the directory Insight/Code/tools

Open pcbuilder.dsw – this should start MSVC++

Menu: Build: Batch Build

Check all boxes

Press Rebuild All

After build, with pcbuilder project active, press execute “!” button

Specify Insight directory using the browse button (e.g., E:/src/Insight)

Specify your object directory as the destination directory (e.g., E:/src/Insight-VC++)

This creates a directory structure under the destination directory and fills that directory structure with appropriate .dsp and .dsw files.

Open the top-level itk workspace file in the destination director

e.g., E:/src/Insight-VC++/itk.dsw

Menu: Build: Batch Build

Select all and then check boxes

Press Rebuild All

After the build completes, run a few tests

Windows: Cgywin

> mkdir Insight-Cygwin (same level as Insight directory)

> cd Insight-Cygwin

> ../Insight/configure

> make

Unix

> mkdir Insight-Sun

> cd Insight-Sun

> ../Insight/configure

> gmake