在Mac Os安装并建立ITK

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")
(2) Install CMAKE
  • Simply extract the file from what download. 
  • Double click on the .dmg file. 
  • Before finishing, check the option: Install Commond-Line Link
(3) Install ITK with CMAKE
  1. Extract the ITK package that you just dowloaded to a directory. Rename it as InsightToolKit (eg. /User/Jianxu/Document/ITK)
  2. 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.
  3. Open CMake. Choose default comiler as Unix MakeFiles
  4. In the top two lines, set Source code as  /User/Jianxu/Document/ITK/InsightToolKit and set the binaries as  /User/Jianxu/Document/ITK/ITKbin
  5. Click Configure
  6. 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.)
  7. Click Configure again
  8. If no other red lines, click Generate
  9. 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)
  10. All done!
(4) Build a ITK program on Mac
  • 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.)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值