def gapsview(keep=True, **kwargs): if keep: d = tempfile.mkdtemp() _gapsview(d, **kwargs) else: with py_util.py2_temporary_directory() as d: _gapsview(d, **kwargs)
def grdview(volume, world2grid=None): with py_util.py2_temporary_directory() as d: gpath = d + '/g.grd' # Dummy world2grid: file_util.write_grd(gpath, volume, world2grid=world2grid) cmd = '%s/grdview %s' % (path_util.gaps_path(), gpath) sp.check_output(cmd, shell=True)
def ptsview(pts, mesh=None, camera='fixed'): """Interactively visualizes a pointcloud alongside an optional mesh.""" with py_util.py2_temporary_directory() as d: ptspath = _make_pts_input_str(d, pts, allow_none=False) init_camera = _setup_cam(camera) mshpath = '' if mesh: mshpath = d + '/m.ply' file_util.write_mesh(mshpath, mesh) mshpath = ' ' + mshpath cmd = '%s/ptsview %s%s%s' % (path_util.gaps_path(), ptspath, mshpath, init_camera) log.info(cmd) sp.check_output(cmd, shell=True)
def mshview(mesh, camera='fixed'): """Interactively views a mesh.""" with py_util.py2_temporary_directory() as d: init_camera = _setup_cam(camera) if not isinstance(mesh, list): mesh = [mesh] assert len(mesh) <= 4 mshpath = '' for m, c in zip(mesh, ['m', 'n', 'o', 'p']): lpath = f'{d}/{c}.ply' mshpath += f' {lpath}' file_util.write_mesh(lpath, m) cmd = '%s/mshview %s%s' % (path_util.gaps_path(), mshpath, init_camera) log.info(cmd) sp.check_output(cmd, shell=True)