[Insight-users] Euler3DTransform, Rotation Matrix & Initial Parameters - Continued

N.E. Mackenzie Mackay 9nem at qlink.queensu.ca
Thu Jul 15 16:20:55 EDT 2004


Hey Luis,

	Thanks for the help.

	I tried implementing the code that you sent.  It compiles and builds  
fine but am having some difficulty at runtime.  It seems to be crashing  
when I "SetRotationMatrix".  I am not sure why.  Here is a snapshot of  
my code:

	  TransformType::Pointer transform = TransformType::New();

	  TransformType::OffsetType initialTranslation =  
transform->GetOffset() ;

	  initialTranslation[0] = 22.1413;
	  initialTranslation[1] = 162.527;
	  initialTranslation[2] = 49.913;

	  transform->SetOffset(initialTranslation);

	  typedef itk::Matrix<double,3,3> MatrixtType ;
	  MatrixtType initialRotation;

	  initialRotation[0][0] = -0.016292; initialRotation[0][1] = 0.098948;  
initialRotation[0][2] = 0.0;
	  initialRotation[1][0] = 0.00418400;initialRotation[1][1] = 0.007931;  
initialRotation[1][2] = 0.0;
	  initialRotation[2][0] = -0.095128; initialRotation[2][1] =  
-0.008306;initialRotation[2][2] = 0.0;

	transform2->SetRotationMatrix(initialRotation);// crashes on this line
	transform2->SetOffset(initialTranslation);

	TransformType::ParametersType initialParameters =  
transform->GetParameters() ;

	registration->SetInitialTransformParameters(initialParameters);

Thanks for the help,
Neilson

On Jul 14, 2004, at 1:21 PM, Luis Ibanez wrote:

>
> Hi Neilson,
>
> The class Euler3DTransform has a method for converting
> a 3X3 rotation matrix into the 3 rotaion angles.
> Note that from your 4x4 matrix, only the upper left
> 3x3 submatrix contains information about rotations.
>
> http://www.itk.org/Insight/Doxygen/html/ 
> classitk_1_1Euler3DTransform.html
>
> it is the method
>
>    ComputeAnglesFromMatrix()
>
> This is a protected method because you don't really need
> to use it. But if you are curious about the implementation
> you may want to take a look at the .txx file.
>
>
> Note also that you don't need to do this angle computation
> since you can initialize the transform with the 3X3 rotation
> matrix and a translation, then call  GetParamters() on the
> transform, and finally pass that array of parameters to the
> ImageRegistrationMethod.
>
>
> The code will look like:
>
>
>    MatrixType rotation = Extract3by3MatrixFromYours();
>    OffsetType translat = Extract3VectorFromYours();
>
>    euler3DTransform->SetRotationMatrix( rotation );
>    euler3DTransform->SetOffset( translat );
>
>    TransformType::ParametersType parameters =
>                         euler3DTransform->GetParameters();
>
>
>    registrationMethod->SetInitialParameters( parameters );
>
>
>
>
>
> Please let us know if you have further questions
>
>
>
>   Thanks,
>
>
>
>      Luis
>
>
>
> -------------------------------
> N.E. Mackenzie Mackay wrote:
>
>> I am trying to initialize Euler3DTransform in order to perform a  
>> rigid  registration.  I have a rotation matrix that I wish to use to   
>> initialize the transformation.  After reading   
>> http://public.kitware.com/pipermail/insight-users/2003-November/  
>> 005506.html it looks like this is impossible, the only way to   
>> initialize the transformation is to set angles and translation   
>> explicitly.
>> If this is the case I was wondering if anyone knew a way to extract  
>> the  3 angles from a 4x4 homogenous matrix?
>> Thanks
>> Neilson
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>
>
>



More information about the Insight-users mailing list