SimpleITK/GettingStarted

From KitwarePublic
Jump to navigationJump to search

SimpleITK provides a simplified interface to ITK in a variety of languages. You can either download binaries, if they are available for your platform and prefered language, or you can build SimpleITK yourself.

Additionally, there are several recommended third-party software packages.

After you have installed SimpleITK, please look to the Tutorial or the Doxygen pages for more information.

Binaries

Currently, we provide binary distributions for a number of systems of SimpleITK for python which can make getting started very easy.

Python

The list of the binary python packages available is maintained here.

Both your version of python and operating system must be available to be able to use the binary distribution. The package does not need to be downloaded from above, as SimpleITK is registered on the Python Packaging Index. The binary built packages are distributed as python eggs. They can be installed with the "easy_install" utility from the setuptools python package.

If your system does not already have easy_install you will need to install this python package. Please go to the setuptools setuptools home page for detailed instructions.

Once you have installed setuptools and easy_install is in your path then run the following command:

$ easy_install SimpleITK

This command will check the available packages, and choose the one that is most recent and matches your system. On Unix based system you may need to be root:

$ sudo easy_install SimpleITK

For advanced users you may be able to install SimpleITK in a virtual python environment, so that it does not modify the global python environment.

Build It Yourself

SimpleITK takes a while to build. To build SimpleITK you need a recent version of cmake. And a supported compiler.

Released source code can be found on SimpleITK's SourceForge Page.

Alternatively, the latest developmental version can be download with git.

git clone --recursive  http://itk.org/SimpleITK.git

After SimpleITK's souce code is obtained it is STRONGLY recommended to run cmake on the SuperBuild subdirectory of SimpleITK:

mkdir SimpleITK-build
cd SimpleITK-build
cmake ../SimpleITK/SuperBuild

The SuperBuild will automatically download and build the matching version of ITK and SWIG needed to compile SimpleITK. This is the recommended way to build SimpleITK and is easiest.

If you get an error message saying that ITK_DIR is not set then, you did not correctly point cmake to the SuperBuild sub-directory. Please erase your binary directory, and point cmake to the SimpleITK/SuperBuild sub-directory.

The cmake configuration process should automatically find supported languages and enable SimpleITK wrapping for them. To manually enable a language toggle the appropriate WRAP_LANGUAGE cmake variable to ON. Verify and/or correct the advanced cmake variables to the language specific executable, libraries and include directories.

Then use your make utility or your cmake choosen build utility to build SimpleITK. After completion, add the SimpleITK-build/lib directory to you LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (Mac) environment.

Testing

cd SimpleITK-build/SimpleITK-build
ctest

If all tests fail, verify that you have the testing data in your source tree (the reason for the "--recursive" flag in the git command) AND that you've added the correct path to your *_LIBRARY_PATH.

Python installation

To install a built python package, as root:

 cd SimpleITK-build/Wrapping
 python PythonPackage/setup.py install

Recommended Software

To enable the "sitk::Show" function to work we recommend downloading a recent version of ImageJ. The recent versions come with support for the Nifti ( *.nii ) file format which SimpleITK uses to display.

If you are using python, ipython is great environment to perform interactive commands for image processing.