SuperElastix / SimpleElastix

Multi-lingual medical image registration library

Home Page:http://simpleelastix.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

4D image registration not working

fmichall opened this issue · comments

Apparently, 4D operations are not being built. While 3D registration works fine, registration of 4D images fails and yields the following output (e.g., when using the default groupwise parameter map according to the documentation with pixel type sitk.sitkFloat32):

sitk::ERROR: ElastixImageFilter does not support the combination of 4-dimensional 32-bit float fixed image and a 4-dimensional 32-bit float moving image.

Inspecting SimpleITK's source and CMake files, there are a lot of #ifdef SITK_4D_IMAGES statements. This variable has been removed from the SimpleITK definitions and is supposedly meant to be replaced by SITK_MAX_DIMENSIONS defaulting to 5. However, SITK_MAX_DIMENSIONS does not seem to be handled. When either removing all #ifdef SITK_4D_IMAGES or re-introducing this flag, the project compiles but can't be installed via setup.py and yields:

ImportError: dlopen(~/build/SimpleITK-build/Wrapping/Python/SimpleITK/_SimpleITK.so, 0x0002): symbol not found in flat namespace '__ZN3itk6simple23GetVectorImageFromImageIfLj4ELj4EEENS_11VectorImageIT_XT0_EE7PointerEPNS_5ImageINS_6VectorIS3_XT1_EEEXT0_EEEb'

To identify that symbol:

c++filt -n _ZN3itk6simple23GetVectorImageFromImageIfLj4ELj4EEENS_11VectorImageIT_XT0_EE7PointerEPNS_5ImageINS_6VectorIS3_XT1_EEEXT0_EEEb

yields:

itk::VectorImage<float, 4u>::Pointer itk::simple::GetVectorImageFromImage<float, 4u, 4u>(itk::Image<itk::Vector<float, 4u>, 4u>*, bool)

According to my interpretation, the issue seems to indicate missing vector image implementations in the Explicit files under ./Code/Explicit/src. However, those are unchanged compared to older versions of SimpleElastix with 4D registration working.

Since I'm on an M1 macbook pro (macOS 12.3.1, miniforge python 3.9), I am not able to compile older SimpleElastix versions (which have been working for years on my old intel macbook). Therefore, I am dependent on a recent version of SimpleElastix.

To get SimpleElastix to compile at all on the M1 mac, I pulled from the develop branch without building Testing modules and only turning on Python wrapping as described in this #issue by @Pedro-Filipe. Moreover, I updated the SuperBuild to use SimpleITK v2.1.1 with ITK 5.2.1 for arm64 support.

Can anyone confirm 4D registration not working on other systems or is this an M1-specific issue?
Is there any solution to get 4D registration working again?

I recently stumbled upon this same issue as also reported at sanderslab/magellanmapper#438. I'm using an Intel-based MacBook Pro (macOS 12.6, Python 3.8), so looks like it's an issue on both Intel and M1 systems. I compiled the package directly in SimpleITK using with the recently integrated Elastix enabled (my build is on SimpleITK commit 0640d4aa0db519120d5a227ca1390dc9033e6e83), though I had not tested the SITK_MAX_DIMENSIONS setting.

Have you found a workaround to this issue?

Thank you for confirming the issue. Unfortunately, I did not find a solution. Instead, I abandoned SimpleElastix and opted for a local installation of ITK-elastix.

Makes sense, thanks for letting me know!