Developers

Below is information for installing and configuring Microsoft Visual C++ 2005 Express and all other necessary prerequisites for use with SimITK/VTK. This is intended to be used for development-level use and unnecessary for most users.


Tutorial: Installing SimITKVTK under Windows XP/Vista

Space Requirements

5-6 GB, not including MATLAB installation

Windows Requisites

MATLAB r2007 or r2008 already installed

Windows Requisites (at the time of this posting):

  1. Visual Studio C++ 2005 Express (VC++)
  2. Windows Platform SDK
    • Windows(R) Server 2003 SP1 Platform SDK Web Install (XP)
    • Windows(R) Server 2003 R2 Platform SDK Web Install (Vista)
  3. ActivePerl 5.10.1004
  4. ActiveTcl (8.3.5 suggested)

NOTE: The developer is encouraged to visit the MathWorks website to find the supported compiler for their version of MATLAB. The goal is to find a compiler that is both supported by the version of MATLAB that they have installed, and supported by ITK 3.20.

Download links will be provided below.

DISCLAIMER: All links provided below were functional as of 19-Jan-2009, the time of writing this document. Should any links have expired, please contact the SimITK/VTK developers for proper links should difficulties arise.

Installing the Requisites (should you not have them already)

Visual Studio C++ 2005 Express

Proceed to http://www.microsoft.com/express/2005/download/ and ensure that you download the VC++ web install. It should be called vcsetup.exe. Install the program wherever you see fit. This should be very straight-forward.

Windows(R) Platform SDK Web Install

Another package is needed because the compiler does not come with all the libraries and header files that are needed, e.g. windows.h and user32.lib. These files are installed with the Platform SDK.

Windows XP: Windows(R) Server 2003 SP1 Platform SDK Web Install

Proceed to  http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en and approximately half-way down the page download links will be visible. The PSDK-x86.exe file will most likely be sufficient, unless 64-bit Windows is your operating system. (This documentation was written from an installation on a 32-bit Windows installation on AMD 64-bit hardware).

When installing, select only the “Microsoft Windows Core SDK” and “Debugging Tools for Windows” features in their entirety. This is all that is needed for our purposes.

Vista: Windows(R) Server 2003 R2 Platform SDK Web Install

If installing VC++ under Windows Vista, proceed to  http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en, download the appropriate installer, and install. It requires that your copy of Windows is validated, so this additional step may be required. Note: this may take a while to install.

ActivePerl

Proceed to:  http://www.activestate.com/store/download.aspx?prdGUID=81fbce82-6bd5-49bc-a915-08d58c2648ca and choose the MSI package for download. Version 5.10.0.1004 was the available version at the time of writing this document.

Install ActivePerl. It is recommended that it is installed to the root of the hard drive for the sake of simplicity.

ActiveTcl

VTK depends on this being installed. Proceed to: http://downloads.activestate.com/ActiveTcl/

Once there, choose “Windows” then “8.3.5″. Version 8.3.5 of ActiveTcl has been found ensures VTK compatibility.

Just like Perl, it is strongly recommended that Tcl is installed to the root of the hard drive.

CMake

Proceed to: http://www.cmake.org/cmake/resources/software.html and download the appropriate installer.

By default, CMake is not added to the system PATH so ensure that CMake is added to the system PATH for at least the current user. If you are planning to use CMake with more than just the current user, add for all users. This will be needed later when building ITK, VTK, and SimITKVTK.

Install, and your machine is almost prepared to install ITK and VTK.

Tweaking VC++

Open VC++ (for the author, it was found at Start -> All Programs -> Visual C++ 2005 Express Edition).

Once open, go to Tools -> Options…

