slice_plane2.py 714 B

12345678910111213141516171819202122
  1. """Slice a Volume with multiple planes
  2. Make low values of the scalar completely transparent"""
  3. from vedo import *
  4. vol = Volume(dataurl+'embryo.slc')
  5. vol.cmap('bone').alpha([0,0,0.5])
  6. slices = []
  7. for i in range(4):
  8. sl = vol.slice_plane(origin=[150,150,i*50+50], normal=(0,-1,1))
  9. slices.append(sl)
  10. amap = [0, 1, 1, 1, 1] # hide low value points giving them alpha 0
  11. mslices = merge(slices) # merge all slices into a single Mesh
  12. mslices.cmap('hot_r', alpha=amap).lighting('off')
  13. # Add a 3d scalarbar to the scene
  14. mslices.add_scalarbar3d()
  15. # make 2d copy of it and move it to the center-right
  16. mslices.scalarbar = mslices.scalarbar.clone2d("center-right", 0.15)
  17. show(vol, mslices, __doc__, axes=1).close()