[Insight-users] Clarification on GetObjectToWorldTransform?

Patrik Brynolfsson patrik.brynolfsson at radfys.umu.se
Wed Oct 13 20:29:22 EDT 2010


Hello,

I have a GroupType phantom, containing some ellipses. I have applied a
transform to the phantom group:

phantom->GetObjectToWorldTransform()->SetMatrix(transform->GetMatrix());

phantom->GetObjectToWorldTransform()->SetOffset(transform->GetOffset());
phantom->ComputeObjectToWorldTransform();


Now I try the transform to se if it produces reasonable results:

EllipseType::PointType point;

point[0] = -25/sqrt(2.0);

point[1] = 25/sqrt(2.0);

point[2] = -47.5;

EllipseType::PointType point2 =
phantom->GetObjectToWorldTransform()->TransformPoint(point);
std::cout << "Transformed point 1 is: " << point2 << std::endl;


I now try the same thing with one of the ellipses in the group:

// Try with ellipse

GroupType::ChildrenListPointer children = phantom->GetChildren();

GroupType::ChildrenListType::const_iterator itr = children->begin();

itr++;

point2 =
itr->GetPointer()->GetObjectToWorldTransform()->TransformPoint(point);
std::cout << "Transformed point 2 is: " << point2 << std::endl;

delete children;


But the points calculated with the two methods are not the same. The
point variable
is the center of the ellipse, so


EllipseType::PointType center =
itr->GetPointer()->GetBoundingBox()->GetCenter();

point2 =
itr->GetPointer()->GetObjectToWorldTransform()->TransformPoint(center);


should produce the same result as when getting the world coordinate from the
phantom group?

If I use the GetObjectToParentTransform(), I get the ellipse position in the
phantom, as I expect. I want to get the ellipse position in world
coordinates from it's center, what am I doing wrong?

Regards,
---
Patrik Brynolfsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101014/6cca01a9/attachment.htm>


More information about the Insight-users mailing list