Anda di halaman 1dari 5

BUILDING ITK SNAP FROM SOURCE CODE ON WINDOWS

Created By:
Akshat Bordia

This tutorial provides a step by step walk through of building ITK-SNAP2.4.0 from source on
Windows. We will be using Microsoft Visual Studio 2010 for building the application. Make sure you
have VS 2010 installed and VS Service Pack 1 as well. (if required)
Before starting building ITK-SNAP, we need to build following libraries :
A. Insight Toolkit (4.2.0)
B. VTK 5.6.1
C. FLTK 1.3
A. Download an extract Cmake:
1. Download Cmake 2.8.12.2 zip file. (Link: http://www.cmake.org/files/v2.8/cmake-2.8.12.2-
win32-x86.zip)
2. Extract the Cmake zip file.
B. Installation of ITK 4.2.0:
1. Download ITK 4.2.0 source code.
(http://downloads.sourceforge.net/sourceforge/itk/InsightApplications-4.2.0.zip)
2. Create a folder named ITK and create two subfolder in that folder named Source and
Build.
3. Extract the ITK source code in ..\ITK\Source folder.
3. Now go to ..\Cmake\bin and double click on cmake-gui to open Cmake GUI window.
4. Provide address of ..\ITK\Source in Where is the source code: field of Cmake. Similarly
provide address of ..\ITK\Build in Where to build the binaries: field of Cmake. Cmake
window should look like this:



5. Click on Configure at the bottom left of gui window. A pop-up window will appear for
specifying the generator for the project.
6. Choose Visual Studio 10 and click on Finish.
7. Files will be configured and red icons will appear.
8. Click on Configure again.
9. Now click on Generate.
10. Now open Visual Studio 2010 as administrator. (Run as administrator)
11. Load ..\ITK\Build\ITK.sln project file in VS2010.
12. Right click on ALL Build and click on Build Solution.
13. Right Click on Install and click on Build.

C. Installation of VTK 5.6.1 and FLTK 1.3.0 :
Link to download VTK 5.6.1 : http://www.vtk.org/files/release/5.6/vtk-5.6.1.zip
Link to download FLTK 1.3.0 :
http://www.fltk.org/software.php?VERSION=1.3.2&FILE=fltk/1.3.0/fltk-1.3.0-source.tar.gz

Installation of these two are similar to that of ITK. Folder for all of them must be separate. Directory
structure should be like this :
C:\
ITK
Source
Build
VTK
Source
Build

FLTK
Source
Build

D. Installation of ITK-SNAP 2.4.0:

Download ITK-SNAP 2.4.0 source code from here : http://sourceforge.net/projects/itk-
snap/files/itk-snap/2.4.0/itksnap-2.4.0-20121121-source.tar.gz/download
Procedure to install ITK-SNAP is similar to ITK. But while building ITK-SNAP (after step 7 of
section B) , Cmake might not automatically set all variable and/or their values.
Hence one needs to manually set those variables and their values. Variables can be added
by clicking on Add Entry at the top right.


Following is a screenshot of all the variables required and their values :



A list of the variables, their type and value is as follows:
Variable Name Type Value
BUILD_OUTSIDE_INSIGHT_APPLICATION
S
BOOL
BUILD_TESTING BOOL
CMAKE_CONFIGURATION_TYPES STRING Debug;Release;MinSizeRel;
RelWithDebInfo
CMAKE_INSTALL_PREFIX Path /Program Files(x86)/SNAP
FLTK_BASE_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkd.lib
FLTK_FLUID_EXECUTABLE FILE
PATH
../FLTK/Build/bin/Debug/fluid.exe
FLTK_FORMS_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkformsd.lib
FLTK_GL_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkgld.lib
FLTK_IMAGES_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkimagesd.lib
FLTK_INCLUDE_DIR PATH ../Program Files (x86)/FLTK/include
FLTK_JPEG_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkjpegd.lib
FLTK_PNG_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/fltkpngd.lib
FLTK_ZLIB_LIBRARY FILE
PATH
../FLTK/Build/lib/Debug/zlibd.lib
ITK_DIR PATH ../ITK/Build
SNAP_BUILD_MACHINE STRING Machine user name
SNAP_USE_FLTK_JPEG BOOL
SNAP_USE_FLTK_PNG BOOL
SNAP_USE_FLTK_ZLIB BOOL
VTK_DIR PATH ../VTK/Build

Generally directory path of ITK, VTK, FLTK, FLTK libraries, Fluid executable are not set
automatically. One can create corresponding varibles of those types. Values can be set
similar to relative path shown in table using gui.


After setting all the variables follow step 8 to 13 of section A.
ITK-SNAP executable will be created in
\Program Files(x86)\SNAP\bin\InsightSNAP.exe
and
\ITK SNAP\Build\Debug\InsightSNAP.exe.

Now we can run ITK-SNAP by double clicking on the executable created in above folders.

Anda mungkin juga menyukai