安裝準備的工作:
這裏64位機也用cmake32,不做解釋
在任意盤新建下邊兩個文檔,將itk包解壓到第二個文件裏
cmake配置
where is the source code :我們選擇上邊第二個文件 這個路勁不建議太長太長可能會報錯
where to build the binaries: 選擇bin文件夾
點擊下邊 configure按鈕 會有一個彈出的提示框 切記選擇 vs2010 10 不要選擇 有64位那個,這裏不做解釋第一次用的時候沒有成功
再點擊generate
這一切成功之後:
在bin文件夾下有一個ITK.sln 用vs2010打開
全部build一下
在將install帶個類在build一下
最後測試:
helloworld
在你想簡歷工程的盤下 新建一個文件夾 test
在test文件夾下在建立如下兩個文件
在helloworld文件夾下建立
其中CMakeList.txt的內容爲
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 2.4)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
endif()
# This project is designed to be built outside the Insight source tree.
project(HelloWorld)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(HelloWorld HelloWorld.cxx )
target_link_libraries(HelloWorld ${ITK_LIBRARIES})
在HelloWorld.cxx文件的內容爲:
#include "itkImage.h"
int main()
{
typedef itk::Image< unsigned short, 3 > ImageType;
ImageType::Pointer image = ImageType::New();
std::cout << "ITK Hello World !" << std::endl;
std::cin.get();
return 0;
}
保存好之後,用cmake進行配置
配置如前source指向hello。cxx
等等
在配置好之後
bin文件夾下會有
用vs2010運行就好了