In the open dialog box, open the “Projects and Solutions” subcategory and choose “VC++ Directories”. Two additions need to be made here. Note in the top-right hand corner, you have a pull down menu “Show directories for”.

  1. Pull that down to “Include files”.If you installed the Platform SDK as outlined here, you’re going to need to add the path to the Include folder therein. To do this, click the “new folder” icon and a new text entry field will appear. Enter the path to the include folder accordingly. For the author, this was:
    1. C:\Program Files\Microsoft Platform SDK\Include (XP) or
    2. C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include (Vista).
  2. After, click the checkmark icon to be sure that it likes your path.
    You will be given no confirmation should it be an acceptable path.
  3. Pull the same menu down to “Library files”Again, provided you followed the previous SDK steps, the \Lib directory will need to be
    added to VC++. Press the “new folder” button and enter, what was for the author,
    C:\Program Files\Microsoft Platform SDK\Lib (XP) or
    C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib (Vista),
    ensuring that the “Library Files” option is selected from the pull-down menu. Click the
    checkmark button for confirmation. Again, no news is good news when choosing this folder.
  4. Pull the same menu down to “Executable files”Again, provided you followed the previous SDK steps, the \Bin directory will need to be
    added to VC++. Press the “new folder” button and enter, what was for the author,
    C:\Program Files\Microsoft Platform SDK\Bin (XP) or
    C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin (Vista),
    ensuring that the “Executable Files” option is selected from the pull-down menu. Click the
    checkmark button for confirmation. Once again, no news is good news when choosing this folder.

This last entry is needed so CMake can find the VC++ compiler (first line) which depends on the user32.lib found in the \Lib folder.

Installing ITK

Note: The remainder of this tutorial makes use of the VC++ Graphical environment. The command-line interface (CLI) included with VC++ can alternatively be used as it is less demanding on computer resources. This information is contained within an appendix that can be found here at the end of this document.

Download ITK from http://itk.org/ITK/resources/software.html. Extract it to the root directory along with Perl and Tcl. Open the ITK folder and a folder starting with “InsightToolkit” will be seen. In the same directory as InsightToolkit, create a new folder called “ITK-build”. The name of this folder is up to the user, but the “-build” convention will be used throughout this documentation.

With these two folders made, open CMake. CMake a simple looking window that will open with two text entry fields at the top: Source and Binary Build locations. Browse the source field to the InsightToolkit folder. Now, browse the Binary Build to your ITK-build folder. Press Configure. When prompted for what you would like to “Build For”, choose “Visual Studio 8 2005″. Configuration will take place (be prepared to wait a few minutes).

Ensure that the following flags below are set accordingly. Note: You will need to click the “Show Advanced Values” checkbox to set the latter entries. It is crucial that the entries are as follows. Leave all non-mentioned variables as-is.

  • BUILD_DOXYGEN = OFF
  • BUILD_EXAMPLES = OFF
  • BUILD_SHARED_LIBS = ON
  • BUILD_TESTING = OFF
  • ITK_USE_OPTIMIZED_REGISTRATION_METHODS = ON
  • ITK_USE_ORIENTED_IMAGE_DIRECTION = ON
  • ITK_USE_PATENTED = OFF
  • ITK_USE_REVIEW = ON

Once these flags are set accordingly, press configure again. In some cases, the OK button will remain ghosted. If this is the case, press the configure button until OK is no longer ghosted. This will cause CMake to generate the files necessary to build ITK.

Open the ITK-build folder and look for the ITK.sln file. Open it, and VC++ will open. At the top, a pull down menu saying “Debug” will be visible. Change this to “Release” and press F7 to begin building of the ITK “solution”. Expect this to take a minimum of 15 minutes.

Note: The release flag is crucial to proper SimITKVTK installation.

This will compile and build ITK to be installed on your machine. ITK needs to now be added to the Environment Variables. Repeating the process outlined earlier, add

C:\ITK\ITK-build\bin\release;

to your PATH.

Installing VTK

The process to install VTK is very similar to ITK. Download VTK from http://vtk.org/get-software.php. However, do not get the Windows install binary. VTK needs to be built and compiled from source for use with SimVTK.

Follow the same steps outlined for ITK:

  1. unzip
  2. create VTK-build folder
  3. open CMake
  4. set source directory
  5. set destination directory.

Below are the flags that will need altering:

  • BUILD_DOCUMENTATION = OFF
  • BUILD_EXAMPLES = OFF
  • BUILD_SHARED_LIBS = ON
  • BUILD_TESTING = OFF

