ITK installation and sample program
c++, cmake, image-processing, itk, visual-c++
Solution
The easiest way to set up your project is to use CMake again. Try creating a project with just a CMakeLists.txt and main.cpp. The CMakeLists.txt should have something like:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(ItkTest)
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(MyTest main.cpp)
target_link_libraries(MyTest ITKCommon)
So say you create these 2 files in a dir called ItkProject, then from a Visual Studio Command Prompt just do:
cd <path to ItkProject>
mkdir build
cd build
cmake .. -DITK_DIR="<path to build dir of ITK>"
The `<path to build dir of ITK>` is where you ran CMake from to configure the ITK project. It will contain the ITK.sln file, but critically it should also contain a file called ITKConfig.cmake. It is this file which is searched for in the cmake command `find_package(ITK REQUIRED)` - if CMake can't find it the configuring will fail.
Once that's been found, it sets a bunch of CMake variables which you can then use in your own CMakeLists.txt, including `ITK_USE_FILE`.
When you then invoke `include(${ITK_USE_FILE})`, this goes on to set up things like your includes paths, library search paths, and compiler flags. The path `<path to ItkProject>/Core/Common/include` will be added to the includes dirs, so in your main.cpp, you just need to do:
#include <Core/Common/include/itkImage.h>
#include "itkImage.h"
Anyway, the end result after running CMake should be solution file `<path to ItkProject>\build\ItkTest.sln` which is set up ready to use ITK.
Problem
I am new to ITK and I did the following step to install ITK and use it to programme in VS2010 - Downloaded ITK 4.3.1 and build it with CMAKE - The build was successful and I had a lib->Debug folder containing the libs. - Added the bin folder path to environmental vairable path. Following is my simple code... ``` #include <iostream> #include <Core/Common/include/itkImage.h> using namespace itk; using namespace std; int main() { return 0; } ``` the above code returns ``` Cannot open include file: 'itkConfigure.h' ``` I tried searching for that header but no luck. However in `C:\InsightToolkit-4.3.1\Modules\Core\Common\src` I found itkConfigure.h.in file. I am really clueless about how to go about this .in file. Any help is most welcome..