I am running intensity based image registration using SimpleITK. I am using timeit command, with 7 repetitions, to find out the mean time required by the registration process.

I also want to find out the mean final_transformation of the 7 iterations of timeit. How can I do that?

This is not an ITK/SimpleITK question, it is about the timeit magic from ipython, so not the correct forum for asking such a question.

Having said that, the answer is that you cannot achieve what you want using the timeit magic because it discards the output and you need to retain outputs across iterations. You will need to implement your own, something along the lines of:

import random
import time
num_iterations = 3
res_list = []
times_list = []
for i in range(num_iterations):
start_time = time.time()
registration_result = random.randint(0,10)
end_time = time.time()
res_list.append(registration_result)
times_list.append(end_time - start_time)

Back to SimpleITK/ITK, be careful when computing the average of multiple transformations. This is usually not the naive mean (see this paper on averaging rotations).