Note: In the event a line “VTK_DATA_ROOT-NOTFOUND” is seen. Disregard it and proceed as normal.

Click the Configure button until OK is an option and then click OK. Once done, open the VTK-build folder and find the VTK.sln file and open it in VC++. Change the top to “release” and press F7. This will build VTK in the same manner ITK was built.

Upon completion, add VTK to the Environment Variables PATH as done for ITK. For the author this was:

C:\VTK\VTK-build\bin\release;

With ITK and VTK installed, SimITKVTK can be installed.

Installing SimITK

Download the SimITKVTK .zip file from the downloads section and unzip it. Like the other installations, it is recommended that SimITK and SimVTK are installed to your root directory. Make a new SimITK-build folder, just like before, and open CMake.

As your source, choose the SimITK\Source folder. As for the Binary Build folder, choose your SimITK-build folder. Again, press configure and allow configuration to take place. In case CMake is unable to find your MATLAB installation, follow the steps below.

What if I installed MATLAB *not* to the default install location?

Go to the SimITK\Source folder and find the “CMakeLists.txt” file and augment it with anything but Windows Notepad (Notepad formatting will make this process much harder and the chance that something will go awry is very high). Change lines 26 through 29 to reflect where CMake should look to find your MATLAB root.

Press the configure button and allow the configuration to occur. Again, press configure one more time, as the default configuration will be perfect, and then press OK. When completed, find the SimITK.sln file, open it with VC++, change the pull-down menu to “release” and press F7.

Allow the build process to take place. This takes a little while (upwards of an hour is not out of the question).

Once done, SimITK has been installed!

Installing SimVTK

It’s the exact same process as ITK except change every instance of ITK for VTK:

  1. Make the build folder
  2. Click configure until OK is an option
    • Should the CMakeLists.txt file need augmentation, do so as necessary
  3. Click the OK button to generate the files
  4. Open the SimVTK.sln file
  5. Change to “release”
  6. And finally F7 to build.

This will take a while (possibly more than an hour). There are lots of files to build (1150+ projects).

Once done, SimVTK has been installed!

Configuring MATLAB

MATLAB and from under the File menu, choose “Set Path…”. Click “Add with Subfolders…” and choose your SimITK-build\bin folder, then click the Add with Subfolders again to add your SimVTK-build\bin folder. This will add many, many folders to your Set Path, but it is necessary for Simulink to find the blocks necessary.

Following the configuration of MATLAB, SimITKVTK is ready for use. Examples are included in the unzipped SimITK\Examples or SimVTK\Examples directories (not to be confused with the build directories).

Happy SimITKVTKing!

> Continue onto the Getting Started tutorial.


Appendix A: Using the VC++ CLI to Build

Using the CLI to build these projects follows the same steps as outlined in the tutorial. The only difference is that a command-line interface will be used throughout instead of the graphical user interfaces that would have been used otherwise.

To begin, open the “Visual Studio 2005 Command Prompt” found in the “Visual Studio Tools” folder within your Visual C++ folder found under Start -> All Programs. This CLI looks exactly as the Windows standard CLI, but all of the appropriate environment variables (like those modified in the options for VC++ earlier in the tutorial) are automatically set for program building and compilation.

ITK

Just as in the tutorial above, download ITK from http://itk.org/ITK/resources/software.html. Extract it to the root directory along with Perl and Tcl. Open the ITK folder and a folder starting with “InsightToolkit” will be seen. In the same directory as InsightToolkit, create a new folder called “ITK-build”. The name of this folder is up to the user, but the “-build” convention will be used throughout this appendix.

In the CLI window, change your directory to the ITK-build directory you just created. From here, CMake will then be called from the CLI to generate the appropriate makefiles. Instead of using the VC++ makefiles that would be used in the tutorial, we wish to use NMake that will build and compile from the command-line, an option that CMake offers.

Enter the command (case-sensitive, without quotes):

cmake -G “NMake Makefiles” ..\InsightToolkit-3.10.0

