# itk.ImageToVTKImageFilter crashing Python

**URL:** https://discourse.itk.org/t/itk-imagetovtkimagefilter-crashing-python/2018
**Category:** Algorithms
**Tags:** python
**Created:** [July 9, 2019, 2:03am UTC](https://discourse.itk.org/t/itk-imagetovtkimagefilter-crashing-python/2018 "2019-07-09T02:03:50Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Phong\_Tran](https://discourse.itk.org/user_avatar/discourse.itk.org/phong_tran/32/1024_2.png) [@Phong\_Tran](https://discourse.itk.org/u/Phong_Tran)
#### Post date: [October 8, 2019, 6:57am UTC](https://discourse.itk.org/t/itk-imagetovtkimagefilter-crashing-python/2018/5 "2019-10-08T06:57:49Z")

</div>

Hi Matt,  
I use the latest itk-vtkglue using this : python -m pip install itk-vtkglue on Ubuntu 18, but when I tried to run the example it coredumped. This is the code sample:  
import itk  
import sys

if len(sys.argv) != 2:  
print('Usage: ’ + sys.argv[0] + ’ ')  
sys.exit(1)  
imageFileName = sys.argv[1]

Dimension = 2  
PixelType = itk.UC  
ImageType = itk.Image[PixelType, Dimension]

reader = itk.ImageFileReader[ImageType].New()  
reader.SetFileName(imageFileName)

itkToVtkFilter = itk.ImageToVTKImageFilter[ImageType].New()  
itkToVtkFilter.SetInput(reader.GetOutput())

itkToVtkFilter.Update()  
myvtkImageData = itkToVtkFilter.GetOutput()  
print(myvtkImageData)

When running it:  
╭─phongtd@nguyenth ~/tmp/itk-vtk-glue/build  
╰─$ python …/itk2vtk.py ./out.nrrd 1 ↵  
[1] 16358 segmentation fault (core dumped) python …/itk2vtk.py ./out.nrrd

Any suggestion ?

---

_[View the full topic](https://discourse.itk.org/t/itk-imagetovtkimagefilter-crashing-python/2018)._
