[Insight-users] Matrix inversion of a 4x4 transformation matrix

Steffi Meyer saufi25 at web.de
Wed Feb 8 10:33:07 EST 2006


Hi,

I tried this, but as result the identity matrix is returned. Perhaps somewhere is an error.
Can someone help me with this?

        const unsigned int Dimension = 4;
	typedef itk::AffineTransform<double,Dimension> TransformType;

	// Initialize object
	TransformType::Pointer transform = TransformType::New();
	TransformType::Pointer inv = TransformType::New();
	TransformType::Pointer trans = TransformType::New();
	// Set up matrix for transform
	TransformType::MatrixType matrix;
	matrix[0][0] = 5; matrix[0][1] = 0; matrix[0][2] = 5; matrix[0][3] = 0;
	matrix[1][0] = 0; matrix[1][1] = 1; matrix[1][2] = 0; matrix[1][3] = 0;
	matrix[2][0] = 0; matrix[2][1] = 0; matrix[2][2] = 2; matrix[2][3] = 0;
	matrix[3][0] = 0; matrix[3][1] = 0; matrix[3][2] = 0; matrix[3][3] = 1;
	transform->SetMatrix(matrix);
 	cout << transform->GetMatrix() << endl;
	inv->GetInverse(transform); 

	cout << inv->GetMatrix() << endl;
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193



More information about the Insight-users mailing list