[vtkusers] Unintuitive use of vtkStructuredPointsWriter/vtkFloatArray
Jeff Baumes
jeff.baumes at kitware.com
Tue Oct 6 12:30:44 EDT 2009
The size of the arrays in point data should match the number of points
in the data set. You do not have any points in your dataset, so no
point data will be written. You need to add points to the
vtkStructuredPoints.
Jeff
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
>
--
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4932
jeff.baumes at kitware.com
More information about the vtkusers
mailing list