[Insight-users] Assigning matrix and offset to
VersorRigid3DTransform
Vicente Grau
vicente at robots.ox.ac.uk
Thu Feb 2 14:29:10 EST 2006
Hi,
I am trying to initialize a VersorRigid3DTransform using a rotation
matrix and an offset vector. The result I get is different, however,
than if I initialize it using the 6 transform parameters. In the code
below, I just initialize the transform once using matrix/offset, and
then again with the corresponding versor parameters (using
transform->SetParameters( transform->GetParameters() ); ), and the
matrix I obtain is the inverse. This is the result:
Initial matrix: -0.1371 0.3683 0.9195
-0.2764 -0.9057 0.3216
0.9512 -0.2101 0.226
Initial offset: [-0.4294, -0.0078, 0.4992]
Initial parameters: [0.620983, 0.0370127, 0.753133, -0.4294, -0.0078,
0.4992]
Final matrix: -0.13716 -0.276387 0.951208
0.368324 -0.90566 -0.210042
0.919524 0.321544 0.22602
Final offset: [-0.4294, -0.0078, 0.4992]
Final parameters: [0.620983, 0.0370127, 0.753133, -0.4294, -0.0078, 0.4992]
Is this normal? Am I doing anything wrong?
Thanks very much,
Vicente
***** CODE FOLLOWS *****
typedef itk::VersorRigid3DTransform< double > TransformType;
TransformType::MatrixType rotationMatrix;
TransformType::OutputVectorType translation;
rotationMatrix[0][0] = -0.1371; rotationMatrix[0][1] = 0.3683;
rotationMatrix[0][2] = 0.9195;
rotationMatrix[1][0] = -0.2764; rotationMatrix[1][1]=-0.9057;
rotationMatrix[1][2] = 0.3216;
rotationMatrix[2][0] = 0.9512; rotationMatrix[2][1] = -0.2101;
rotationMatrix[2][2]=0.2260;
translation[0] = -.4294; translation[1] = -.0078; translation[2]
= .4992;
TransformType::Pointer transform = TransformType::New();
transform->SetMatrix( rotationMatrix );
transform->SetOffset( translation );
std::cout << "Initial matrix: " << transform->GetMatrix();
std::cout << "Initial offset: " << transform->GetOffset() <<std::endl;
std::cout << "Initial parameters: " << transform->GetParameters()
<<std::endl<<std::endl;
transform->SetParameters( transform->GetParameters() );
std::cout << "Final matrix: " << transform->GetMatrix();
std::cout << "Final offset: " << transform->GetOffset() <<std::endl;
std::cout << "Final parameters: " << transform->GetParameters()
<<std::endl<<std::endl;
More information about the Insight-users
mailing list