How to start my project in ITK C++ as a python programmer


I have been programming in python, but now I have to move to C++. I am a beginner in ITK/VTK, C++ programming and new to these libraries. I started with ITK examples, however, I do not know from which point should I start coding for my research. For example, working with python and writing function, reading the files from a folder, and calling the functions from a file that can be imported, is very easy and convenient.
Is there any practical application and examples that I can see how the files and functions organization is being done?

I need to do the followings:

  1. List and load the (.nii.gz) files in a folder into program

  2. Extract meshes from the label files,

  3. Find the corresponding points among the meshes

However, I am quite confused from which point should I start, which functions and libraries can I use.
I know that If I follow few examples, I can apply the similar procedure on my project. Then, it will be much easier to work with C++ ITK/VTK libraries. This is how I learnt python.

Your expert opinion is really appreciate, or if you know any freely available examples or codes that can help to beginners to code the projects and learn about style of coding in ITK, could you please share?


Parsing directories has nothing to do with ITK, so this StackOverflow question should help.

For converting labels into meshes, BinaryMask3DMeshSource could be used.

Finding the corresponding points among the meshes is a non-trivial task, and is probably better suited for a mesh processing library. ITK is an image processing library, with some mesh import, export and conversion functionality.

1 Like

@Sara_Caffe, as said by Dženan, filesystem manipulation is not related to ITK. However, in C++ this can be quite cumbersome compared to Python. There is no standard way before the C++17 iteration, and usually relies on third-party libraries, like Boost.
Fortunately, if you have already ITK installed, it’s coming with the KWSys lib. While not really documented, it have plenty of easy-to-use function to access filesystem.

Also, since you seem to want to process meshes rather than images, you should take a look at VTK, which is way more adapted.



It is worth noting that in ITK, KWSys is available as itksys. Example usage can be found by searching for this term in the source code.

If you have a newer C++ compiler, the C++17 filesystem header is part of the standard library.

ITK actually contains a number of powerful methods for registration of mesh points sets. For more information, see this example, for example, and @ntustison’s papers on the information-theoretic metrics: