How to use itkvtkglue to use ITK with VTK?

2019-06-04 04:38发布

问题:

I wanted to make the example which combines ITK with VTK called IO/ImageFileReader from wiki examples.

I downloaded itkvtkglue, extracted to a folder, configured with cmake and built with visual studio 2010.

but i can't use it when i try to configure the example given. Even though cmake finds the ItkVtkGlue_DIR by itself, it gives the error that he couldn't include the necessary files. Fails to include(${ItkVtkGlue_USE_FILE})

Should I somehow change the folders CMake looks for my ItkVtkGlue header files? Is there other way to use ITK & VTK together?

the error and file content are given below.

CMake Error at CMakeLists.txt:6 (include):
  include could not find load file:

    C:/Users/Emre

CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 2.6)

project(ImageFileReader)

find_package(ItkVtkGlue REQUIRED)
include(${ItkVtkGlue_USE_FILE})

add_executable(ImageFileReader ImageFileReader.cxx)
target_link_libraries(ImageFileReader
  ItkVtkGlue  ${VTK_LIBRARIES} ${ITK_LIBRARIES}) 

Thank you all for your help.

回答1:

This is almost certainly one of the very common problems:

If the path to your tools contains a [space] character in it, then you must protect the file path from being split apart by encapsulating it in quotations "".

To be safe, you should always place file paths in quotations just incase one of your future collaborators tries to build on a path that has spaces in it.

You may also want to review:

http://www.vtk.org/Wiki/ITK/Examples#ItkVtkGlue