2

I am using Matlab's imregtform() function to register two 3D MRI images to one another. I know that both images are related by a rotation about the center of the image, and am using the 'rigid' transform type to perform the registration. However, the transforms generated have a small but nonzero (less than 0.5 pixel) translational component. Is there any way to specify that translation should be exactly zero? If necessary, I am willing to use other tools outside of Matlab.

Dženan
  • 3,329
  • 3
  • 31
  • 44
hbraunDSP
  • 57
  • 7
  • Are you sure its only rotation? Have you try to remove the translation and see if it fits better? – Ander Biguri Aug 21 '18 at 20:17
  • Delete me if I'm wrong but I'm assuming when you mean it's only rotated you mean it's rotated around the center. In that case, the affine matrix would include a translational element as the rotating point in an affine matrix is the upper left point? In that case you would still need the translational element. – Durkee Aug 22 '18 at 14:00
  • @Durkee I am using spatial referencing objects to specify the coordinate system, which has its origin in the center of the volume. The rotation is about this same origin, so the ground-truth translation vector really is zero. – hbraunDSP Aug 25 '18 at 23:07

1 Answers1

0

I assume the transformation is based on fiducial markers right?. The procedure for calculating the least square rigid transformation is as follows: first you calculate the least square rotation matrix (R), then using R the scaling factor (s) and lastly using both R and s the translation vector (t).

Let fid1 and fid2 be the xy-coordinates of the fiducial markers of their respective MRI. Then the translation vector is calculated as:

t = mean(fid1) - s*R*mean(fid2)

Note that you would have to have an absolutely perfect accuracy when choosing the fiducial markers to have a translation of zero.

You are however free to remove the translation after the transformation since the estimation of R and s doesn't depend on t. To remove the translation do as follows:

tform = imregtform(....)

% Set the last row except the last element of the transformation 
% matrix to zero. This removes the translation.
tform.T(end,1:end-1) = 0;

% Register the two images
movingRegistered = imwarp(...,tform,...);

hope this helps

Lasse
  • 36
  • 2
  • I'm not using fiducial markers; I'm registering based on the whole image. More importantly, I'm not convinced that your claim "estimation of R and s doesn't depend on t" is accurate. As a counterargument, consider a uniform sphere centered at coordinates (1,0,0) in image 1 and (0,1,0) in image 2. This could be a 90-degree rotation about the origin with no translation, or it could be a translation of (-1,1,0), with no rotation. The simple case I made up is underdetermined, but hopefully you can see how this generalizes. – hbraunDSP Sep 06 '18 at 19:49
  • What I meant was that R, s and t are calculated independently. See e.g.: https://igl.ethz.ch/projects/ARAP/svd_rot.pdf – Lasse Sep 29 '18 at 01:07