[Insight-users] Inverse of affine transform with non zero center of rotation

John D john.dz.eis at gmail.com
Fri Jun 15 13:43:21 EDT 2012


Hello,

 I am calculating the inverse of an affine transform using the GetInverse()
Method. The transformation has a non-zero center of rotation. After the
inverse, I am getting a center of rotation that is reset to the origin. Is
this the expected behavior? Is there a way to force the inverse to have the
same center of rotation?


Here is the code:

typedef itk::AffineTransform< double, 2 > TransformType;
TransformType::Pointer      transform     = TransformType::New();
TransformType::ParametersType
affParameters(transform->GetNumberOfParameters());
for(int i=0;i<6;i++)
affParameters[i] = transParameters[i];
transform->SetParameters(affParameters);
double center[2];
center[0] = transParameters[6];
center[1] = transParameters[7];
transform->SetCenter(center);

TransformType::Pointer inverse = TransformType::New();
transform->GetInverse(inverse);
TransformType::ParametersType inverseParameters  = inverse->GetParameters();

inverseTransParamters[0] = inverseParameters[0];
inverseTransParamters[1] = inverseParameters[1];
inverseTransParamters[2] = inverseParameters[2];
inverseTransParamters[3] = inverseParameters[3];
inverseTransParamters[4] = inverseParameters[4];
inverseTransParamters[5] = inverseParameters[5];

inverseTransParamters[6] = inverse->GetCenter()[0];
inverseTransParamters[7] = inverse->GetCenter()[1];

Thanks,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120615/386b1fa7/attachment.htm>


More information about the Insight-users mailing list