Rigid body registration code


Please excuse me if the following question looks too dumb:

So, I would like to implement the simplest intensity-based 3D rigid body within-modality registration (6 parameters), just like between the volumes of an fMRI scan, for a real-time application. I checked the ITK source and saw things like fixed image, moving image, etc. within the registration examples. The example source was declaring objects using classes and all was done using classes as one might expect.

HOWEVER, I would like to get ALL the way down to the C++ implementation so that I can cherry-pick only the minimal amount of code and insert it into my application. In other words, I need to access the source of all those classes so that I can go more C-like rather than C+±like. I searched for CPP files within the source folder “InsightToolkit-5.0.1”, but it seems this returns mostly the higher-level examples that call the classes.

In this respect, could you let me know how I can get to the C++ source of the classes?

Thank you very much.

You would have to implement (or rip out) quite a few classes. At least one similarity metric, simplest one being MeanSquares, whose source code is here and here. And right here you see the problem: it has almost no source code inside, it mostly relies on parent classes.

It might be simpler to implement something from scratch (e.g. based on a paper) then try to “take a few classes” out of a C++ library and “throw away” the rest.

Thanks Dženan. It is time-saving and useful to get the confirmation that the source is not here.

Thank you for the implementation suggestion as well. I did find some book chapter talking about the Gauss-Newton method. The main issue seems to be computing the derivative of the similarity metric with respect to the motion parameters (which is said to be easy to compute following the chain rule), but I am a bit clueless.

You said “… out of a C++ library…” - do you know of any that I can dig into?

Many thanks.

ITK is a C++ library.

More meaty classes are:
… and many more. And they are connected to a lot of other classes, with functionality being spread over inheritance hierarchy.

If you want to write a small, self-contained registration method, starting from a powerful and complicated library is going about it backwards.

I see your point.
Thank you very much.