[ITK] [ITK-users] Applying transform with a rotation, translation, and offset to points

Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] zivrafael.yaniv at nih.gov
Thu Mar 23 16:41:31 EDT 2017


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 <aharr8 at uwo.ca>
Date: Thursday, March 23, 2017 at 3:46 PM
To: Matt McCormick <matt.mccormick at kitware.com>
Cc: Insight-users <insight-users at 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 <matt.mccormick at kitware.com<mailto:matt.mccormick at 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

On Wed, Mar 22, 2017 at 3:15 PM, Andrew Harris <aharr8 at uwo.ca<mailto:aharr8 at uwo.ca>> wrote:
> 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
>
> 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-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170323/c3b79e00/attachment-0001.html>
-------------- next part --------------
_____________________________________
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-users


More information about the Community mailing list