[Insight-users] Clarification on GetObjectToWorldTransform?

Luis Ibanez luis.ibanez at kitware.com
Sun Oct 17 06:04:27 EDT 2010


Hi Patrik,


When you call:

        phantom->ComputeObjectToWorldTransform()

the values of Offset and Matrix that you manually
set in the calls:

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

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

are overwritten.


See the implementation of the method in

itkSpatialObject.txx: lines 316-363.

The new "ObjectToWorldTransform" is computed by
composing the transforms:

*  ObjectToNode
*  NodeToWorld



    Regards,


            Luis


-----------------------------------------------------------------------
On Wed, Oct 13, 2010 at 8:29 PM, Patrik Brynolfsson <
patrik.brynolfsson at radfys.umu.se> wrote:

> 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
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/80e9bafb/attachment.htm>


More information about the Insight-users mailing list