I have little experience on ITK, and little knowledge on C++, although, I am doing some studies on Mutual Information Metric in Registration Pipelines.
I’ve been reading a lot about registration, types of Mutual Information and its calculation, Metrics, Optimizers, and so on. However, I still do not have the insight on how to make it all into code.
I guess if I understand the ITK code for calculation of Mattes Mutual Information (READING THE DEFINITION FILE) I can make some changes to adapt the other concepts of Mutual Information and move on! And certainly, these edited files could work properly with ITK library.
So far, I am very much lost on the whole ITK documentation . I found these two C++ files:
Although, I’m not sure if they do contain the calculation of Mattes MI, and I’m not certain if the “.hxx” file contains the practical definitions of the methods I need to know.
I’d really be grateful to get any clue on how to get started with that.
Yes, .hxx file does contain the important code. But you should also look at the parent class, ImageToImageMetric and its implementation, especially GetValueThread method. But beware, this code is optimized for speed, not clarity. In particular, a large part of code deals with multi-threading.
Wow… Yes you made a point. I’m afraid I cannot make it through. It’s hard to understand the whole auxiliary multi-thread processing to then understand the metrics execution, But thanks anyway for the precise clue.
Hey @lassoan and @dzenanz,
I’ve made a good progress understanding ImageToImageMetric and MattesMutualInformationImageToImageMetric classes. Read some key papers and guess I got where I need to work to achieve my goals.
Although, I still have some unsolved issues and I’d like to ask for some help.
I did not get clearly where in the code, if in these two classes or elsewhere, parzen windowed PDFs (marginal and joint) are calculated.
They calculate it for both fixed and moving Image?
I’m talking precisely about this term in Mattes (2003) PET-CT paper:
Also in the code they mention a Parzen Window term/argument. Are they talking about the
and terms the Eq. above?
Now that I’ve done the changes I wanted. What is the pathway I should walk now to plug in the, let’s say, itkMachadoMutualInformationImageToImageMetricMetric.h and itkMachadoMutualInformationImageToImageMetricMetric.hxx , files resulted from the changes I did, and by changing itkMattes… everywhere in the original files by itkMachado… , in order to use it inside ITK environment?
I mean, Can I call those new files just by putting them inside the project folder and including them in the beginning of the main file? is that all? Or should I copy and paste those files somewhere else?
I made the changes in the itkMattes[…].h and in itkMattes[…].hxx.
And tested inserting those files inside a registration pipeline (ImageRegistration4.cpp from ITK software Guide examples), then I started to get many basic errors like:
"class has not any field named 'm_PerThread'"
"vcl_numeric_limits not recognized"
So, I looked carefully and found out that the classes […]Mattes[…].h and in […]Mattes[…].hxx used in the ITK5 software guide examples are somewhat different. I found in the ITK source files the following classes:
Now, I’m wondering if this is the latest implementation of itkMattesMultualInformation… , and if I should use those files or the ones available at ITK-Doxygen documentation.
Can you, please, help me to understand which ones I should use in order to compile every thing?
If you started your modification from ITKv5 master, that’s the version you should get ImageRegistration4.cpp from. If you started from ITKv4, you should use examples from there. Preferably the exact same version.
Please copy-paste the entire error message.
Finally, the only files with word Tsallis in the name on my computer are related to itk::JensenHavrdaCharvatTsallisPointSet. Which version of ITK are you working with, and where did you get it?
Sorry… I did not make my goals much clear.
I’m inserting other entropy definitions, instead of Shannon’s Entropy (in Mattes classes). I guess I made a complete mess with ITK versions.*
I just downloaded .h and .hxx from master… But I guess now I’ll have to build the ITKv5… Did not realize all that until now.
The screenshot I posted in the earlier message refers to my edited classes. Makes completely no sense since they are part from ItkV5, part from Itkv4. I just compared with the ones in master and I got all that. Hence, the error messages has no much meaning.
I’ll make the proper corrections and let you know if it did work.
I double-checked all the files. I downloaded the Master folder from Git and then built that. Then, I realized that the examples’ folder do not contain Registration ITK5, only the ITK4-fashion examples. Am I correct?
Is there any set of ITK5 Registration examples?
There are two registration frameworks. They are currently called v3 and v4. v4 was introduced with version 4, v3 existed prior to version 4. Both are still supported. But you can’t really mix classes from these two frameworks.
v3 is simpler, v4 is more flexible and powerful. Pick one, and go entirely with that one.
A lotta progress down here! Thank you guys again for the help. I would not give any step without it!
Now, I am trying to understand the way through which the .hxx class calculates the (jointPDF) derivatives.
I’m a bit confuse.
And why exactly it needs a gradient Image In this process…
Do I have access to the marginal moving PDF derivative according to the parameters?