def add_streamlines(scene, framen, totframes): """ Adds streamlines to the scene """ scene.add( *make_streamlines( *streams[1:9], color="steelblue", alpha=0.02, radius=10 ) )
def test_streamlines(): s = Scene(title="BR") streams = get_streamlines_for_region("TH", force_download=False) s.add(Streamlines(streams[0])) s.add(*make_streamlines(*streams[1:3])) with pytest.raises(TypeError): Streamlines([1, 2, 3]) # s.render(interactive=False) del s
br.settings.SHOW_AXES = False br.settings.vsettings.screenshotTransparentBackground - True scene = br.Scene(screenshots_folder=save_folder, inset=False) scene.add_brain_region("RSP", alpha=1) scene.add_brain_region("MOs", alpha=0.2) streams = get_streamlines_for_region("RSP")[:2] scene.add( *make_streamlines( *streams, color=scene.atlas._get_from_structure("RSP", "rgb_triplet"), alpha=0.5, ) ) camera = { "pos": (-6374, -5444, 26602), "viewup": (0, -1, 0), "clippingRange": (19433, 56931), "focalPoint": (7830, 4296, -5694), "distance": 36602, } scene.render(interactive=False, camera=camera) scene.screenshot(name="rsp_to_mos")
from brainrender import Scene from brainrender.atlas_specific import get_streamlines_for_region from brainrender.actors.streamlines import make_streamlines # Create a brainrender scene scene = Scene() # Add brain regions scene.add_brain_region("TH") # Get stramlines data and add streams = get_streamlines_for_region("TH") scene.add(*make_streamlines(*streams, color="salmon", alpha=0.5)) # Render! scene.render()
cam = { "pos": (-4767, -3533, -31261), "viewup": (0, -1, 0), "clippingRange": (22849, 40012), "focalPoint": (11035, 4324, -6224), "distance": 30632, } # Create a brainrender scene scene = Scene(title="projections from " + region, root=False) # Add brain regions scene.add_brain_region(*regions, alpha=0.6, silhouette=True) scene.add_brain_region("PAG", alpha=0.2, silhouette=False) # Get stramlines data and add streams = get_streamlines_for_region(region) zoom = 2 for n, stream in enumerate(streams): act = scene.add(*make_streamlines(stream, color="salmon", alpha=0.6)) # Render! scene.render(interactive=False, zoom=zoom, camera=cam) scene.screenshot(dest_fld + f"/{region}_streams_{n}") scene.remove(act) zoom = 1 # break