code: def _load_file(self, filename):
          
          filename = os.path.abspath(os.path.expanduser(filename))
          # test if file exists
          if not os.path.isfile(filename):
              raise Exception('File %s does not exist' % filename)
  
          # Get extension
          ext = vtki.get_ext(filename)
  
          # Select reader
          if ext == '.ply':
              reader = vtk.vtkPLYReader()
          elif ext == '.stl':
              reader = vtk.vtkSTLReader()
          elif ext == '.vtk':
              reader = vtk.vtkPolyDataReader()
          elif ext == '.vtp':
              reader = vtk.vtkXMLPolyDataReader()
          elif ext == '.obj':
              reader = vtk.vtkOBJReader()
          else:
              raise TypeError('Filetype must be either "ply", "stl", "vtk", "vtp", or "obj".')
  
          # Load file
          reader.SetFileName(filename)
          reader.Update()
          self.ShallowCopy(reader.GetOutput())
  
          # sanity check
          if not np.any(self.points):
              raise AssertionError('Empty or invalid file')
docs: Load a surface mesh from a mesh file.
  
          Mesh file may be an ASCII or binary ply, stl, or vtk mesh file.
  
          Parameters
          ----------
          filename : str
              Filename of mesh to be loaded.  File type is inferred from the
              extension of the filename
  
          Notes
          -----
          Binary files load much faster than ASCII.