# Error with Elastix Registration: Elastix not found

**URL:** <https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235>\
**Category:** Support\
**Created:** [April 21, 2021, 6:18pm UTC](https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235 "2021-04-21T18:18:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marianaslicer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marianaslicer/32/8555_2.png) [@marianaslicer](https://discourse.slicer.org/u/marianaslicer)\
**Post date:** [April 21, 2021, 6:18pm UTC](https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235/1 "2021-04-21T18:18:50Z")

</div>

Hi everyone,

I’m working on a Slicer custom application, which was built according to this tutorial: [SlicerCAT: Creating custom applications based on 3D Slicer - Kitware Blog](https://blog.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/)

The application runs a custom module developed in Python language programming using the Extension Manager module available in 3D Slicer.

The module should perform image registration using the SlicerElastix toolbox through the following lines of code:

```
    self.elastixLogic = Elastix.ElastixLogic()

    self.elastixLogic.registerVolumes(
        self.movingNode, self.referenceNode,
        outputVolumeNode=self.warpVolume,
        parameterFilenames=self.parametersFile,
        outputTransformNode=self.elastix)

```

But I’m getting an error message saying “Elastix Not Found”. Any idea how to solve it?

Thanks in advance.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/c/1c1b5acd4b7f7ee708cd4fde9d571c0fd5677aa4.png)

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 21, 2021, 9:40pm UTC](https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235/2 "2021-04-21T21:40:53Z")

</div>

Did you use [https://github.com/KitwareMedical/SlicerCustomAppTemplate](https://github.com/KitwareMedical/SlicerCustomAppTemplate) to generate your Slicer custom application? I believe when you use that it will use the current Slicer master git hash when setting up the custom application. It looks from the image you posted that you are using an older Slicer version (4.11). [https://github.com/KitwareMedical/SlicerCAT](https://github.com/KitwareMedical/SlicerCAT) is an example of a Slicer custom app, but not necessarily the starting point or the source you should be editing to create your application.

As it relates to Elastix, did you specify to build your Slicer custom application with the [SlicerElastix](https://github.com/lassoan/SlicerElastix) as a remote extension? Were there any build errors? I would suggest to use latest Slicer master git hash and SlicerElastix git hash as these should be currently compatible.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 22, 2021, 10:10pm UTC](https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235/3 "2021-04-22T22:10:49Z")

</div>

@marianaslicer Can you answer some of the above questions? Did your Slicer custom app build without errors? Did you solve the Elastix error you posted about earlier?

---

<div class="post-metadata">

**Author:** ![marianaslicer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marianaslicer/32/8555_2.png) [@marianaslicer](https://discourse.slicer.org/u/marianaslicer)\
**Post date:** [April 22, 2021, 10:36pm UTC](https://discourse.slicer.org/t/error-with-elastix-registration-elastix-not-found/17235/4 "2021-04-22T22:36:51Z")

</div>

Hi James,

Sorry for answering later.  
I used the link you mentioned to generate my Slicer application and I think I used the current Slicer master git, Slicer 4.11.20210226.  
Then, I added to the cmakefile.txt the SlicerElastix extension:

set(extension\_name “SlicerElastix”)  
set(${extension\_name}\_SOURCE\_DIR “${CMAKE\_BINARY\_DIR}/${extension\_name}”)  
FetchContent\_Populate(${extension\_name}  
SOURCE\_DIR ${${extension\_name}\_SOURCE\_DIR}  
GIT\_REPOSITORY ${EP\_GIT\_PROTOCOL}://github.com/lassoan/SlicerElastix.git  
GIT\_TAG master  
GIT\_PROGRESS 1  
QUIET  
)  
list(APPEND Slicer\_EXTENSION\_SOURCE\_DIRS ${${extension\_name}\_SOURCE\_DIR})

And there were no build errors. What I did to solve my problem (which is not the best approach) was to add manually the elastix.exe and transformix.exe files to the Slicer Elastix folder and specify it at the custom elastix toolbox location.

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