.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.
For understanding how a software works, it can help if you run it in a debugger, stepping through the source code line by line.
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.
I hope I can find a way around.
I’ll work it out! Sure it is a good direction!
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?
Thanks again, buddies!
itkMattesMutualInformationImageToImageMetric of course. But also JointHistogramMutualInformationComputeJointPDFThreaderBase, and same file further down.
The entire itkJointHistogramMutualInformationGetValueAndDerivativeThreader. Also these files are involved too: itkJointHistogramMutualInformationImageToImageMetricv4 and itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.
Wow. I got it!
Will be reading and keep you guys here posted about anything!
firstly, thanks for the help.
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?
Yes, that should be all. Most filters get started exactly like that. And if you later conclude that the filter(s) are valuable, you can put them into a remote module.
I’m here again!
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.
I got it. So, I picked the .h and .hxx classes from ITK master, which is ITK5, I suppose. Therein, I found Registration V4, it means they are compatible. Is that right?
v4 classes are mostly in Registration/Metricsv4, while v3 classes are mostly in Registration/Common. There was no significant registration refactoring between ITKv4 and ITKv5. But registration was affected by multi-threading refactoring done in v5 [migration guide].
Fine. Now, I guess I can do it right. Thanks!
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?
@hjmjohnson might know that. Also you could look at the blame for the file to see who has been editing it.
You mean at git hub?