[Paraview] Visualising image data

David E DeMarle dave.demarle at kitware.com
Thu Jan 22 11:45:36 EST 2015


Announce the whole extent in the RequestInformation script section.
That should do the trick.



David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Thu, Jan 22, 2015 at 11:17 AM, Bruce Jones <bruce.david.jones at gmail.com>
wrote:

> Hi all,
>
> I'm working on a programmable filter that needs to produce a vtkImageData
> object. So far it appears to work, inspection of the properties panel shows
> the object has the correct number of points/cells and the data array
> contains the correct data. However I cannot get a visualisation with any of
> the representations (surface, outline, wireframe etc). Curiously, if i set
> the display to my data array then the color bar appears with the correct
> values, but still not visualization.
>
> I am using the following code to produce the image data object.
>
> from vtk import *
>
> output = self.GetOutputDataObject(0);
>
> # Create a VTK Grid
> grid = vtkImageData()
> grid.SetOrigin(0, 0, 0) # default values
> dx=10;
> grid.SetSpacing(dx, dx, dx)
> grid.SetDimensions(5, 8, 10) # number of points in each direction
> # print grid.GetNumberOfPoints()
> # print grid.GetNumberOfCells()
> array = vtkDoubleArray()
> array.SetNumberOfComponents(1) # this is 3 for a vector
> array.SetNumberOfTuples(grid.GetNumberOfPoints())
> for i in range(grid.GetNumberOfPoints()):
>     if i < 200:
>         array.SetValue(i, 1)
>     else:
>         array.SetValue(i, 2)
>
> grid.GetPointData().AddArray(array)
> # print grid.GetPointData().GetNumberOfArrays()
> array.SetName("unit array")
> output.ShallowCopy(grid);
>
> Cheers,
> Bruce
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150122/a9684681/attachment.html>


More information about the ParaView mailing list