Re: [Paraview] vtk.vtkPoints.SetData()

2015-04-29 Thread Magician
Hi Christophe,

Thanks.
column_stack() works correctly.


Magician


 On Apr 29, 2015, at 01:00, paraview-requ...@paraview.org wrote:
 
 Message: 1
 Date: Mon, 27 Apr 2015 20:22:41 +0200
 From: Christophe Bourcier christophe.bourcier...@gmail.com
 To: f_magic...@mac.com
 Cc: paraview@paraview.org
 Subject: [Paraview]  vtk.vtkPoints.SetData()
 Message-ID:
   caktnqfkbsjde+bw5kakjmnrgbdqnxmgvcxe5h_bsprcnh+9...@mail.gmail.com
 Content-Type: text/plain; charset=utf-8
 
 Hi Magician,
 
 Since Paraview 4.2, you have to use column_stack instead of hstack to
 create a multi-component field. See this thread
 http://public.kitware.com/pipermail/paraview/2015-April/033756.html
 
 Christophe
___
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


[Paraview] vtk.vtkPoints.SetData()

2015-04-27 Thread Magician
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
___
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


[Paraview] vtk.vtkPoints.SetData()

2015-04-27 Thread Christophe Bourcier
Hi Magician,

Since Paraview 4.2, you have to use column_stack instead of hstack to
create a multi-component field. See this thread
http://public.kitware.com/pipermail/paraview/2015-April/033756.html

Christophe
___
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