Discussion:
[ITK-users] Applying transform with a rotation, translation, and offset to points
Andrew Harris
2017-03-22 19:15:41 UTC
Permalink
Hello,
I would like to be able to duplicate the applicaiton of a
VersorRigid3DTransform that incorporates a rotation, translation, and
offset to points selected to calculate TRE between a fixed and transformed
moving image. I’m confused about how the 3x3 matrix, 3x1 transform, and
3x1 offset are applied within a ResampleFilter. If I could get them
composed into a 4x4 transform matrix I could apply that to the points
selected in the moving image and calculate the distance between the
transformed points and the corresponding points in the fixed image. Any
help would be appreciated.

--

AH


------------------------------------------------------------
-----------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Matt McCormick
2017-03-22 21:00:44 UTC
Permalink
Hello Andrew,

To apply the transformation, typically the methods,

itk::Image::TransformIndexToPhysicalPoint
itk::Transform::TransformPoint

would be used.


Nonetheless, a matrix representation from VersorRigid3DTransform can
be obtained from its base class methods
itk::MatrixOffsetTransformBase::GetMatrix and
itk::MatrixOffsetTransformBase::GetOffset.

HTH,
Matt
Post by Andrew Harris
Hello,
I would like to be able to duplicate the applicaiton of a
VersorRigid3DTransform that incorporates a rotation, translation, and offset
to points selected to calculate TRE between a fixed and transformed moving
image. I’m confused about how the 3x3 matrix, 3x1 transform, and 3x1 offset
are applied within a ResampleFilter. If I could get them composed into a
4x4 transform matrix I could apply that to the points selected in the moving
image and calculate the distance between the transformed points and the
corresponding points in the fixed image. Any help would be appreciated.
--
AH
-----------------------------------------------------------------------------------------------
This email and any attachments thereto may contain private, confidential,
and privileged materials for the sole use of the intended recipient. Any
reviewing, copying, or distribution of this email (or any attachments
thereto) by other than the intended recipient is strictly prohibited. If you
are not the intended recipient, please contact the sender immediately and
permanently destroy this email and any attachments thereto.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
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.php

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://public.kitware.com/mailman/listinfo/insight-us
Andrew Harris
2017-03-23 19:46:03 UTC
Permalink
Hi Matt,
Thanks for getting back to me. I’m still a bit foggy about the
relationship between matrix, offset, and translation. I think I’m going to
try and mark my targets within ITK and transform them as you have
suggested, outputting a text file to then analyze. However, I would like
to know what is going on “under the hood” so to speak, just in case someone
asks me to explain it. If I were to compose a 4x4 transformation matrix
using the 3x3 matrix and 3x1 offset, apply it to a point, and then add the
3x1 translation after the fact would that correctly transform the point?


--

AH


-----------------------------------------------------------------------------------------------

*This email and any attachments thereto may contain private,
confidential, and privileged materials for the sole use of the intended
recipient. Any reviewing, copying, or distribution of this email (or any
attachments thereto) by other than the intended recipient is strictly
prohibited. If you are not the intended recipient, please contact the
sender immediately and permanently destroy this email and any attachments
thereto.*
Post by Matt McCormick
Hello Andrew,
To apply the transformation, typically the methods,
itk::Image::TransformIndexToPhysicalPoint
itk::Transform::TransformPoint
would be used.
Nonetheless, a matrix representation from VersorRigid3DTransform can
be obtained from its base class methods
itk::MatrixOffsetTransformBase::GetMatrix and
itk::MatrixOffsetTransformBase::GetOffset.
HTH,
Matt
Post by Andrew Harris
Hello,
I would like to be able to duplicate the applicaiton of a
VersorRigid3DTransform that incorporates a rotation, translation, and
offset
Post by Andrew Harris
to points selected to calculate TRE between a fixed and transformed
moving
Post by Andrew Harris
image. I’m confused about how the 3x3 matrix, 3x1 transform, and 3x1
offset
Post by Andrew Harris
are applied within a ResampleFilter. If I could get them composed into a
4x4 transform matrix I could apply that to the points selected in the
moving
Post by Andrew Harris
image and calculate the distance between the transformed points and the
corresponding points in the fixed image. Any help would be appreciated.
--
AH
------------------------------------------------------------
-----------------------------------
Post by Andrew Harris
This email and any attachments thereto may contain private, confidential,
and privileged materials for the sole use of the intended recipient. Any
reviewing, copying, or distribution of this email (or any attachments
thereto) by other than the intended recipient is strictly prohibited. If
you
Post by Andrew Harris
are not the intended recipient, please contact the sender immediately and
permanently destroy this email and any attachments thereto.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]
2017-03-23 20:41:31 UTC
Permalink
Hello Andrew,

