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

Miller, James V (GE, Research) millerjv at crd.ge.com
Wed Feb 8 11:59:14 EST 2006


I think you want make the inverse call the other way around

transform->GetInverse(inv);

This will fill "inv" with the inverse of "transform".

Jim

-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Steffi Meyer
Sent: Wednesday, February 08, 2006 10:33 AM
To: insight-users at itk.org
Subject: [Insight-users] Matrix inversion of a 4x4 transformation matrix


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

_______________________________________________
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