Integrate ITK (Insight Toolkit) into own project

2020-07-27 02:13发布

问题:

i am having problems integrating ITK - Insight Toolkit into another image processing pipeline. ITK itself is a medical image processing toolkit and uses cmake as build system. My image pipeline project uses cmake as well. According to the user manual of ITK it is favorable to use the "UseITK.cmake" file in the build (out of source) directory of ITK. You can do that by adding the following lines the CMakeList.txt of your own project.

# 'SET(ITK_DIR ...)' if 'FIND_PACKAGE(ITK REQUIRED)' fails
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})

My problem is, this approach points to the current installtion of ITK, but i have to integrate itk completly into my project, without dependencies outside my project. Is there a build option in the cmake build system of itk, which dumps/delivers all the header and lib files into a build directory, so i can place them into my project on my own. I have a lib and header include structure i do not want to break. I already tried to to manually copy the lib and header files into my project but it didn't work out.

I am new to itk and cmake so this question might sound vague. I hope you guys can help me anyway.

Thanks in advance!

Best regards,

zhengtonic

回答1:

I don't know if you're still having the problem, but here's an easy way:

Build the ITK project, and then "make install" (or build the INSTALL.vcproj project in VS), and it will write to a directory you pass as CMAKE_INSTALL_PREFIX while configuring your project. This directory will contain /bin, /lib and /include. You can import those into your project directly.



回答2:

Using CMAKE_INSTALL_PREFIX to point to you base directory is the best solution.

When you issue "make install" all the headers/configurationfiles/libraries will be copied over.



回答3:

C:/Program Files (x86)/ITK is value of CMAKE_INSTALL_PREFIX for ITK and set automatically.