The configuration process will then take place. After all the checks have taken place, a file, CMakeCache.txt, will be found within the ITK-build folder. It will need to be modified as the default build flags are not optimal. Do not modify this file with Notepad as all formatting is lost and the likelihood of formatting the file improperly for CMake increases greatly.

Change the following flags accordingly: Leave all non-mentioned variables as-is.

  • BUILD_DOXYGEN = OFF
  • BUILD_EXAMPLES = OFF
  • BUILD_SHARED_LIBS = ON
  • BUILD_TESTING = OFF
  • CMAKE_BUILD_TYPE = Release
  • ITK_USE_OPTIMIZED_REGISTRATION_METHODS = ON
  • ITK_USE_ORIENTED_IMAGE_DIRECTION = ON
  • ITK_USE_PATENTED = OFF
  • ITK_USE_REVIEW = ON

Enter the “cmake -G “NMake Makefiles” ..\InsightToolkit-3.10.0” a second time as it will update all of the configuration parameters that had just been altered. You will be given an output that “Build files have been written to: (directory)” upon reconfiguration.

From within the ITK-build directory, execute the “nmake” command. This will then build and compile ITK. Upon completion, ITK will have been built. The last step will be adding ITK to the Environment Variables PATH variable. Repeating the process outlined earlier, add:

C:\ITK\ITK-build\bin;

to your PATH. ITK is now completely built, compiled, installed, and ready to use on your system!

As a note, all future builds in this appendix will follow this same process of:

  1. Download source code
  2. Create “-build” directory
  3. Open VC++ CLI
  4. Execution of “cmake -G “NMake Makefiles” ..\(path to source)
  5. Modification of CMakeCache.txt
  6. Re-execution of “cmake -G “NMake Makefiles” ..\(path to source)
  7. Execution of “nmake
  8. Addition to Environment Variables PATH variable

VTK

As outlined, download the source code from Download VTK from http://vtk.org/get-software.php. However, do not get the Windows install binary. VTK needs to be built and compiled from source for use with SimVTK.

Create the “VTK-build” directory and navigate to it in the VC++ CLI. Execute the “cmake -G “NMake Makefiles” ..\(path to source)” command and open then generated CMakeCache.txt file and make the following adjustments:

  • BUILD_DOCUMENTATION = OFF
  • BUILD_EXAMPLES = OFF
  • BUILD_SHARED_LIBS = ON
  • BUILD_TESTING = OFF
  • CMAKE_BUILD_TYPE = Release

Run the “cmake -G “NMake Makefiles” ..\(path to source)” command a second time to instill the modifications made. Following this, execute the “nmake” command, allow the build and compilation process to occur, and add the following to your Environment Variables PATH variable:

C:\VTK\VTK-build\bin;

VTK is now installed, setup, and configured to run on your system!

SimITK/VTK

Note: The process for SimITK and SimVTK are the same with the only exception being the name difference. Follow the exact same steps with VTK substituted for ITK to build and compile VTK.

Download the SimITKVTK code package and unzip. It is recommended that this is placed in the same location as tcl, perl, ITK, and VTK. Within the unzipped SimITKVTK folder, create “SimITK-build” and “SimVTK-build” folders.

In the event that your MATLAB installation is not in a default location (installed to another drive besides the C: drive, for example), follow these instructions to learn how to modify the CMakeFiles.txt files found in the SimITK/VTK\Source folder before executing the appropriate “cmake -G “NMake Makefiles” ..\(path to source)” command for each folder. Once the cmake command has run, no modification will be necessary to the CMakeCache.txt files within each folder.

Execute the “nmake” command and allow the build and compilation process to occur. Upon completion, you will have new Simulink MATLAB Model Libraries corresponding to ITK/VTK for use in Simulink! The final step is adding these folders to the MATLAB “Set Path..” within MATLAB. For these instructions, please click here.

This completes the installation of MATLAB under Windows using the Command-Line Interface as opposed to the graphical interface of CMake and VC++.

> Continue onto the Getting Started tutorial.

Comments are closed.