# Source vs. Header: ITK OpenCV Image Bridge

**URL:** <https://discourse.slicer.org/t/source-vs-header-itk-opencv-image-bridge/428>\
**Category:** Development\
**Tags:** build, extensions-manager\
**Created:** [June 2, 2017, 4:38pm UTC](https://discourse.slicer.org/t/source-vs-header-itk-opencv-image-bridge/428 "2017-06-02T16:38:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdiprima](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tdiprima/32/9469_2.png) [@tdiprima](https://discourse.slicer.org/u/tdiprima)\
**Post date:** [June 2, 2017, 4:38pm UTC](https://discourse.slicer.org/t/source-vs-header-itk-opencv-image-bridge/428/1 "2017-06-02T16:38:34Z")

</div>

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).

Help…

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2017, 5:26pm UTC](https://discourse.slicer.org/t/source-vs-header-itk-opencv-image-bridge/428/2 "2017-06-02T17:26:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thewtex](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thewtex/32/32_2.png) [@thewtex](https://discourse.slicer.org/u/thewtex)\
**Post date:** [June 2, 2017, 8:15pm UTC](https://discourse.slicer.org/t/source-vs-header-itk-opencv-image-bridge/428/3 "2017-06-02T20:15:18Z")

</div>

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

[https://github.com/SBU-BMI/SlicerOpenCV](https://github.com/SBU-BMI/SlicerOpenCV)
