# Using CMake for Configuring and Building ITK vs Using the Python Wrapper for journal paper ITK code.

**URL:** <https://discourse.itk.org/t/using-cmake-for-configuring-and-building-itk-vs-using-the-python-wrapper-for-journal-paper-itk-code/6061>\
**Category:** Beginner Questions\
**Tags:** itk, cmake, python\
**Created:** [July 12, 2023, 4:16am UTC](https://discourse.itk.org/t/using-cmake-for-configuring-and-building-itk-vs-using-the-python-wrapper-for-journal-paper-itk-code/6061 "2023-07-12T04:16:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzhangaps](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jzhangaps](https://discourse.itk.org/u/jzhangaps)\
**Post date:** [July 12, 2023, 4:16am UTC](https://discourse.itk.org/t/using-cmake-for-configuring-and-building-itk-vs-using-the-python-wrapper-for-journal-paper-itk-code/6061/1 "2023-07-12T04:16:50Z")

</div>

Hi ITK discussion forum!

I’m new to ITK and am going through the ITK software guide in order to be able to try this code: [https://github.com/midas-journal/midas-journal-154/tree/master/DiffeomorphicDemons-2009-06-Vercauteren-IJSource](https://github.com/midas-journal/midas-journal-154/tree/master/DiffeomorphicDemons-2009-06-Vercauteren-IJSource)

Would experienced ITK users here be able to point me in the right direction? Will I be able to use the above DiffeomorphicDemons-2009-06-Vercauteren-IJSource code in both of the following ways?  
a) the path of installing and using ITK via the CMake route (chapter 2 of the ITK Software Guide Book 1)  
b) the path of installing and using ITK in Python (Section 3.7.1 of the ITK Software Guide Book 1)

I am asking because while I would prefer to work in a Python environment rather than learning how to use ITK via path (a) I can’t see how I’d go about using Python to access the DiffeomorphicDemons-2009-06-Vercauteren-IJSource code. Before I spend a few weeks on path (a) and learning how to use ITK without Python, I’d really appreciate some guidance from experienced people here.

Any other guidance on how to get up to speed in order to use the DiffeomorphicDemons-2009-06-Vercauteren-IJSource code will be much appreciated.

Many thanks!

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [July 12, 2023, 1:15pm UTC](https://discourse.itk.org/t/using-cmake-for-configuring-and-building-itk-vs-using-the-python-wrapper-for-journal-paper-itk-code/6061/2 "2023-07-12T13:15:00Z")

</div>

To be able to use an ITK class from Python, it needs to be wrapped (e.g. [itk::DiffeomorphicDemonsRegistrationFilter](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Registration/PDEDeformable/wrapping/itkDiffeomorphicDemonsRegistrationFilter.wrap)). I don’t know whether all the classes used in that example are wrapped for Python. Even if they are, translating 1000 lines of code to Python is far from trivial. I would suggest going the route a) to check whether this does what you want or expect. If it does, then you might consider translating the subset you need to Python.

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [July 12, 2023, 1:28pm UTC](https://discourse.itk.org/t/using-cmake-for-configuring-and-building-itk-vs-using-the-python-wrapper-for-journal-paper-itk-code/6061/3 "2023-07-12T13:28:51Z")

</div>

Hello @jzhangaps,

Possibly consider using SimpleITK which wraps various Demons filters, see [this notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/66_Registration_Demons.ipynb) for details.
