[Insight-users] itkMatrix error: discards qualifiers??
Frederic Perez
fredericpcx at gmail.com
Tue Mar 30 06:55:42 EDT 2010
Hello Michiel,
perhaps you could use a const Matrix object after all, since it looks to me
that FinalRotation is first built with image->GetDirection() but this value
is not actually used, and that the signature of itk::Image's is
SetDirection(const DirectionType direction).
So here you are, my quickly written proposal (caution, I haven't compiled
it):
float angleX, angleY, angleZ;
angleX = angleY = angleZ = 5;
const double cx = vcl_cos(angleX);
const double sx = vcl_sin(angleX);
typedef itk::Matrix<double,3,3> Matrix;
Matrix RotationX;
// Matrix FinalRotation = image->GetDirection(); -- Commented now
RotationX[0][0] = 1; RotationX[0][1] = 0; RotationX[0][2] = 0;
RotationX[1][0] = 0; RotationX[1][1] = cx; RotationX[1][2] = sx;
RotationX[2][0] = 0; RotationX[2][1] = -sx; RotationX[2][2] = cx;
const Matrix FinalRotation = direction*RotationX;
std::cout << "image->GetDirection(): " << std::endl <<
image->GetDirection() << std::endl;
std::cout << "RotationX: " << std::endl << RotationX << std::endl;
std::cout << "FinalRotation: " << std::endl << FinalRotation << std::endl;
image->SetDirection(FinalRotation);
std::cout << "image->GetDirection(): " << std::endl <<
image->GetDirection() << std::endl;
Cheers,
Frederic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100330/77330429/attachment.htm>
More information about the Insight-users
mailing list