tracks = [tr[0] for tr in a[0]] #tracks = tracks-np.concatenate(tracks,axis=0) lentra = [len(t) for t in tracks] colors = np.random.rand(np.sum(lentra),4) #colors[:,3]=0.9 """ streamlines = Line('fornix', tracks, colors, line_width=2) from fos import Window, Region from fos.actor.axes import Axes from fos.actor.text import Text3D title = 'Bundle Picker' w = Window(caption=title, width=1200, height=800, bgcolor=(0., 0., 0.2)) region = Region(regionname='Main', extent_min=np.array([-5.0, -5, -5]), extent_max=np.array([5, 5, 5])) ax = Axes(name="3 axes", linewidth=2.0) vert = np.array([[2.0, 3.0, 0.0]], dtype=np.float32) ptr = np.array([[.2, .2, .2]], dtype=np.float32) tex = Text3D("Text3D", vert, "Reg", 10, 2, ptr) region.add_actor(ax) region.add_actor(tex) region.add_actor(streamlines) #w.screenshot( 'red.png' ) w.add_region(region) w.refocus_camera()
affine = None data = np.zeros((256, 128, 32), np.uint8) volume = np.zeros(data.shape + (3, )) volume[..., 0] = data.copy() volume[..., 1] = data.copy() volume[..., 2] = data.copy() volume = volume.astype(np.ubyte) volume[..., :] = (255, 0, 0) #volume[] = print volume.shape, volume.min(), volume.max() window = Window() region = Region() #volume = data tex = Texture3D('Buzz', volume, affine) w, h, d = volume.shape[:-1] depindex = 100 dep = (0.5 + depindex) / np.float(d) texcoords = np.array([[dep, 0, 0], [dep, 0, 1], [dep, 1, 1], [dep, 1, 0]]) vertcoords = np.array([[-w / 2., -h / 2., 0.], [-w / 2., h / 2., 0.], [w / 2., h / 2., 0.], [w / 2, -h / 2., 0]]) tex.update_quad(texcoords, vertcoords) ax = Axes(name="3 axes", linewidth=2.0) vert = np.array([[2.0, 3.0, 0.0]], dtype=np.float32) ptr = np.array([[.2, .2, .2]], dtype=np.float32)