Source vs. Header: ITK OpenCV Image Bridge

I have a C++ header file and a source file. I’m including itkOpenCVImageBridge.h"`. The include compiles as long as it’s in the source file. I can’t put it in the header. We want to put all the source in the header, and delete the source. But like I said it won’t compile. The error is:

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

I don’t get it. Can anyone please point me in the right direction? I already went in the Google direction… But the advice is to set Module_ITKVideoBridgeOpenCV on when compiling ITK (which is already being pulled in by Slicer).


Adding any OpenCV include files into a header file would make other modules directly depend on OpenCV, which would cause build failure. You did right at the beginning: have a clean public interface in the header file and have all private implementation details (with special dependencies) in the cxx file.

1 Like

Take a look at SlicerOpenCV, which builds both OpenCV and the ITKVideoBridgeOpenCV module outside of ITK: