# read and render transformed DICOM image from 3D slicer

**URL:** https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291
**Category:** Beginner Questions
**Tags:** python
**Created:** [October 1, 2019, 8:04am UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291 "2019-10-01T08:04:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![TY\_Park](https://discourse.itk.org/user_avatar/discourse.itk.org/ty_park/32/1014_2.png) [@TY\_Park](https://discourse.itk.org/u/TY_Park)
#### Post date: [October 1, 2019, 8:04am UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/1 "2019-10-01T08:04:48Z")

</div>

I have the 2 DICOM images (MRI and CT)  
And I performed rigid registration between MRI and CT (the CT was transformed) in “3D Slicer”

Then I would like to do volume rendering use transformed CT image  
However, the transformation did not work properly

This is my code,

> ```
> image_t = itk.Image[itk.F, 3]
> reader = itk.ImageSeriesReader[image_t].New()
> dicomIO = itk.GDCMImageIO.New()
> dicomFN = itk.GDCMSeriesFileNames.New()
> reader.SetImageIO(dicomIO)
> 
> dicomFN.SetUseSeriesDetails(True)
> dicomFN.SetDirectory(filename)
> 
> uids = dicomFN.GetSeriesUIDs()
> frames = dicomFN.GetFileNames(uids[0])
> 
> reader.SetFileNames(frames)
> reader.Update()
> image = reader.GetOutput()
> 
> orienter = itk.OrientImageFilter[image_t, image_t].New()
> orienter.UseImageDirectionOn()
> orienter.SetInput(image)
> orienter.Update()
> 
> itk_vtk_converter = itk.ImageToVTKImageFilter[image_t].New()
> itk_vtk_converter.SetInput(orienter.GetOutput())
> itk_vtk_converter.Update()
> 
> vtk_image = vtk.vtkImageData()
> vtk_image.DeepCopy(itk_vtk_converter.GetOutput())
> 
> ```

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 1, 2019, 5:04pm UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/2 "2019-10-01T17:04:03Z")

</div>

Perhaps you need to choose “harden transform” in Slicer before you save your transformed CT image?

> transformation did not work properly

Can you be more specific? Transform was not applied? Transform is wrong?

---

<div class="post-metadata">

### Author: ![TY\_Park](https://discourse.itk.org/user_avatar/discourse.itk.org/ty_park/32/1014_2.png) [@TY\_Park](https://discourse.itk.org/u/TY_Park)
#### Post date: [October 2, 2019, 10:10am UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/3 "2019-10-02T10:10:06Z")

</div>

If I don’t use the “orientaer.UseImageDirectionOn” the transformation was not applied.  
then if I use the “orientaer.UseImageDirectionOn” the transformation is wrong.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [October 2, 2019, 1:10pm UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/4 "2019-10-02T13:10:33Z")

</div>

VTK does not currently support oriented images, but support has been added for the next release of VTK [as discussed here](https://discourse.vtk.org/t/proposal-to-add-orientation-to-vtkimagedata-feedback-wanted/120).

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 2, 2019, 2:00pm UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/5 "2019-10-02T14:00:57Z")

</div>

Maybe you will find [this](https://vtk.org/Wiki/VTK/ExamplesBoneYard/Cxx/VolumeRendering/itkVtkImageConvert) and [this](https://vtk.org/Wiki/index.php?title=ITK/Examples/WishList/IO/itkVtkImageConvertDICOM&oldid=51003) example useful.

---

<div class="post-metadata">

### Author: ![TY\_Park](https://discourse.itk.org/user_avatar/discourse.itk.org/ty_park/32/1014_2.png) [@TY\_Park](https://discourse.itk.org/u/TY_Park)
#### Post date: [October 4, 2019, 2:19am UTC](https://discourse.itk.org/t/read-and-render-transformed-dicom-image-from-3d-slicer/2291/6 "2019-10-04T02:19:24Z")

</div>

I solved this problem using dzenanz’s example

Thanks a lot !
