Image registration in Java with ITK

Hi @bogovicj,

Have you ever tried this?

@haesleinhuepf and I think it would be worth trying to explore whether we can have elastix more natively in Java…



I have not, but thanks for pointing it out!
Let’s keep in touch as we try it out :slight_smile:



cc @NicoKiaru should be also very interesting for you. Let us know if you give it a try!


I put a small amount of time into trying things yesterday. Did:

git clone
mkdir SimpleElastix_build
cd SimpleElastix_build
cmake ../SimpleElastix
ccmake .  # Then set the WRAP_JAVA flag to ON
make -j8  # This did stuff and seemed to complete successfully

Among other things, I have a directory SimpleITK-build/Wrapping/Java/ which seems to have interesting stuff in it. Using that, I was able to follow this example to get a SimpleITK example working.

Couldn’t quickly find an analogous folder for SimpleElastix though…



In you SimpleElastix build folder, after you have build with WRAP_JAVA=ON, is there not an “SimpleITK-build/Wrapping/Java” folder?

The building steps for SimpleElastix Should^TM be identical to that of SimpleITK.



Thanks for following up here. (If we have questions in the future, do you have a preference for the communication channel to use? i.e, this forum, github, the elastix forum, somewhere else?)

There is such a folder. My mistake was that the java class, org.itk.simple.ElastixImageFilter
s in the simpleitk-...jar, but I was expecting it to be in a different or second jar for some reason… This clears things up, and I seem to have things working now.

I’ll file a PR fleshing out this part of the doc.

Thanks again,


I also tried the installation and it ended like this:

-- Installing: /Users/tischer/Documents/build/ITK-prefix/include/ITK-4.13/itkHessianImageFilter.hxx
-- Installing: /Users/tischer/Documents/build/ITK-prefix/include/ITK-4.13/itkSLICImageFilter.h
-- Installing: /Users/tischer/Documents/build/ITK-prefix/include/ITK-4.13/itkHessianImageFilter.h
-- Installing: /Users/tischer/Documents/build/ITK-prefix/include/ITK-4.13/itkObjectnessMeasureImageFilter.h
-- Installing: /Users/tischer/Documents/build/ITK-prefix/lib/cmake/ITK/Modules/SimpleITKFilters.cmake
[ 55%] Completed 'ITK'
[ 55%] Built target ITK
make: *** [all] Error 2

I guess that’s an issue? Because also the folder that should contain the Java wrapper is quite empty:

ls SimpleITK-build/
total 24
drwxr-xr-x   3 tischer  staff    96B Nov 20 20:30 ./
drwxr-xr-x  30 tischer  staff   960B Nov 20 20:34 ../
-rw-r--r--   1 tischer  staff    10K Nov 20 20:33 CMakeCacheInit.txt

This is how I configured using ccmake ., maybe that’s wrong?

I looked for error message in the make -j8 log and found those ones:

checking whether we are cross compiling... configure: error: in `/Users/tischer/Documents/build/PCRE-prefix/src/PCRE-build':
configure: error: cannot run C compiled programs.
[ 36%] Performing build step for 'PCRE'
make[3]: *** No targets specified and no makefile found.  Stop.
make[2]: *** [PCRE-prefix/src/PCRE-stamp/PCRE-build] Error 2
make[1]: *** [CMakeFiles/PCRE.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /Users/tischer/Documents/build/ITK-prefix/lib/libitkminc2-4.13.a(minc2_error.c.o) has no symbols

Do you think any of those is the problem?

Ok, found this:
Probably something we should also add the the documentation for the Java installation instructions…

1 Like


Did the build succeed after changing to clang?

I’m traveling this week, and so havn’t had much time. Hope to file that PR later this week…


It went much further but then I got another error. I think this was due to the wrapping of Ruby. I will try again, disabling all wrapping, but Java. Rather tedious, every attempt takes 1-2 hours and I cannot do anything else because my computer ventilation is too loud due to all the heavy compilation work :slight_smile: