# Can anyone show me how to do slicer extension in c++ with an example?

**URL:** <https://discourse.slicer.org/t/can-anyone-show-me-how-to-do-slicer-extension-in-c-with-an-example/29637>\
**Category:** Development\
**Tags:** python\
**Created:** [May 25, 2023, 1:39am UTC](https://discourse.slicer.org/t/can-anyone-show-me-how-to-do-slicer-extension-in-c-with-an-example/29637 "2023-05-25T01:39:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsa934](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dsa934/32/17907_2.png) [@dsa934](https://discourse.slicer.org/u/dsa934)\
**Post date:** [May 25, 2023, 1:39am UTC](https://discourse.slicer.org/t/can-anyone-show-me-how-to-do-slicer-extension-in-c-with-an-example/29637/1 "2023-05-25T01:39:12Z")

</div>

Operating system: 10  
Slicer version: 5.2.1

Hi, slicer users

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/f/2f18381df94d1d9cb75f4b12e034782982262a62.png)

I am using several python modules in 3d slicer through extension wizard.  
However, I’ve read all the advice to use script repositories and loadable classes for C++ extensions, but I don’t know what the heck they are talking about.

A very simple example is good, so can anyone explain how to extend it with C++?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 25, 2023, 1:48am UTC](https://discourse.slicer.org/t/can-anyone-show-me-how-to-do-slicer-extension-in-c-with-an-example/29637/2 "2023-05-25T01:48:21Z")

</div>

Implementing a module in C++ is more involved than simply relying on python to implement a specific workflow and user interface.

Is there a specific task you are not able to achieve leveraging Python ?

By better understanding your goal, we may be able to more effectively guide you.

> [@dsa934](#):
>
> A very simple example is good, so can anyone explain how to extend it with C++?

All the modules available in the [https://github.com/Slicer/Slicer/tree/main/Modules/Loadable](https://github.com/Slicer/Slicer/tree/main/Modules/Loadable) directory are examples you could look at.

---

<div class="post-metadata">

**Author:** ![dsa934](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dsa934/32/17907_2.png) [@dsa934](https://discourse.slicer.org/u/dsa934)\
**Post date:** [May 27, 2023, 11:54am UTC](https://discourse.slicer.org/t/can-anyone-show-me-how-to-do-slicer-extension-in-c-with-an-example/29637/4 "2023-05-27T11:54:05Z")

</div>

I deleted the previous post because it was incorrect.

My current situation is that I can use the desired module as an extension with python, but I cannot use it with c++.

I have a module written in C++ that is already implemented and I want to use it in a slicer.

> [@jcfr](#):
>
> All the modules available in the [https://github.com/Slicer/Slicer/tree/main/Modules/Loadable](https://github.com/Slicer/Slicer/tree/main/Modules/Loadable) directory are examples you could look at.

I’ll try the link you linked above first.
