コード例 #1
0
def NeuronsScene3():
    scene = Scene()

    neurons_metadata = mouselight_fetch_neurons_metadata(
        filterby='soma', filter_regions=['VAL'])
    neurons_files = mlapi.download_neurons(neurons_metadata[2:6])
    scene.add_neurons(neurons_files,
                      soma_color='deepskyblue',
                      force_to_hemisphere="right")

    scene.add_brain_regions(['VAL'],
                            use_original_color=False,
                            colors='palegreen',
                            alpha=.9)
    mos = scene.actors['regions']['VAL']
    scene.edit_actors([mos], wireframe=True)

    streamlines_files, data = streamlines_api.download_streamlines_for_region(
        "VAL")
    scene.add_streamlines(data[:1],
                          color="palegreen",
                          show_injection_site=False,
                          alpha=.2,
                          radius=10)

    scene.render()
コード例 #2
0
ファイル: tests.py プロジェクト: paulbrodersen/BrainRender
def test_mouselight():
    from brainrender.Utils.MouseLightAPI.mouselight_api import MouseLightAPI
    from brainrender.Utils.MouseLightAPI.mouselight_info import mouselight_api_info, mouselight_fetch_neurons_metadata

    # Fetch metadata for neurons with some in the secondary motor cortex
    neurons_metadata = mouselight_fetch_neurons_metadata(
        filterby='soma', filter_regions=['MOs'])

    # Then we can download the files and save them as a .json file
    ml_api = MouseLightAPI()
    neurons_files = ml_api.download_neurons(
        neurons_metadata[:2]
    )  # just saving the first couple neurons to speed things up

    # Show neurons and ZI in the same scene:
    scene = Scene()
    scene.add_neurons(
        neurons_files,
        soma_color='orangered',
        dendrites_color='orangered',
        axon_color='darkseagreen',
        neurite_radius=8
    )  # add_neurons takes a lot of arguments to specify how the neurons should look
    # make sure to check the source code to see all available optionsq

    scene.add_brain_regions(['MOs'], alpha=0.15)
    scene.render(camera='coronal')
コード例 #3
0
def NeuronsScene2():
    scene = Scene()

    neurons_metadata = mouselight_fetch_neurons_metadata(filterby='soma', filter_regions=['MOp5'])
    neurons_files =  mlapi.download_neurons(neurons_metadata[2:6]) 
    scene.add_neurons(neurons_files, soma_color='deepskyblue', force_to_hemisphere="right")

    streamlines_files, data = streamlines_api.download_streamlines_for_region("MOp") 
    scene.add_streamlines(data[:1], color="palegreen", show_injection_site=False, alpha=.2, radius=10)

    set_camera(scene)
    scene.render()
コード例 #4
0
def test_neurons():
    scene = Scene()
    mlapi = MouseLightAPI()
    neurons_metadata = mouselight_fetch_neurons_metadata(filterby='soma', filter_regions=['MOs'])
    neurons_files =  mlapi.download_neurons(neurons_metadata[:2])

    parser = NeuronsParser(scene=scene, 
                        color_neurites=True, axon_color="antiquewhite", 
                        soma_color="darkgoldenrod", dendrites_color="firebrick")
    neurons, regions = parser.render_neurons(neurons_files)

    scene.add_neurons(neurons_files, color_neurites=False, random_color="jet", display_axon_regions=False)
コード例 #5
0
"""
    This tutorial shows how to download and render neurons from the MouseLight project
    using the MouseLightAPI class. 

    You can also download data manually from the neuronbrowser website and render them by
    passing the downloaded files to `scene.add_neurons`.
"""
import brainrender
brainrender.USE_MORPHOLOGY_CACHE = True
from brainrender.scene import Scene
from brainrender.Utils.MouseLightAPI.mouselight_api import MouseLightAPI
from brainrender.Utils.MouseLightAPI.mouselight_info import mouselight_api_info, mouselight_fetch_neurons_metadata

# Fetch metadata for neurons with some in the secondary motor cortex
neurons_metadata = mouselight_fetch_neurons_metadata(filterby='soma',
                                                     filter_regions=['MOs'])

# Then we can download the files and save them as a .json file
ml_api = MouseLightAPI()
neurons_files = ml_api.download_neurons(
    neurons_metadata[:2]
)  # just saving the first couple neurons to speed things up

# Show neurons and ZI in the same scene:
scene = Scene()
scene.add_neurons(
    neurons_files,
    soma_color='orangered',
    dendrites_color='orangered',
    axon_color='darkseagreen',
    neurite_radius=8