[ITK] [ITK-users] applying a transform to an ITK Point object results in it moving the opposite direction from the image
Andrew Harris
aharr8 at uwo.ca
Wed Jul 5 15:19:37 EDT 2017
Thanks for getting back to me.
The numbers correspond correctly to what is expected when I do the math
directly in MATLAB, and when I do the matrix multiplication I get the same
coordinates that are output by ITK for both the translation that works and
the rotation that does not. One curious note is that while I set the
center of rotation explicitly, it shows up as a zero vector in the output.
I was able to get the known rotation case to match up the expected
coordinates by subtracting newTranslatin()->GetOffset(); from the resulting
point, but then of course the known translation case fails.
Any further thoughts would be appreciated.
--
AH
Andrew Harris, Honours BSc (Medical Physics)
PhD (CAMPEP) & MClSc Candidate
-----------------------------------------------------------------------------------------------
*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 Thu, Jun 29, 2017 at 3:04 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <
zivrafael.yaniv at nih.gov> wrote:
> The code snippet looks correct. I would advise that you print the
> transformations to see that you are getting what you expect. The relevant
> entries, Matrix, Center, Translation, Offset:
>
>
>
> Original transform is:
>
>
>
> *T*(*x*)=*A*(*x*−*c*)+*t*+*c*
>
>
>
> Where:
>
> *A* – matrix
>
> *c* – center
>
> *t *– translation
>
> *t**+c –A**c* – offset
>
>
>
> The inverse should have:
>
> *A*^{-1} – matrix
>
> *c* – center
>
> -*A*^{-1}* t *– translation
>
> *c* - *A*^{-1}* t - **A*^{-1}* c* - offset
>
>
>
>
>
> hope this helps
>
> Ziv
>
>
>
> p.s. When working with ITK always remember that you are dealing with
> physical space, distances are in mm/km…, volumes in mm^3…. Don’t be tempted
> to measure things in pixels/voxels.
>
>
>
> *From: *Andrew Harris <aharr8 at uwo.ca>
> *Date: *Thursday, June 29, 2017 at 1:21 PM
> *To: *"Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]" <zivrafael.yaniv at nih.gov>
> *Cc: *Insight-users <insight-users at itk.org>
> *Subject: *Re: [ITK-users] [ITK] applying a transform to an ITK Point
> object results in it moving the opposite direction from the image
>
>
>
> Thanks for getting back to me. Using the inverse transform on the point
> selected in the moving image works to transform the point within a
> reasonable amount to the homologous feature selected in the fixed image
> when I use two identical images with a known offset of 100 voxels in each
> direction. However, upon testing identical images with a known rotation
> the selected points again fail to line up. The transform I have been using
> is the Rigid3DVersorTransform, and the lines of code I'm using to set the
> inverse are:
>
>
>
> newTransform->SetCenter(oldTransform->GetCenter());
>
> oldTransform->GetInverse(newTransform);
>
>
>
> Any idea why translation would work but rotation causes a problem?
>
>
> --
>
> AH
>
>
>
> Andrew Harris, Honours BSc (Medical Physics)
>
> PhD (CAMPEP) & MClSc Candidate
>
> ------------------------------------------------------------
> -----------------------------------
>
> *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, Jun 28, 2017 at 4:50 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <
> zivrafael.yaniv at nih.gov> wrote:
>
> Hello Andrew,
>
>
>
> In ITK the result of a registration maps points from the fixed image
> coordinate system to the moving coordinate system, so T(p_f) = p_m and the
> TRE is || T(p_f) – p_m||. I suspect you just need to use the inverse
> transform.
>
>
>
> You may be interested in this SimpleITK notebook (http://
> insightsoftwareconsortium.github.io/SimpleITK-Notebooks/
> Python_html/67_Registration_Semiautomatic_Homework.html) which has a
> linked cursor GUI (gui. RegistrationPointDataAquisition). The source code
> for the UI is here: https://github.com/InsightSoftwareConsortium/
> SimpleITK-Notebooks/blob/master/Python/gui.py .
>
>
>
> hope this helps
>
> Ziv
>
>
>
>
>
>
>
>
>
> *From: *Andrew Harris <aharr8 at uwo.ca>
> *Date: *Wednesday, June 28, 2017 at 3:14 PM
> *To: *Insight-users <insight-users at itk.org>
> *Subject: *[ITK-users] [ITK] applying a transform to an ITK Point object
> results in it moving the opposite direction from the image
>
>
>
> Hi there,
>
> I have been trying for a while to get this working: I want to be able to
> select corresponding points in a fixed and moving image, and determine how
> well the moving image is transformed to overlay the fixed image by using
> target registration error. The problem is, using the same transform I
> applied to a moving image that translated it to the left, the point
> selected in the moving image gets translated to the right for example.
>
> --
>
> AH
>
>
>
> Andrew Harris, Honours BSc (Medical Physics)
>
> PhD (CAMPEP) & MClSc Candidate
>
> ------------------------------------------------------------
> -----------------------------------
>
> *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.*
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170705/ab89c39a/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