@@ -0,0 +1,1187 @@
+import vtk%0Aimport numpy as np%0Afrom vtk.util.numpy_support import vtk_to_numpy%0Afrom vtk.numpy_interface import dataset_adapter as dsa%0A%0Ainputfilename = %22/src/data/paris/558/skin95.stl%22%0Aoutputfilename = %22/out/skin95out.stl%22%0A%0A########%0A# READ #%0A########%0A%0Areader = vtk.vtkSTLReader()%0Areader.SetFileName(inputfilename)%0Areader.Update()%0A%0Apolydata = vtk.vtkPolyData()%0Apolydata = reader.GetOutput() #type vtkPolyData%0Apoints = polydata.GetPoints()%0A%0A%22%22%22%0ANOTE: normals, vectors or scalars cannot be retrieved from the polydata object if this is not available in the file%0Athat has been loaded by the reader. Typically, this will require applying some filters to calculate that data (especially%0Anormals). So for now, we only know the locations (x,y,z) and the connectivity.%0A%22%22%22%0A#pointdata = polydata.GetPointData() #type vtkPointData%0A#vectors = pointdata.GetVectors() #type vtkDataArray%0A#normals = pointdata.GetNormals() #type vtkDataArray%0A%0A%0A################%0A# VTK TO NUMPY #%0A################%0Acoordinates = points.GetData()%0AcoordinatesPy = vtk_to_numpy(coordinates)%0A%0Aprint(coordinatesPy.ndim)%0Aprint(coordinatesPy.shape)%0Aprint(coordinatesPy.size)%0Aprint(coordinatesPy.dtype)%0Aprint(coordinatesPy.itemsize)%0A

load .stl file with VTK and convert to numpy arrays