# DICOM with vtkImageViewer2()

**URL:** https://discourse.vtk.org/t/dicom-with-vtkimageviewer2/7140
**Category:** Support
**Created:** [November 10, 2021, 3:50pm UTC](https://discourse.vtk.org/t/dicom-with-vtkimageviewer2/7140 "2021-11-10T15:50:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [November 10, 2021, 3:50pm UTC](https://discourse.vtk.org/t/dicom-with-vtkimageviewer2/7140/1 "2021-11-10T15:50:58Z")

</div>

I have questions regarding DICOM visualisation orientation in vtkImageViewer2().

Just before I start, I read some other posts and I looked at the these websites:

[https://www.slicer.org/wiki/Coordinate\_systems](https://www.slicer.org/wiki/Coordinate_systems)

[https://dicom.innolitics.com/ciods/ct-image/general-series/00185100](https://dicom.innolitics.com/ciods/ct-image/general-series/00185100)

[http://www.grahamwideman.com/gw/brain/orientation/orientterms.htm](http://www.grahamwideman.com/gw/brain/orientation/orientterms.htm)

[https://nipy.org/nibabel/dicom/dicom\_orientation.html](https://nipy.org/nibabel/dicom/dicom_orientation.html)

What I would like to do is to have value of a pixel. I make an event which picks up the coordinates however the values of pixels are not correct.

I created the matrix zyx and then. I use vtk.vtkImageData() and numpy\_support.numpy\_to\_vtk then I pass to the vtkImageViewer2()

First I have problem with proper orientation. I wanted to apply affine matrix however I think it does not work with vtkImageViewer2() or I am wrong?

However, from technical point of view should I apply the transformation matrices directly on the numpy matrix or there are better techniques to do so?

Thx.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [November 10, 2021, 4:42pm UTC](https://discourse.vtk.org/t/dicom-with-vtkimageviewer2/7140/2 "2021-11-10T16:42:32Z")

</div>

I’d advise against using vtkImageViewer2 for this purpose, since it was designed to be a quick-and-dirty way to view images and it really doesn’t provide the kind of flexibility that’s needed for medical image visualization.

I prefer viewing images directly in a vtkRenderWindow and use the actor/mapper/camera to control the view. In other words, rather than transform the image, I tell VTK what slice orientation to use for the view (obliques are possible with vtkImageResliceMapper). An example of this approach is the [NIFTI test in the VTK source tree](https://gitlab.kitware.com/vtk/vtk/-/blob/0a0a1a4fc3f220aa4214ca44a582dcc740afb9e2/IO/Image/Testing/Python/TestNIFTIReaderWriter.py) (must be run on the command line with “`-I`” to enable the interactor).

---

<div class="post-metadata">

### Author: ![Kamil](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/94ad74/32.png) [@Kamil](https://discourse.vtk.org/u/Kamil)
#### Post date: [November 10, 2021, 7:37pm UTC](https://discourse.vtk.org/t/dicom-with-vtkimageviewer2/7140/3 "2021-11-10T19:37:22Z")

</div>

Thanks again David for your response. You are really a compendium of useful information 🙂
