# Transfer from SimpleITK to VTK

**URL:** https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729
**Category:** Beginner Questions
**Created:** [February 16, 2020, 6:06pm UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729 "2020-02-16T18:06:29Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)
#### Post date: [February 16, 2020, 6:06pm UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729/1 "2020-02-16T18:06:29Z")

</div>

I guess I have transferred _vtkImageData to SimpleITK_ object with code from here: [Transfer from VTK to SimpleITK](https://discourse.itk.org/t/transfer-from-vtk-to-simpleitk/2717/11)

After I imported data into a **sitk::Image** in order apply some filter. Now, after this filter has been applied I intend to transfer data back to VTK _vtkImageData_ object in order to render it. This procedure I didn’t found it nowhere. From what I saw by now, that **sitk::Image** can be saved on disk … but seem to be less efficient than to transfer data inside my application …

Is there possible _to transfer my SimpleITK data into a vtkImageData_ ? If it is, can you tell me how ?

Thank you.

---

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)
#### Post date: [February 17, 2020, 10:58am UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729/2 "2020-02-17T10:58:31Z")

</div>

I have found here a little example: [https://vtk.org/Wiki/VTK/ExamplesBoneYard/Cxx/VolumeRendering/itkVtkImageConvert](https://vtk.org/Wiki/VTK/ExamplesBoneYard/Cxx/VolumeRendering/itkVtkImageConvert)

I hope I can use it in my case. I will come back here with feedback for the ones who have the same question.

---

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)
#### Post date: [February 17, 2020, 1:05pm UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729/3 "2020-02-17T13:05:13Z")

</div>

Is there any method to transfer data from SimpleITK to VTK ? Because I have tried to use:

```
#include <itkImageFileReader.h>
#include "itkImageToVTKImageFilter.h"

```

(from example above)  
but is not recognized. I guess I have to include ITK too in my project … but I am sure that SimpleITK know this transfer … I don’t know myself how …

---

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.itk.org/u/flaviu2)
#### Post date: [February 18, 2020, 6:16pm UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729/4 "2020-02-18T18:16:53Z")

</div>

I have prepared everything for segmentation, I only need this transfer, from SimpleITK (sitk::Image) to VTK (vtkImageImport) …

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [February 18, 2020, 6:25pm UTC](https://discourse.itk.org/t/transfer-from-simpleitk-to-vtk/2729/5 "2020-02-18T18:25:17Z")

</div>

You seem to have the right idea with using `vtkImportImage`. You can copy the meta-data over and then use the `sitk:Image::GetBufferAs...` method. Should be pretty straight forward.
