# External calling at Slicer 3D

**URL:** <https://discourse.slicer.org/t/external-calling-at-slicer-3d/136>\
**Category:** Development\
**Created:** [April 17, 2017, 10:18pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136 "2017-04-17T22:18:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [April 17, 2017, 10:18pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/1 "2017-04-17T22:18:50Z")

</div>

Hi everybody,

I am programming an extension module for Slicer 3D. In one step I need to call an external command (Elastix). At this point is when I obtain the following error:

 ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/6e7cf603bea688a3821efdb228bd5f65599bcb13.jpg)

I have not been able to solve it yet. Do you know how get rid of this problem? It works when I execute the call in a terminal.

I look forward to hearing from you. Thanks in advance.

Sincerely,

Alba.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [April 17, 2017, 10:40pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/2 "2017-04-17T22:40:25Z")

</div>

Hi Alba,

My guess is that the Slicer version of the `libcrypto` ends up in your PATH/LD\_LIBRARY\_PATH before the system library paths, and conflicts with the version expected by `libgdmCommon` (the elastix copy of it).

What type of extension is this, Python or C++ (CLI)?

---

<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:** [April 17, 2017, 11:36pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/3 "2017-04-17T23:36:05Z")

</div>

This issue has been discussed before - see [this page](http://slicer-devel.65872.n3.nabble.com/Calling-elastix-in-Slicer-td4028906.html). The problem was what Isaiah described above (preferred library paths set up by the Slicer launcher caused loading of wrong version of some shared libraries).

I think the best would be to add a new extension to Slicer that contains Elastix. Alba, would you be interested/have time to work on this?

---

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [April 20, 2017, 8:16pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/4 "2017-04-20T20:16:40Z")

</div>

Hi Isaiah!

Thank you so much for the quick response!

It is a Python extension. After reading Andras referenced’s page it seems I have solved it this way:

_import os_  
_os.system(‘elastix’)_  
_os.environ[‘ITK\_AUTOLOAD\_PATH’] = ‘’_

I am still working with it!

---

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [April 20, 2017, 8:25pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/5 "2017-04-20T20:25:39Z")

</div>

Hi Andras!

Thank you so much too for the quick response!

After reading that page it seems I have solved it with this commands:

_import os_  
_os.system(‘elastix’)_  
_os.environ[‘ITKAUTOLOAD\_PATH’] = ‘’_

Now my time is limited but it would be a great idea…and I guess it would help us. Maybe after I finish my final degree project I could improve it with an Elastix extension

---

<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:** [April 21, 2017, 2:35am UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/6 "2017-04-21T02:35:32Z")

</div>

I’ve added Elastix as an extension to Slicer - download the nightly build of Slicer tomorrow and install it from the extension manager. It includes the Elastix toolbox, so you don’t have to manually install or configure anything.

---

<div class="post-metadata">

**Author:** ![Alba\_Garcia\_de\_la\_Ca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alba_garcia_de_la_ca/32/181_2.png) [@Alba\_Garcia\_de\_la\_Ca](https://discourse.slicer.org/u/Alba_Garcia_de_la_Ca)\
**Post date:** [May 15, 2017, 6:37pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/7 "2017-05-15T18:37:38Z")

</div>

Thank you so much Andras for adding this extension to Sli3r. It has been really helpful! ^º^

Regards!

---

<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 15, 2017, 8:16pm UTC](https://discourse.slicer.org/t/external-calling-at-slicer-3d/136/8 "2017-05-15T20:16:21Z")

</div>

You’re welcome. Just a small remark: [Slic3r](http://slic3r.org/) is a very different application with a similar name. This one is 3DSlicer or just Slicer.
