[ITK-users] [ITK] applying a transform to an ITK Point object results in it moving the opposite direction from the image

Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] zivrafael.yaniv at nih.gov
Thu Jun 29 15:04:59 EDT 2017


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 –Ac – 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<mailto: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<mailto:aharr8 at uwo.ca>>
Date: Wednesday, June 28, 2017 at 3:14 PM
To: Insight-users <insight-users at itk.org<mailto: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/insight-users/attachments/20170629/48ec717d/attachment.html>


More information about the Insight-users mailing list