![]() ![]() After all modifications has been completed, call :py:meth:`arrayFromModelPointsModified`.Point coordinates can be modified by modifying the numpy array."""Return point positions of a model node as numpy array.You can get read-write access as numpy array to point coordinates like this: Slicer/Slicer/blob/0abd1fa219628f0dfd5166e430afeb1598b6fcf8/Base/Python/slicer/util.py#L976-L988 This way, arrays created in VTK are owned by VTK and arrays created by numpy are owned by numpy objects, so we don’t need to worry about reallocation or deleting these arrays. We usually create a VTK array that has the appropriate size, get read-write access to it using vtk_to_numpy, then copy values from numpy array (element-wise, using a=b syntax). What is the correct and most efficient way to do this ? # build points & polydata from dataset_adapterĭunno which way is the correct one … but the dataset_adapter way comes with more problems: print(f"There are points.")ĪttributeError: 'numpy.ndarray' object has no attribute 'GetNumberOfPoints'Īnyway I want to just build the cells list from these vertices ![]() # build points & polydata from numpy_to_vtk I did manage to convert Numpy array of coordinates to VTK Points, PointSet or even PolyData (yeah, working with python sorry) import numpy as npįrom _support import numpy_to_vtk, vtk_to_numpyįrom vtk.numpy_interface import dataset_adapter as dsa list of vertices/points defining the geometric primitives): (pt1,pt2,pt3) for triangles I understand the concept of mesh (and polydata) as a tuple of : Quite new to vtk and meshing in general (got a raster processing background).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |