Error with Elastix Registration: Elastix not found

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

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.

Did you use 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 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 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.

@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?

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