# Add my own segmentation model to 3D Slicer

**URL:** <https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221>\
**Category:** Development\
**Tags:** segmentation, python, ai\
**Created:** [July 5, 2024, 5:03pm UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221 "2024-07-05T17:03:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [July 5, 2024, 5:03pm UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/1 "2024-07-05T17:03:03Z")

</div>

Previously we were trying to add a plugin in windows and install the required packages of our plugin using PythonSlicer.exe in windows.

> PythonSlicer.exe -m pip install --trusted-host=[pytorch.org](http://pytorch.org) --trusted-host=[download.pytorch.org](http://download.pytorch.org) --trusted-host=[files.pytorch.org](http://files.pytorch.org) -r requirements-slicer.txt

Similarly how to do a this kind of installation of packages in ubuntu OS

---

<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:** [July 5, 2024, 5:05pm UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/2 "2024-07-05T17:05:16Z")

</div>

It looks good in general. However, I would not recommend to install pytorch like this. Pytorch is now used very commonly - all AI extensions use it - and we provide the PyTorch extension to install it, as the installation can go wrong in many ways. You can see an example of how it is used in MONAIAuto3DSeg and TotalSegmentator extensions.

I’m not sure what you mean by plugin though, as neither Slicer nor Python use plugins. Slicer has extensions that you can install via Slicer’s Extensions Manager, while Python has packages that you can install via pip.

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [July 8, 2024, 6:02am UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/3 "2024-07-08T06:02:23Z")

</div>

Hi Iassoan We are trying to add a our own developed segmentation model as a part of Slicer which I referred as the plugin here, for that I want to know how can I install the packages required using the Slicer.

In windows OS Pythonslicer.exe is used to install the required packages, similarly what is used to install packages in ubuntu OS

---

<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:** [July 8, 2024, 1:30pm UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/4 "2024-07-08T13:30:46Z")

</div>

Thanks for the clarification. I would recommend to use similar extensions as example. You can use [MONAIAuto3DSeg](https://github.com/lassoan/SlicerMONAIAuto3DSeg) as an example for implementing MONAI based model, or [DentalSegmentator](https://github.com/gaudot/SlicerDentalSegmentator) for nn-UNet based model.

---

<div class="post-metadata">

**Author:** ![maniron](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@maniron](https://discourse.slicer.org/u/maniron)\
**Post date:** [July 10, 2024, 10:57am UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/5 "2024-07-10T10:57:29Z")

</div>

Hi Iassoan Recently I have been facing this issue

“[/home/ubuntu/Slicer-SuperBuild-Debug/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.”

---

<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:** [July 22, 2024, 9:08pm UTC](https://discourse.slicer.org/t/add-my-own-segmentation-model-to-3d-slicer/37221/6 "2024-07-22T21:08:37Z")

</div>

Since you have built Slicer in debug mode, you can get detailed information of where the problem occurred (see instructions [here](https://slicer.readthedocs.io/en/latest/developer_guide/debugging/linuxcpp.html#gdb-debug-by-attaching-to-running-process-recommended), you can probably skip _Step 1_).
