# Problem with Plugin Source with vtkImageData

**URL:** https://discourse.paraview.org/t/problem-with-plugin-source-with-vtkimagedata/4258
**Category:** ParaView Support
**Created:** [May 5, 2020, 12:24pm UTC](https://discourse.paraview.org/t/problem-with-plugin-source-with-vtkimagedata/4258 "2020-05-05T12:24:56Z")
**Posts on this page:** 2
**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 5, 2020, 12:24pm UTC](https://discourse.paraview.org/t/problem-with-plugin-source-with-vtkimagedata/4258/1 "2020-05-05T12:24:56Z")

</div>

This is a follow-up question to the one below:

> [@Possible Bug When Using ProgrammableSource with vtkImageData](https://discourse.paraview.org/t/possible-bug-when-using-programmablesource-with-vtkimagedata/4249):
>
> 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.

I managed to create a vtkImageData in a Programmable Source.

Now I would like to pack this image creating in a Source plugin, as an alternative. So far, my RequestData method inside the MySource class (which extends VTKPythonAlgorithmBase) looks like:

```auto
def RequestData(self, request, inInfo, outInfo):

        output = vtkImageData.GetData(outInfo, 0)
        im = my_vtk_image

        # Setting image properties
        output.SetDimensions(im.nx, im.ny, im.nz)
        output.SetOrigin(0,0,0)
        output.SetSpacing(im.dx, im.dy, im.dz)
        
        # This is necessary to update the output information
        executive = self.GetExecutive()
        outInfo0 = outInfo.GetInformationObject(0)
        outInfo0.Set(executive.WHOLE_EXTENT(), 0, im.nx-1, 0, im.ny-1, 0, im.nz-1)
        outInfo0.Set(vtk.vtkDataObject.SPACING(), im.dx, im.dy, im.dz)
        
        return 1

```

I manage to load this plugin but it doesn’t render the image in ParaView. The behaviour is similar to the one if I don’t set the extent of the image using the “executive”. Any clues on what might be going wrong? How to set the extent and spacing of the image when loading from a plugin source?

PS: How do I write block code here in the questions? Couldn’t find out.

---

<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 5, 2020, 2:19pm UTC](https://discourse.paraview.org/t/problem-with-plugin-source-with-vtkimagedata/4258/2 "2020-05-05T14:19:11Z")

</div>

Block code sections can be started with three backticks ``` on one line, the code, then three backticks on the last line.

As for your question, insert the method declaration

` def RequestInformation(self, request, inInfoVec, outInfoVec):`

before the code `# This is necessary to update the output information`

It needs to be defined in this other method so that it is called when the information is needed. That’s what the **Programmable Source** is doing under the covers when you define an Information sript.
