sandra
August 21, 2017, 8:21am
1
Hi everyone,
I would like to use SimpleItk while writting a loadable module.
My problem is about including the necessary files:
#include <sitkCenteredTransformInitializerFilter.h> for example doesn’t work, I get the error “file not found”
I know that Slicer’s architecture is complex and I’m not sure how to include SimpleItk/the necessary files in a loadable module. I tried the different ways I could find in SimpleItk examples (in the official documentation, so not using Slicer) but I didn’t succeed.
(I did build Slicer with SimpleItk).
Thanks for your help,
Sandra.
Hi Sandra,
I think SimpleITK has wrappers for Python, C#, Java and R, but for C++ you should use ITK directly.
sandra
August 21, 2017, 12:35pm
3
You mean that in general it isn’t possible to use simpleItk with C++ or it isn’t possible in Slicer particularly ?
sandra
August 21, 2017, 1:02pm
5
I saw this page where there are examples of simpleItk used in C++
https://itk.org/SimpleITKDoxygen/html/examples.html
I didn’t know about those, sorry.
fedorov
(Andrey Fedorov)
August 21, 2017, 8:03pm
7
In general, it is indeed possible to use SimpleITK from C++, but I don’t know of any examples in Slicer. @blowekamp would know for sure!
jcfr
(Jean Christophe Fillion Robin (Kitware))
August 21, 2017, 8:27pm
8
While possible, the build system currently do not enable this.
In a nutshell, the SimpleITK targets (available through SimpleITKConfig.cmake
) are not exposed to extensions. Only ITK is.
To keep things simple, I suggest we stick to ITK when dealing with C++ and image processing.
blowekamp
(Bradley Lowekamp)
August 22, 2017, 1:25am
9
I have a module, which is still compiling, that uses SimpleITK in this way. The NucleusClosing module uses the c++ interface for SimpleITK. It still seems to work.
HTH
Brad
1 Like
jcfr
(Jean Christophe Fillion Robin (Kitware))
August 22, 2017, 3:59am
10
Indeed , we are marking SimpleITK
as FIND_PACKAGE
… and the targets end up being exposed.
sandra
August 22, 2017, 8:16am
11
So @blowekamp what did you do to have simpleItk working in your loadable module ?
@jcfr : do I have to write these 4 lines somewhere or are they already present in the slicer’s architecture ?
jcfr
(Jean Christophe Fillion Robin (Kitware))
August 22, 2017, 1:08pm
12
Hi @sandra ,
You only need to “link” against the SimpleITK
targets as it is done here:
In the case of loadable modules, you would add ${SimpleITK_LIBRARIES}
to the TARGET_LIBRARIES
parameter of the logic:
blowekamp
(Bradley Lowekamp)
August 22, 2017, 1:19pm
13
The first step is to find the SimpleITK package in CMake:
Then as JC said you need to link against the SimpleITK libraries.
sandra
August 22, 2017, 1:20pm
14
Ok and those lines about find the SimpleITK package, where should I write them (for a loadable module) ? (In which CMakeLists.txt)