How can I gain better understanding of the codes for the Group-wise fODF registration?

Dear experts,
I have two problems with the codes of ‘population_template’ which was considered a group-wise registration approach.
I am seeking ways to improve the quality of the population template generated from fODF. While I appreciate the ‘population_template’ that has been implemented, I also seek strategies in improving the registration procedures for longitudinal infant data. However, when I read the codes provided in ‘https://github.com/MRtrix3/mrtrix3/blob/master/bin/population_template’, I often get lost. My problems must be caused by,
1) the lack of background knowledge, and I can only find little documents/comments describing the codes, which are too few to help me in understanding the functions such as ‘mrcalc’ of line 1199 and ‘transformcalc’ of line 1228; and why do the codes have to execute such procedures?
2) If I compute the GFA from fODF via DIPY, how do you think in evaluating the generated odf-template?

Best,
Feihong Liu

It seems that population_template has two main configurations: 1) multi-contrast registration; 2) normal registration.

  1. What is multi-contrast? This puzzles me. Besides ODF, it seems to mean additional input, such as T1 or something. This is only my guess, NOT verified.

  2. The default setting of normal registration is more like the Syn configuration in ANTs, which includes rigid, affine, and non-linear three stages. Here population_template works for fODF inputs. The rigid and affine registration here is denoted as the initial-registration stage, while the non-linear one further optimizes the previous results.

The class Input with its execute() is the main part of population_template, which employ other classes and function. Codes between line 586 and 813 are the initialization parts, while codes between line 814 and 940 are the setting parts of the three stages of registration, i.e., rigid, affine, and non-linear.

Above settings work in the lines beginning with “run.command”, which starts from line 946. I find that commands usage such as ‘mraverageheader’, ‘mrfilter’, and ‘transformcalc’ are not common in a regular pipeline. I need gain the knowledge.

The codes are too long to be easily read over. I just finished understanding the part of return 'Optimising template with linear registration (stage {0} of {1}; {2})'.format(level + 1, len(linear_scales), regtype)

In addition, I am writing a blog in Chinese, CSDN - understanding the codes in population_template of MRtrix3. After totally understanding and reimplementing the functions. I will back and summary the functions in English for additional information of ‘population_template’.

: )