[vtkusers] Unintuitive use of vtkStructuredPointsWriter/vtkFloatArray

Bill Lorensen bill.lorensen at gmail.com
Tue Oct 6 12:47:31 EDT 2009


You need to set the dimensions of the structured points.

sp.SetDimensions(50,1,1)

On Tue, Oct 6, 2009 at 12:09 PM, Ganesh Swami <ganesh at iamganesh.com> wrote:
> Hi,
>
> I'm trying to write a bunch of rank-2 tensors to a VTK file, and I can't
> figure out why my output file is empty. I turned debugging on and it prints
> out that the StructuredPointsWriter's input has no PointData. When I print
> the writer object or the result of writer.GetInput(), it shows me the tensor
> data as expected. I'm using the latest stable version of VTK 5.4.2.
>
> import vtk
>
> f = vtk.vtkFloatArray()
> f.SetNumberOfComponents(9)
>
> for i in range(50):
>  b = [x*1.0 for x in range(9)]
>  f.InsertTuple9(i, *b)
>
>
> sp=vtk.vtkStructuredPoints()
> sp.GetPointData().SetTensors(f)
> sp.Update()
>
> writer = vtk.vtkStructuredPointsWriter()
> writer.SetFileName('foo.vtk')
> writer.SetInput(sp)
> writer.Write()
>
> Any help is greatly appreciated!
>
> Thanks,
> Ganesh
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list