tet_isos_slice.py 560 B

1234567891011121314151617181920
  1. # Thresholding and slicing a TetMesh
  2. from vedo import TetMesh, dataurl, show
  3. tmsh = TetMesh(dataurl+'limb.vtu')
  4. tmsh.celldata.select('chem_0').cmap('hot')
  5. tmsh.add_scalarbar3d('chem_0 expression', c='k')
  6. vals = [0.2, 0.3, 0.8]
  7. tmsh.map_cells_to_points(["chem_0"])
  8. isos = tmsh.pointdata.select("chem_0").isosurface(vals).flat()
  9. slce = tmsh.slice(normal=(1,1,1)).lighting("off").lw(1)
  10. print(tmsh)
  11. show([
  12. (tmsh, "A TetMesh"),
  13. (isos, "Isosurfaces for values:\n"+str(vals)),
  14. (slce, "Slice TetMesh with plane"),
  15. ], N=3, axes=1).close()