This is a bit off topic as you are interested in bare ITK, but this may help your understanding. The following SimpleITK notebook has explanations and examples of how ITK/SimpleITK transformations work https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/22_Transforms.ipynb .

The following notebook does exactly what you want, maps points from one image to another before and after registration, computes the TRE and also displays the specific error for each point in 3D, https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/65_Registration_FFD.ipynb . The code that does the computations and graphics is in registration_utilities.py .

If you are ok with Python then I believe you can easily use the code as is. If you need to implement it in original ITK (C++) then the code can server as a reference for your C++ implementation. Note that most of the computations for TRE are done using numpy functionality as ITK doesn’t have a convenient filter to do these computations (at least not one I am aware of).

hope this helps
Ziv

From: Andrew Harris <***@uwo.ca>
Date: Thursday, March 23, 2017 at 3:46 PM
To: Matt McCormick <***@kitware.com>
Cc: Insight-users <insight-***@itk.org>
Subject: Re: [ITK-users] Applying transform with a rotation, translation, and offset to points

Hi Matt,
Thanks for getting back to me. I’m still a bit foggy about the relationship between matrix, offset, and translation. I think I’m going to try and mark my targets within ITK and transform them as you have suggested, outputting a text file to then analyze. However, I would like to know what is going on “under the hood” so to speak, just in case someone asks me to explain it. If I were to compose a 4x4 transformation matrix using the 3x3 matrix and 3x1 offset, apply it to a point, and then add the 3x1 translation after the fact would that correctly transform the point?
--
AH



-----------------------------------------------------------------------------------------------

This email and any attachments thereto may contain private, confidential, and privileged materials for the sole use of the intended recipient. Any reviewing, copying, or distribution of this email (or any attachments thereto) by other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently destroy this email and any attachments thereto.

On Wed, Mar 22, 2017 at 5:00 PM, Matt McCormick <***@kitware.com<mailto:***@kitware.com>> wrote:
Hello Andrew,

To apply the transformation, typically the methods,

itk::Image::TransformIndexToPhysicalPoint
itk::Transform::TransformPoint

would be used.


Nonetheless, a matrix representation from VersorRigid3DTransform can
be obtained from its base class methods
itk::MatrixOffsetTransformBase::GetMatrix and
itk::MatrixOffsetTransformBase::GetOffset.

HTH,
Matt
Post by Andrew Harris
Hello,
I would like to be able to duplicate the applicaiton of a
VersorRigid3DTransform that incorporates a rotation, translation, and offset
to points selected to calculate TRE between a fixed and transformed moving
image. I’m confused about how the 3x3 matrix, 3x1 transform, and 3x1 offset
are applied within a ResampleFilter. If I could get them composed into a
4x4 transform matrix I could apply that to the points selected in the moving
image and calculate the distance between the transformed points and the
corresponding points in the fixed image. Any help would be appreciated.
--
AH
-----------------------------------------------------------------------------------------------
This email and any attachments thereto may contain private, confidential,
and privileged materials for the sole use of the intended recipient. Any
reviewing, copying, or distribution of this email (or any attachments
thereto) by other than the intended recipient is strictly prohibited. If you
are not the intended recipient, please contact the sender immediately and
permanently destroy this email and any attachments thereto.
_____________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Loading...