Cannot find `itkImageToVTKImageFilter.h` header via vcpkg-built itk

Hi, I am trying to introduce ITK to my project via vcpkg, and I met the following error when I try to replicate this example

fatal error: itkImageToVTKImageFilter.h: No such file or directory

I don’t seem to have problems using other parts of ITK. I can read DICOM files via itkImageSeriesReader, for example.

relevant part of my CMakeLists.txt looks like the following

find_package(VTK REQUIRED)
include("${VTK_USE_FILE}")
find_package(ITK CONFIG REQUIRED)

target_link_libraries(my_target PRIVATE
        ${VTK_LIBRARIES}
        ITKVTK
        ITKIOGDCM
        # other libraries
        )

I solved the problem. In the "dependencies" of the vcpkg manifest file, I need to add a “vtk” feature under “itk”:

  "dependencies": [
    "vtk",
    {
      "name": "itk",
      "features": [
        "vtk"
      ]
    },
    ...
  ]

Now in CMake find_package(ITK) can find an ITKVtkGlue target, and I just need to link it via target_link_libraries

2 Likes