# Use SlicerOpenIGTLink module in mainwindow of customized Slicer

**URL:** <https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425>\
**Category:** Development\
**Created:** [May 28, 2024, 3:12am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425 "2024-05-28T03:12:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![schcat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/schcat/32/67987_2.png) [@schcat](https://discourse.slicer.org/u/schcat)\
**Post date:** [May 28, 2024, 3:12am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425/1 "2024-05-28T03:12:23Z")

</div>

I am developing customized Slicer by [SlicerCAT](https://www.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/). I added an button to toolbar of slicer mainwindow to allow toggling IGTLConnector. So I import vtkMRMLIGTLConnectorNode.h file of SlicerOpenIGTLink module in c++ code. But I encountered “No such file” error when compiling the source code:

 ![Screenshot from 2024-05-28 09-54-09](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/2/329d5e7b501d787ede389978bf2374d8373b82d5.png)  
I have added SlicerOpenIGTLink module in CMakelist.txt of SlicerCAT

```auto
set(extension_name "SlicerOpenIGTLink")
set(${extension_name}_SOURCE_DIR "${CMAKE_BINARY_DIR}/${extension_name}")
FetchContent_Populate(${extension_name}
  SOURCE_DIR ${${extension_name}_SOURCE_DIR}
  GIT_REPOSITORY /home/lizhixue/project/3D_Slicer/SlicerDependency/extensions/SlicerOpenIGTLink
  GIT_TAG schcat
  GIT_PROGRESS 1
  QUIET
  )
message(STATUS "Remote - ${extension_name} [OK]")
list(APPEND Slicer_EXTENSION_SOURCE_DIRS ${${extension_name}_SOURCE_DIR})

```

And it can be used in GUI and python code in my customized Slicer.  
How can I made .h file of SlicerOpenIGTLink module be find when compiling c++ source code?

---

<div class="post-metadata">

**Author:** ![schcat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/schcat/32/67987_2.png) [@schcat](https://discourse.slicer.org/u/schcat)\
**Post date:** [June 1, 2024, 1:42am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425/2 "2024-06-01T01:42:44Z")

</div>

Who can help me? (;´▽`)

---

<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 1, 2024, 11:59am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425/3 "2024-06-01T11:59:27Z")

</div>

You need to add SlicerIGT folders that include relevant .h files to include files and add relevant .lib files to link targets. See for example [SlicerPathReconstruction/PathReconstruction/MRML/CMakeLists.txt at master · SlicerIGT/SlicerPathReconstruction · GitHub](https://github.com/SlicerIGT/SlicerPathReconstruction/blob/master/PathReconstruction/MRML/CMakeLists.txt)

---

<div class="post-metadata">

**Author:** ![schcat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/schcat/32/67987_2.png) [@schcat](https://discourse.slicer.org/u/schcat)\
**Post date:** [June 2, 2024, 2:49am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425/4 "2024-06-02T02:49:46Z")

</div>

Thank you！I will try it.

---

<div class="post-metadata">

**Author:** ![schcat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/schcat/32/67987_2.png) [@schcat](https://discourse.slicer.org/u/schcat)\
**Post date:** [June 16, 2024, 2:03am UTC](https://discourse.slicer.org/t/use-sliceropenigtlink-module-in-mainwindow-of-customized-slicer/36425/5 "2024-06-16T02:03:37Z")

</div>

I did it when I found the correct parameter name such as “vtkSlicerOpenIGTLinkIFModuleMRML\_INCLUDE\_DIRS”. Example is very useful !
