# Possible Bug When Using ProgrammableSource with vtkImageData

**URL:** https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249
**Category:** ParaView Support
**Tags:** python, vtk
**Created:** [May 4, 2020, 6:53pm UTC](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249 "2020-05-04T18:53:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rafaelmarch3](https://discourse.paraview.org/user_avatar/discourse.paraview.org/rafaelmarch3/32/3668_2.png) [@rafaelmarch3](https://discourse.paraview.org/u/rafaelmarch3)
#### Post date: [May 4, 2020, 6:53pm UTC](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249/1 "2020-05-04T18:53:56Z")

</div>

I’m using ParaView 5.8.0 installed though Miniconda with Python 3.7.

I have a very simple “Programmable source” to create an Image as an output:

imout = self.GetOutput()  
imout.SetDimensions(10, 5, 3)  
imout.SetOrigin(0,0,0)  
imout.SetSpacing(2, 1, 1)

This was working perfectly fine one hour ago, showing the 3D image. I don’t know what happened, that now it doesn’t render the image anymore. I have tried to restart the computer and Paraview. Any clues?

Thanks a lot!

Rafael.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [May 4, 2020, 8:26pm UTC](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249/2 "2020-05-04T20:26:48Z")

</div>

Welcome to ParaView, @rafaelmarch3!

When generating and image, you will also need to supply a script for the RequestInformation phase of the pipeline update. For this case, the following code should work:

```python
from paraview import util
util.SetOutputWholeExtent(self, [0,9,0,4,0,2])

```

Note that the extent here corresponds to the image dimensions (10, 5, 3). The first two elements are the valid index values of a voxel in the x direction, the second two for y, and the last two for z.

---

<div class="post-metadata">

### Author: ![rafaelmarch3](https://discourse.paraview.org/user_avatar/discourse.paraview.org/rafaelmarch3/32/3668_2.png) [@rafaelmarch3](https://discourse.paraview.org/u/rafaelmarch3)
#### Post date: [May 4, 2020, 11:45pm UTC](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249/3 "2020-05-04T23:45:36Z")

</div>

Thanks for that Cory. It works now. In my case I had to add also the following line to set the spacing:

executive = self.GetExecutive()  
outInfo = executive.GetOutputInformation(0)  
outInfo.Set(executive.WHOLE\_EXTENT(), 0, im.nx-1, 0, im.ny-1, 0, im.nz-1)  
**outInfo.Set(vtk.vtkDataObject.SPACING(), im.dx, im.dy, im.dz)**

---

<div class="post-metadata">

### Author: ![rafaelmarch3](https://discourse.paraview.org/user_avatar/discourse.paraview.org/rafaelmarch3/32/3668_2.png) [@rafaelmarch3](https://discourse.paraview.org/u/rafaelmarch3)
#### Post date: [May 5, 2020, 12:19pm UTC](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249/4 "2020-05-05T12:19:52Z")

</div>

Thanks!
