Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 07:49:23

0001 #!/usr/bin/env python
0002 """
0003 vtkbboxplt.py
0004 ==============
0005 
0006 This requires vtk and pyvista. 
0007 
0008 Use an ipython which has those by for example::
0009 
0010    ~/miniconda3/bin/ipython ~/opticks/ana/vtkbboxplt.py
0011 
0012 OR enable that in ~/.bash_profile with::
0013 
0014   source $HOME/.miniconda3_setup  # py37+pyvista+vtk 
0015 
0016 
0017 GUI
0018 ----
0019 
0020 shift+drag 
0021     pan
0022 two-finger-slide
0023     zoom 
0024 
0025 """
0026 import numpy as np, os
0027 import pyvista as pv   # requires vtk too, install with miniconda3 
0028 
0029 from opticks.ana.cube import make_cube
0030 from opticks.ana.ggeo import GGeo
0031 
0032 if __name__ == '__main__':
0033 
0034     gg = GGeo()
0035     bbox = gg.bbox
0036     identity = gg.identity
0037 
0038     #s_bbox = bbox[identity[:,1] == 16]
0039     #s_bbox = bbox[:197]
0040     #s_bbox = bbox[197:]
0041     s_bbox = bbox 
0042 
0043     pl = pv.Plotter()
0044     for i in range(len(s_bbox)):
0045         bb = s_bbox[i]
0046         v,f,i = make_cube(bb)
0047         surf = pv.PolyData(v, i)
0048         pl.add_mesh(surf, opacity=0.5, color=True)
0049     pass
0050     pl.show()
0051 
0052