# Why the origin of vtkImageData is zero?

**URL:** https://discourse.vtk.org/t/why-the-origin-of-vtkimagedata-is-zero/4974
**Category:** Support
**Created:** [January 10, 2021, 2:29am UTC](https://discourse.vtk.org/t/why-the-origin-of-vtkimagedata-is-zero/4974 "2021-01-10T02:29:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [January 10, 2021, 2:29am UTC](https://discourse.vtk.org/t/why-the-origin-of-vtkimagedata-is-zero/4974/1 "2021-01-10T02:29:05Z")

</div>

I find a stranger thing. I read a dicom file with `vtkDICOMImageReader`, and then obtain the origin point. My code is:

```auto
img2 = vtk.vtkDICOMImageReader()
img2.SetFileName('xxx')
img2.Update()
image2 = img2.GetOutput()
print('img2: ', image2.GetOrigin())

```

The result is `(0, 0, 0)`, but the image position (0020, 0032) is not `(0, 0, 0)`.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/f/f6e93157310a3c18d79b8745611f7b64274a77ac.png)

1. I wonder whether the `vtkDICOMImageReader.GetOutput.GetOrigin` always return `(0, 0, 0)`?

2. In vtk 9.0.1 (python), the `vtkDICOMImageReader.GetOutput.GetDirectionMatrix` return a identify matrix even the Image Orientation (0020, 0037) is not a identfiy matrix.

3. I guess that the reason why `vtkDICOMImageReader.GetOutput.GetOrigin` return `(0, 0, 0)` and `vtkDICOMImageReader.GetOutput.GetDirectionMatrix` return a identify matrix is that the `vtkImageData` has its own coordinate system, and for this coordinate system, the origin is (0, 0, 0) and the orientation matrix is a identify matrix. Am I right?

4. If I want to make the coordiante system of `vtkImageData` to be the world coordinate system, I need to adjust the origin point of `vtkDICOMImageReader.GetOutput` to Image Position (0020,0032), and the orientation of `vtkDICOMImageReader.GetOutput` to Image Orientation (0020, 0037) by `SetDirectionMatrix`. Am I right?

Thank you for your suggestion!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 11, 2021, 5:18pm UTC](https://discourse.vtk.org/t/why-the-origin-of-vtkimagedata-is-zero/4974/2 "2021-01-11T17:18:57Z")

</div>

The DICOM image reader in VTK has many issues. I would recommend to use [vtk-dicom package](https://github.com/dgobbi/vtk-dicom/) instead.

I think the plan is to replace VTK’s current DICOM image reader by vtk-dicom anyway, so by switching to vtk-dicom now you can avoid changes in your code later.

Note that while vtk-dicom is very good quality image reader/writer, it cannot read/write other essential DICOM information objects, such as segmentations, structured reports. Therefore, for implementing real-world clinical applications you often need to use higher-level VTK-based application frameworks, such as 3D Slicer or MITK, which can handle many more data types.

---

<div class="post-metadata">

### Author: ![dr\_ppetrov](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dr_ppetrov/32/2121_2.png) [@dr\_ppetrov](https://discourse.vtk.org/u/dr_ppetrov)
#### Post date: [January 13, 2021, 1:57pm UTC](https://discourse.vtk.org/t/why-the-origin-of-vtkimagedata-is-zero/4974/3 "2021-01-13T13:57:10Z")

</div>

I suggest you use gdcm. Enable the vtk integration when building it. Then you have proper vtk style readers. I only use the current vtk dicom reader for pure image visualization (.e.g. preview window), while gdcm in case I need complete space information (world space).
