We have T1W 3D image and its tumor mask of shape 240 x 240 x 155. Now we want to register both image and mask to MNI152 template. MNI152 (mni_icbm152_t1_nlin_asym_09a) shape is 197 x 233 x 189. We are doing linear registration and image is registered but it seems mask is not registered. How do to registration and resampling of the tumor mask so that it will match with the registered image?
The transformation returned by the registration maps points from the fixed_image coordinate system to the moving_image coordinate system. For additional details see the registration overview documentation.
The code we are using is given below. We are using all the default parameters. For the best results which parameters need to be adjusted and anything else we need to include or delete from here?
Could you please help us on how to perform noise removal, and bias correction?
In terms of parameter settings, you will have to play with those to find the optimal values for your setup (there are no values that are appropriate for all tasks). Also, before evaluating the registration quality, you need to explicitly specify the desired target registration error appropriate for your analysis. The only thing that is certain is that it isn’t an error of zero mm, but it is possible that any value below 2mm is sufficiently good. This bound is task specific.
Motion correction is not registration. Motion correction is a specific task, it can be done using registration. For a general overview see the paper Motion correction in MRI of the brain.
We tried calculating registration error as given in the following code. Is this the correct way of calculating TRE? The way we are taking fixed and moving points are correct or wrong?
Initial transformation we are getting 0 and final transformation we are getting mean(std) as 29(11) mm. Could you please help us why we are getting such as high values. You suggested that it should be less than 2 mm. Right?
Thank you so much for your help Ziv.
Best regards,
Sunita
# (corresponding points in the fixed and moving images).
fixed_points = ru.generate_random_pointset(image=fixed_image, num_points=100)
moving_points = [initial_transform.TransformPoint(p) for p in fixed_points]
(
initial_errors_mean,
initial_errors_std,
initial_errors_min,
initial_errors_max,
_,
) = ru.registration_errors(
initial_transform,
fixed_points,
moving_points,
display_errors=False,
)
print(
f"After initialization, errors (TRE) in millimeters, mean(std): {initial_errors_mean:.2f}({initial_errors_std:.2f}), max: {initial_errors_max:.2f}"
)
final_errors_mean, final_errors_std, _, final_errors_max, _ = (
ru.registration_errors(
final_transform,
fixed_points,
moving_points,
min_err=initial_errors_min,
max_err=initial_errors_max,
display_errors=False,
)
)
print(
f"After registration, errors in millimeters, mean(std): {final_errors_mean:.2f}({final_errors_std:.2f}), max: {final_errors_max:.2f}"
)
“You suggested that it should be less than 2 mm. Right?” - You misunderstood the guidance. You need to identify the required accuracy for your application, 2mm is an example. I do not know what is the requirement for your application it could be 1mm but likely not 10mm. In any case, once that is defined you can judge whether a registration is sufficiently good for your task.
With respect to target registration error and its computation, please see this notebook. Highly recommend that you read the publications referenced there where the fundamentals of registration evaluation are described.