# How to integrate external libraries such as CGAL with slicer 3D?

**URL:** https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843
**Category:** Development
**Tags:** build, segmentation, dicom
**Created:** [May 18, 2019, 1:54pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843 "2019-05-18T13:54:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Baseer\_Piracha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/baseer_piracha/32/3753_2.png) [@Baseer\_Piracha](https://discourse.slicer.org/u/Baseer_Piracha)
#### Post date: [May 18, 2019, 1:54pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843/1 "2019-05-18T13:54:19Z")

</div>

How to integrate external libraries such as CGAL with slicer 3D?

---

<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: [May 18, 2019, 2:09pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843/2 "2019-05-18T14:09:26Z")

</div>

If you work in Python then you can pip install cgal. If you work in C++ then you can create a superbuild-type extension (that downloads and builds its own dependent libraries, for example how SlicerRT extension builds Plastimatch library).

---

<div class="post-metadata">

### Author: ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)
#### Post date: [May 18, 2019, 2:26pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843/3 "2019-05-18T14:26:38Z")

</div>

For C++, an example is OpenCV

> **[GitHub - Slicer/SlicerOpenCV: Slicer Extension wrapping OpenCV](https://github.com/Slicer/SlicerOpenCV)**
>
> Slicer Extension wrapping OpenCV. Contribute to Slicer/SlicerOpenCV development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![Baseer\_Piracha](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/baseer_piracha/32/3753_2.png) [@Baseer\_Piracha](https://discourse.slicer.org/u/Baseer_Piracha)
#### Post date: [June 8, 2019, 2:28pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843/4 "2019-06-08T14:28:56Z")

</div>

I have already downloaded and build the 3D slicer from github, and its running. Now the question is I’m not under standing how add some external libraries from other opensource softwares like CGAL etc…  
and how to remove the existing libraries from 3D slicer which I don’t want…  
Kindly elaborate please.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [June 8, 2019, 4:12pm UTC](https://discourse.slicer.org/t/how-to-integrate-external-libraries-such-as-cgal-with-slicer-3d/6843/5 "2019-06-08T16:12:53Z")

</div>

> [@Baseer\_Piracha](#):
>
> I’m not under standing how add some external libraries from other opensource softwares like CGAL etc…  
> and how to remove the existing libraries from 3D slicer

That’s a big topic, but the basics are that Slicer is at the core a C++ application with a build system based on CMake, so you can add or remove libraries as needed using pretty standard methods.

Of course there are also lots of conventions, so you would do well to study the examples that @lassoan and @adamrankin pointed to already.

And you can review any of [the developer documentation](https://www.slicer.org/wiki/Documentation/Nightly/Developers) to learn how Slicer is built.
