# On the coordinate transformation of vtk and itk

**URL:** <https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810>\
**Category:** Development\
**Created:** [February 26, 2023, 9:59am UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810 "2023-02-26T09:59:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [February 26, 2023, 9:59am UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/1 "2023-02-26T09:59:21Z")

</div>

The program I wrote uses itk image to read dicom image, and uses vtk to display it. What transformation should I make to make vtk display correctly? I know to use 0020 0037 tag to correct it. Can anyone tell me the detailed method?

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [February 28, 2023, 12:57pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/2 "2023-02-28T12:57:49Z")

</div>

Hello,

Let’s start with you describing in more detaul what are you getting and what you need to get. Then we can discuss what can be done to fix it.

regards,

Paulo

---

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [February 28, 2023, 1:01pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/3 "2023-02-28T13:01:24Z")

</div>

Hello, I read the dicom image through itk and convert it to vtk for display. I register the itk image and convert the registration result to vtktransform, and then use vtkcheckbordimage to display the registered image. This process involves too many coordinate conversion. I don’t know how to do it correctly.

---

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [February 28, 2023, 1:04pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/4 "2023-02-28T13:04:53Z")

</div>

I want to know the correct conversion method from itk image to vtk image, and the correct conversion method from registration result itktransform to vtktransform

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [February 28, 2023, 1:25pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/5 "2023-02-28T13:25:46Z")

</div>

Are you getting wrong results?

---

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [February 28, 2023, 1:28pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/6 "2023-02-28T13:28:29Z")

</div>

Due to the small amount of test data, I tested translateTransform, which is correct, but I am very worried about the rotation

---

<div class="post-metadata">

**Author:** ![marlon.ma](https://discourse.vtk.org/user_avatar/discourse.vtk.org/marlon.ma/32/6091_2.png) [@marlon.ma](https://discourse.vtk.org/u/marlon.ma)\
**Post date:** [February 28, 2023, 1:30pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/7 "2023-02-28T13:30:59Z")

</div>

I read the source code of slicer, and found that the coordinate conversion in it is relatively complex, and I didn’t understand it. At present, my program, from itktransform to vtktransform, only needs to map the mobile part, but slicer has made complex transformation, so I doubt the correctness of my program

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [February 28, 2023, 2:41pm UTC](https://discourse.vtk.org/t/on-the-coordinate-transformation-of-vtk-and-itk/10810/8 "2023-02-28T14:41:02Z")

</div>

If you cast doubt on the correctness of ITK or VTK or both you first have to design a test case and observe the results. Then, if you find unexpected results, you share them here and we can start a discussion. The “It’s complex, I don’t understand it, therefore it’s likely wrong” argument alone is not enough to objectively conduct an investigation.
