Converting Image Coordinate System

3 views (last 30 days)
Henrique Amaral
Henrique Amaral on 12 Feb 2014
Answered: Muniba Ashfaq on 17 Jan 2020
Hi everyone,
I have worked on medical image registration and recently I downloaded the Vanderbilt database (<http://www.insight-journal.org/rire/information.php>) to test my algorithms. This database provides a reliable way to validate registration algorithms since they have de ground truth.
The issue is: My algorithm consider the center of each image involved in the registration has the origin, however, Vanderbilt consider the upper left corner as the point 0,0,0
So far ok. I am aware I need to convert mu coordinate system. I am following their instructions:
"Converting to our coordinate system
The recipe is as follows for CT-to-MR transformations:
Define: - T_ct = translation that brings our CT coordinate system into your CT coordinate system - T_mr = translation that brings our MR coordinate system into your MR coordinate system - R_ctmr = transformation that registers CT to MR in your coordinate systems
To transform for a point measured in our CT coordinate system into its registered position, measured in our MR coordinate system:
1) Apply T_ct to . 2) Apply R_ctmr to the result of step 1. 3) Apply the inverse of T_mr (n.b., NOT the inverse of T_ct) to the result of step 2."
Below is what I am doing:
*My algorithm assumes the center of the image volume as the origin.
//My results:
Loaded Input Image (Reference) training_001_mr_T1.gipl --- Size 256 256 26 1 Resolution 1.250000 1.250000 4.000000 1.000000 World Limit X: 0.000000 318.750000 World Limit Y: 0.000000 318.750000 World Limit Z: 0.000000 100.000000 Corner 1: 0.000000 0.000000 0.000000 1.000000 Corner 2: 318.750000 0.000000 0.000000 1.000000 Corner 3: 0.000000 318.750000 0.000000 1.000000 Corner 4: 318.750000 318.750000 0.000000 1.000000 Corner 5: 0.000000 0.000000 100.000000 1.000000 Corner 6: 318.750000 0.000000 100.000000 1.000000 Corner 7: 0.000000 318.750000 100.000000 1.000000 Corner 8: 318.750000 318.750000 100.000000 1.000000 --- My Reference Origin: 159.375000 159.375000 50.000000 RIRE Reference Origin: 0.000000 0.000000 0.000000
Loaded Input Image (Source) training_001_ct.gipl --- Size 512 512 29 1 Resolution 0.653595 0.653595 4.000000 1.000000 World Limit X: 0.000000 333.987030 World Limit Y: 0.000000 333.987030 World Limit Z: 0.000000 112.000000 Corner 1: 0.000000 0.000000 0.000000 1.000000 Corner 2: 333.987030 0.000000 0.000000 1.000000 Corner 3: 0.000000 333.987030 0.000000 1.000000 Corner 4: 333.987030 333.987030 0.000000 1.000000 Corner 5: 0.000000 0.000000 112.000000 1.000000 Corner 6: 333.987030 0.000000 112.000000 1.000000 Corner 7: 0.000000 333.987030 112.000000 1.000000 Corner 8: 333.987030 333.987030 112.000000 1.000000 --- My Source Origin: 166.993515 166.993515 56.000000 RIRE Source Origin: 0.000000 0.000000 0.000000
Converting to RIRE coordinate system ---------------------------------------------------------------
Step1: Apply T_ct to .
- T_ct = translation that brings our CT coordinate system into your CT coordinate system
RIRE Coordinate System (Source Image - CT)
Corner1 Corner2 Corner3 Corner4 Corner5 Corner6 Corner7 Corner8
0.000000 333.987030 0.000000 333.987030 0.000000 333.987030 0.000000 333.987030 0.000000 0.000000 333.987030 333.987030 0.000000 0.000000 333.987030 333.987030 0.000000 0.000000 0.000000 0.000000 112.000000 112.000000 112.000000 112.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
T_ct
1.000000 0.000000 0.000000 166.993515 0.000000 1.000000 0.000000 166.993515 0.000000 0.000000 1.000000 56.000000 0.000000 0.000000 0.000000 1.000000
Step 1 = T_ct * Original RIRE Coordinate System (Source Image - CT)
Corner1 Corner2 Corner3 Corner4 Corner5 Corner6 Corner7 Corner8
166.993515 500.980530 166.993515 500.980530 166.993515 500.980530 166.993515 500.980530 166.993515 166.993515 500.980530 500.980530 166.993515 166.993515 500.980530 500.980530 56.000000 56.000000 56.000000 56.000000 168.000000 168.000000 168.000000 168.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
---------------------------------------------------------------
Step2: Apply R_ctmr to result of Step 1
- R_ctmr = transformation that registers CT to MR in your coordinate systems
Matrix Transformation (R_ctmr)
0.996618 -0.082162 -0.001171 -27.250000 0.082138 0.995728 0.042188 24.570312 -0.002300 -0.042142 0.999109 14.750000 0.000000 0.000000 0.000000 1.000000
Step2 = Matrix Transformation (R_ctmr) * Step 1
Corner1 Corner2 Corner3 Corner4 Corner5 Corner6 Corner7 Corner8
125.392685 458.250275 97.951698 430.809265 125.261490 458.119080 97.820511 430.678070
206.929443 234.362473 539.489563 566.922607 211.654556 239.087585 544.214661 571.647705
63.278580 62.510429 49.203686 48.435532 175.178787 174.410629 161.103897 160.335739
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
-------------------------------------------------------
Step3: Apply the inverse of T_mr to the result of step 2
- T_mr = translation that brings our MR coordinate system into your MR coordinate system
T_mr Inverse (Inverse of the translation matrix T_mr)
1.000000 0.000000 0.000000 -159.375000 0.000000 1.000000 0.000000 -159.375000 0.000000 0.000000 1.000000 -50.000000 0.000000 0.000000 0.000000 1.000000
Step 3 = T_mr Inverse * Step 2
Corner1 Corner2 Corner3 Corner4 Corner5 Corner6 Corner7 Corner8
-33.982315 298.875275 -61.423302 271.434265 -34.113510 298.744080 -61.554489 271.303070
47.554443 74.987473 380.114563 407.547607 52.279556 79.712585 384.839661 412.272705
13.278580 12.510429 -0.796314 -1.564468 125.178787 124.410629 111.103897 110.335739
1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My Points:
Point x y z new_x new_y new_z
1 0.0000 0.0000 0.0000 -33.9823 47.5544 13.2785
2 333.9870 0.0000 0.0000 298.8752 74.9874 12.5104
3 0.0000 333.9870 0.0000 -61.4233 380.1145 -0.7963
4 333.9870 333.9870 0.0000 271.4342 407.5476 -1.5644
5 0.0000 0.0000 112.0000 -34.1135 52.2795 125.1787
6 333.9870 0.0000 112.0000 298.7440 79.7125 124.4106
7 0.0000 333.9870 112.0000 -61.5544 384.8396 111.1038
8 333.9870 333.9870 112.0000 271.3030 412.2727 110.3357
According the website, my points are wrong but visually my registration is perfect, so I am doing something wrong during the conversion of the coordinate system. Anyone knows what I am doing wrong here?
RIRE Points:
Corn x y z new_x new_y new_z
1 0.0000 0.0000 0.0000 5.0369 -17.4970 -27.1650
2 333.9870 0.0000 0.0000 338.0219 -43.3470 -27.4162
3 0.0000 333.9870 0.0000 30.8808 315.3043 -16.0856
4 333.9870 333.9870 0.0000 363.8658 289.4544 -16.3368
5 0.0000 0.0000 112.0000 4.8333 -21.2077 84.7733
6 333.9870 0.0000 112.0000 337.8183 -47.0576 84.5221
7 0.0000 333.9870 112.0000 30.6772 311.5937 95.8527
8 333.9870 333.9870 112.0000 363.6622 285.7437 95.6015
Thank you.

Answers (1)

Muniba Ashfaq
Muniba Ashfaq on 17 Jan 2020
Can anyone help me understand these conversions. I am also working on it. Ground truth transformations of training data is given. The resolution of CT is greater than MRI-T1, do i have to reduce resolution of CT according to MRI-T1. CT is moving image and MRI-T1 is fixed image. How to do all these conversion before applying my algorithm to find new_x, new_y and new_z.
How can we use this example as a correspondance to this problem

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!