introduction
VTK library is use for 3D computer graphics, image processing and visualization ITK library contains powerful image processing and registration tools
I have used ITK on Windows for a few months. Since my laptop is MacBook Pro and most of programming were done on it, I was looking for a tutorial of how to install ITK on Mac OS. I found two tutorials: one is for installing VTK on Mac and the other is installing ITK via MacPorts. The version of ITK on MacPorts is so... old. Thus, I consulted the tutorial of installing VTK on Mac and installing ITK on Windows to fulfill my task. After finishing this job, I felt it was not so difficult as I thought.
(1) Preparation -- Download necessary tool and files
- CMAKE: http://www.cmake.org/cmake/resources/software.html
- ITK: http://www.itk.org/ITK/resources/software.html (the file ending with".tar.gz")
- Simply extract the file from what download.
- Double click on the .dmg file.
- Before finishing, check the option: Install Commond-Line Link
- Extract the ITK package that you just dowloaded to a directory. Rename it as InsightToolKit (eg. /User/Jianxu/Document/ITK)
- Create a new directory in the same folder, called ITKbin. ( /User/Jianxu/Document/ITK/ITKbin) . Now in the folder ITK, you the source folder (InsightToolKit), which you just extracted, and an empty installation folder(ITKbin), which you just created.
- Open CMake. Choose default comiler as Unix MakeFiles
- In the top two lines, set Source code as /User/Jianxu/Document/ITK/InsightToolKit and set the binaries as /User/Jianxu/Document/ITK/ITKbin
- Click Configure
- Choose (Advance). You can see bunch of red-marked lines in the window. Make the following changes:
Build_Examples: OFF (I don't need those examples.)
Build_Shared_Libs: OFF (I need static lib to share the program others who doesn't have ITK)
64bit_IDT: ON (Important! If you don't set this flag, your program would easily run out of memory when processing large 3D image.) - Click Configure again
- If no other red lines, click Generate
- Open Terminal. (If you don't have Command Line Tool, download here.) Do the following step by step:
cd /User/Jianxu/Document/ITK/ITKbin
make
sudo make install (need to enter password to your computer) - All done!
- Put your code and CMakeList (you can find tons of examples on Wiki ITK.) in the same folder. (eg. /User/Jianxu/Document/ITK/program)
- Open CMake, set the source code directory and binaries directory as the same folder, where you placed your code and CMakeList. (eg. /User/Jianxu/Document/ITK/program)
- Click Configure
- You may need to change the following parameter:
ITK_DIR: /User/Jianxu/Document/ITK/ITKbin (your installation directory) - Click Configure again
- If no other red lines, click Generate.
- Open Terminal and change to the file folder, i.e. /User/Jianxu/Document/ITK/program.
- Type in " make " and your executable file will be generated automatically.
- Type in " . / XXXXX p1 p2 p3 " to run your program. (XXXXX is the executable file and p1 p2 p3 are the input parameters yo may need for the program.)