probe_points.py 548 B

1234567891011121314151617
  1. """Probe a voxel dataset at specified points
  2. and plot a histogram of the values"""
  3. from vedo import np, dataurl, Points, Volume, Axes, show
  4. from vedo.pyplot import histogram
  5. vol = Volume(dataurl + 'embryo.slc')
  6. vol_axes = Axes(vol)
  7. pts = np.random.rand(5000, 3)*256
  8. mpts = Points(pts).probe(vol).point_size(3)
  9. mpts.print()
  10. # valid = mpts.pointdata['ValidPointMask']
  11. scalars = mpts.pointdata['SLCImage']
  12. his = histogram(scalars, xtitle='Probed voxel value', xlim=(5,100))
  13. show([(vol, vol_axes, mpts, __doc__), his], N=2, sharecam=False).close()