[Paraview] vtk.vtkPoints.SetData()

Magician f_magician at mac.com
Mon Apr 27 08:36:51 EDT 2015


Hi all,


I’m going to generate pointclouds from CSV with Programmable Filter.


On ParaView 4.1 or older, the script works:

    from paraview.vtk.dataset_adapter import numpyTovtkDataArray as da
    from paraview.vtk.dataset_adapter import vtkDataArrayToVTKArray as va

    pdi = self.GetInput()

    X = va(pdi.GetRowData().GetArray('x'))
    Y = va(pdi.GetRowData().GetArray('y'))
    Z = va(pdi.GetRowData().GetArray('z'))

    pts = vtk.vtkPoints()
    pts.SetData(da(hstack((X, Y, Z)), 'Points’))


But on 4.2 or newer, the script isn’t work:

    from paraview.vtk.numpy_interface.dataset_adapter import numpyTovtkDataArray as da
    from paraview.vtk.numpy_interface.dataset_adapter import vtkDataArrayToVTKArray as va

    pdi = self.GetInput()

    X = va(pdi.GetRowData().GetArray('x'))
    Y = va(pdi.GetRowData().GetArray('y'))
    Z = va(pdi.GetRowData().GetArray('z'))

    pts = vtk.vtkPoints()
    pts.SetData(da(hstack((X, Y, Z)), 'Points’))


The error message is as follows:

    ERROR: In /Users/kitware/Dashboards/MyTests/NightlyMaster/ParaViewSuperbuild-Release/paraview/src/paraview/VTK/Common/Core/vtkPoints.cxx, line 193
    vtkPoints (0x1199f3a60): Number of components is different...can't set data


How can I use SetData() method on latest ParaView?


Magician


More information about the ParaView mailing list