[Insight-users] How to calculate a combined transformation Matrix

Michael Jackson mike.jackson at bluequartz.net
Tue Jul 21 19:10:57 EDT 2009


  I have a stack of images where each image is rotated about an  
arbitrary point relative to the image below it. The centers of  
rotation are NOT constant from slice to slice and neither is the  
actual rotation. So basically as I read each image I would need to  
compute the transformation matrix then combine that with the current  
cummulative transformation matrix.

   I have been looking at the various transform classes and the class  
that I currently use for simple image rotations is the  
CenteredRigid2DTransform class. Looking through the documentation it  
seems that I can only get the Rotation matrix (upper left 2x2 of the  
transformation matrix). I see methods for the Center, Translation and  
Offset but I am a bit stumped as to how to actually use what I compute  
as arguments for some of those methods.

Some pseudo code I guess would be something like:

int nImages = 100;
// Matrix is a Class to hold a 3x3 matrix
Matrix combined (3, 3);
for (int i = 0; i < nImages; ++i)
{

   LoadImageRotationData();
   Matrix t = ComputeTransformationMatrix();
   CombineMatrix(t, combined);

   itkCenteredRigid2DTransform transform;
   transform->set...();

   RotateImage();
}

Any help filling in the blanks on the ITK part would be most helpful  
or just pointing me to an example would be great.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio





More information about the Insight-users mailing list