Hi,
This sounds like an ITK problem. We have little influence over that. Maybe you
could ask at the insight-users list?
I’m not sure what you want to calculate, but maybe this helps:
itkQuaternionTransformType::Pointer t1 =itkQuaternionTransformType::New();
t1->SetRotation(nd1->GetOrientation());
t1->SetTranslation(nd1->GetPosition());
itkQuaternionTransformType::Pointer t2 =itkQuaternionTransformType::New();
t2->SetRotation(nd2->GetOrientation());
t2->SetTranslation(nd2->GetPosition());
t2->Compose(t1);
TransformFilter->SetRigid3DTransform(t2);
Best Regards,
Jochen
--------------
MSc. Jochen Neuhaus
Deutsches Krebsforschungszentrum
Div. Medical and Biological Informatics (E130)
Im Neuenheimer Feld 280
D-69120 Heidelberg, Germany
Email: [email protected]
Phone: (+49) 6221/42-3553
Fax: (+49) 6221/42-2345
Von: Keshav Chintamani [mailto:[email protected]]
Gesendet: Dienstag, 26. Oktober 2010 16:41
An: mitk-users; Neuhaus Jochen
Betreff: Re: [mitk-users] Problem with mitkNavigationDataTransformFilter
Hi Jochen,
Instead of calculating the transform between two tools using matrices, this
time I used quaternions to calculate the relative position between two NDI
rigid bodies. The relative positions of the two tools (measured on a
calibration jig) is computed correctly. I think my quaternion method is right
as well.
I used the following code to setup the NavigationDataTransformFilter:
FunctionToStartFilter(mitk::NavigationData::Pointer nd1,
mitk::NavigationData::Pointer nd2)
{
/.Computing rigid transformation between two NDI tools
//Create a type of 1 x 3 vector
typedef vnl_vector_fixed<float,3> Vector_3;
typedef itk::QuaternionRigidTransform<mitk::ScalarType>
itkQuaternionTransformType;
// Get quaternion orientation from each tool
mitk::NavigationData::OrientationType pQuat=nd1->GetOrientation();
mitk::NavigationData::OrientationType tQuat=nd2->GetOrientation();
pQuat.normalize();
tQuat.normalize();
Vector_3 pPos;
Vector_3 qPos;
pPos=nd1->GetPosition().GetVnlVector();
qPos=nd2->GetPosition().GetVnlVector();
mitk::NavigationData::OrientationType pQuatInv=pQuat.inverse();
Vector_3 neg_pPos=-pPos;
Vector_3 inv_pPos=pQuatInv.rotate(neg_pPos);
Vector_3 posCalibrationinProbeFrame=pQuatInv.rotate(qPos)+inv_pPos;
mitk::NavigationData::OrientationType CalibinProbeFrame=pQuatInv*tQuat;
itkQuaternionTransformType::VnlQuaternionType
vnlOutputQuat=CalibinProbeFrame;
itkQuaternionTransformType::TranslationType outputPos;
for(int i=0;i<3;i++){
outputPos[i]=posCalibrationinProbeFrame[i];
}
itkQuaternionTransformType::Pointer
itkOffsetTransform=itkQuaternionTransformType::New();
itkOffsetTransform->SetRotation(vnlOutputQuat);
itkOffsetTransform->SetTranslation(outputPos);
itkOffsetTransform->Modified();
TransformFilter=mitk::NavigationDataTransformFilter::New();
TransformFilter->SetInput(nd1); //nd1 is a pointer to the navigation data;
TransformFilter->SetRigid3DTransform(itkOffsetTransform);
mitk::NavigationData* ndAfterTransform=TransformFilter->GetOutput(); //At
this point, the program throws an exception
itk::ERROR: QuaternionRigidTransform(0E7D2728): Attempting to set a
non-orthogonal rotation matrix
}
I tried both methods to set the rigid transform. 1) by passing an
itk::Rigid3DTransform; 2) by passing an itk::QuaternionRigidTransform.
I know that the itk::QuaternionRigidTransform converts the quaternion into a
rotation matrix internally. The rotation matrix was orthogonal to a tolerance
of about 4-5 decimal places with both methods. Maybe you have some thoughts on
the root of this issue?
Looking forward to your reply,
Regards,
-Keshav
Keshav Chintamani,
Systems Engineer
Space Applications Services NV
Leuvensesteenweg 325
1932 Zaventem
Belgium
Tel: +32 2 721 54 84 Fax: +32 2 721 54 44
URL: http://www.spaceapplications.com
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users