How to use the brainrender.Utils.camera.buildcam function in brainrender

To help you get started, we’ve selected a few brainrender examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrancoLab / BrainRender / tests / test_scene_io.py View on Github external
filterby="soma", filter_regions=["MOs"]
    )

    neurons_files = ml_api.download_neurons(neurons_metadata[:N_neurons])

    # ------------------------------- Create scene ------------------------------- #
    scene = Scene(display_inset=False, use_default_key_bindings=True)

    neurons_actors = scene.add_neurons(
        neurons_files, neurite_radius=12, alpha=0
    )

    # Create new cameras
    cam1 = buildcam(sagittal_camera)

    cam2 = buildcam(
        dict(
            position=[-16624.081, -33431.408, 33527.412],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.634, -0.676, -0.376],
            distance=51996.653,
            clipping=[34765.671, 73812.327],
        )
    )

    cam3 = buildcam(
        dict(
            position=[1862.135, -4020.792, -36292.348],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.185, -0.97, 0.161],
            distance=42972.44,
            clipping=[29629.503, 59872.10],
github BrancoLab / BrainRender / tests / test_scene_io.py View on Github external
)

    # Create new cameras
    cam1 = buildcam(sagittal_camera)

    cam2 = buildcam(
        dict(
            position=[-16624.081, -33431.408, 33527.412],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.634, -0.676, -0.376],
            distance=51996.653,
            clipping=[34765.671, 73812.327],
        )
    )

    cam3 = buildcam(
        dict(
            position=[1862.135, -4020.792, -36292.348],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.185, -0.97, 0.161],
            distance=42972.44,
            clipping=[29629.503, 59872.10],
        )
    )

    # ------------------------------- Create frames ------------------------------ #
    # Create frames
    prev_neurons = []
    for step in track(
        np.arange(N_FRAMES), total=N_FRAMES, description="Generating frames..."
    ):
        if step % N_frames_for_change == 0:  # change neurons every N framse
github BrancoLab / BrainRender / tests / test_scene_io.py View on Github external
zoom = np.linspace(1, 1.35, N_FRAMES)
    frac = np.zeros_like(
        zoom
    )  # for camera transition, interpolation value between cameras
    frac[:10] = np.linspace(0, 1, 10)
    frac[10:] = np.linspace(1, 0, len(frac[10:]))

    # ------------------------------- Create scene ------------------------------- #
    scene = Scene(display_inset=True, use_default_key_bindings=True)

    filepaths, data = scene.atlas.download_streamlines_for_region("TH")
    scene.add_brain_regions(["TH"], alpha=0.2)

    # Create new cameras
    cam1 = buildcam(sagittal_camera)
    cam2 = buildcam(top_camera)
    cam3 = buildcam(
        dict(
            position=[1862.135, -4020.792, -36292.348],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.185, -0.97, 0.161],
            distance=42972.44,
            clipping=[29629.503, 59872.10],
        )
    )

    # Iniziale camera position
    scene.plotter.moveCamera(cam1, cam2, frac[0])

    # ------------------------------- Create frames ------------------------------ #
    def frame_maker(scene=None, video=None, videomaker=None):
        for step in track(
github BrancoLab / BrainRender / tests / test_scene_io.py View on Github external
frac = np.zeros_like(
        zoom
    )  # for camera transition, interpolation value between cameras
    frac[:10] = np.linspace(0, 1, 10)
    frac[10:] = np.linspace(1, 0, len(frac[10:]))

    # ------------------------------- Create scene ------------------------------- #
    scene = Scene(display_inset=True, use_default_key_bindings=True)

    filepaths, data = scene.atlas.download_streamlines_for_region("TH")
    scene.add_brain_regions(["TH"], alpha=0.2)

    # Create new cameras
    cam1 = buildcam(sagittal_camera)
    cam2 = buildcam(top_camera)
    cam3 = buildcam(
        dict(
            position=[1862.135, -4020.792, -36292.348],
            focal=[6587.835, 3849.085, 5688.164],
            viewup=[0.185, -0.97, 0.161],
            distance=42972.44,
            clipping=[29629.503, 59872.10],
        )
    )

    # Iniziale camera position
    scene.plotter.moveCamera(cam1, cam2, frac[0])

    # ------------------------------- Create frames ------------------------------ #
    def frame_maker(scene=None, video=None, videomaker=None):
        for step in track(
            np.arange(N_FRAMES),
github BrancoLab / BrainRender / Examples / advanced / animated_scene2.py View on Github external
scene.add_brain_regions(["TH"], alpha=0.2)

# Make all streamlines background
for mesh in scene.actors["tracts"]:
    mesh.alpha(minalpha)
    mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)


cam2 = buildcam(top_camera)

cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.185, -0.97, 0.161],
        distance=42972.44,
        clipping=[29629.503, 59872.10],
    )
)

# Iniziale camera position
startcam = scene.plotter.moveCamera(cam1, cam2, frac[0])


# ------------------------------- Create frames ------------------------------ #
# Create frames
prev_streamlines = []
github BrancoLab / BrainRender / Examples / advanced / custom_videomaker.py View on Github external
root = scene.actors["root"]

filepaths, data = scene.atlas.download_streamlines_for_region("TH")
scene.add_streamlines(data, color="darkseagreen", show_injection_site=False)

scene.add_brain_regions(["TH"], alpha=0.2)

# Make all streamlines background
for mesh in scene.actors["tracts"]:
    mesh.alpha(minalpha)
    mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)
cam2 = buildcam(top_camera)
cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.185, -0.97, 0.161],
        distance=42972.44,
        clipping=[29629.503, 59872.10],
    )
)

# Iniziale camera position
startcam = scene.plotter.moveCamera(cam1, cam2, frac[0])


# ------------------------------- Create frames ------------------------------ #
def frame_maker(scene=None, video=None, videomaker=None):
github BrancoLab / BrainRender / Examples / advanced / animated_scene2.py View on Github external
scene = Scene(display_inset=True, use_default_key_bindings=True)
root = scene.actors["root"]

filepaths, data = scene.atlas.download_streamlines_for_region("TH")
scene.add_streamlines(data, color="darkseagreen", show_injection_site=False)

scene.add_brain_regions(["TH"], alpha=0.2)

# Make all streamlines background
for mesh in scene.actors["tracts"]:
    mesh.alpha(minalpha)
    mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)


cam2 = buildcam(top_camera)

cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.185, -0.97, 0.161],
        distance=42972.44,
        clipping=[29629.503, 59872.10],
    )
)

# Iniziale camera position
startcam = scene.plotter.moveCamera(cam1, cam2, frac[0])
github BrancoLab / BrainRender / Examples / advanced / animated_scene.py View on Github external
# ------------------------------- Create scene ------------------------------- #
scene = Scene(display_inset=False, use_default_key_bindings=True)
root = scene.actors["root"]

scene.add_neurons(neurons_files, neurite_radius=12, alpha=0)

# Make all neurons background
for neuron in scene.actors["neurons"]:
    for mesh in neuron.values():
        mesh.alpha(minalpha)
        mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)


cam2 = buildcam(
    dict(
        position=[-16624.081, -33431.408, 33527.412],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.634, -0.676, -0.376],
        distance=51996.653,
        clipping=[34765.671, 73812.327],
    )
)

cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
github BrancoLab / BrainRender / Examples / advanced / custom_videomaker.py View on Github external
scene = Scene(display_inset=True, use_default_key_bindings=True)
root = scene.actors["root"]

filepaths, data = scene.atlas.download_streamlines_for_region("TH")
scene.add_streamlines(data, color="darkseagreen", show_injection_site=False)

scene.add_brain_regions(["TH"], alpha=0.2)

# Make all streamlines background
for mesh in scene.actors["tracts"]:
    mesh.alpha(minalpha)
    mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)
cam2 = buildcam(top_camera)
cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.185, -0.97, 0.161],
        distance=42972.44,
        clipping=[29629.503, 59872.10],
    )
)

# Iniziale camera position
startcam = scene.plotter.moveCamera(cam1, cam2, frac[0])


# ------------------------------- Create frames ------------------------------ #
github BrancoLab / BrainRender / Examples / advanced / animated_scene2.py View on Github external
filepaths, data = scene.atlas.download_streamlines_for_region("TH")
scene.add_streamlines(data, color="darkseagreen", show_injection_site=False)

scene.add_brain_regions(["TH"], alpha=0.2)

# Make all streamlines background
for mesh in scene.actors["tracts"]:
    mesh.alpha(minalpha)
    mesh.color(darkcolor)


# Create new cameras
cam1 = buildcam(sagittal_camera)


cam2 = buildcam(top_camera)

cam3 = buildcam(
    dict(
        position=[1862.135, -4020.792, -36292.348],
        focal=[6587.835, 3849.085, 5688.164],
        viewup=[0.185, -0.97, 0.161],
        distance=42972.44,
        clipping=[29629.503, 59872.10],
    )
)

# Iniziale camera position
startcam = scene.plotter.moveCamera(cam1, cam2, frac[0])


# ------------------------------- Create frames ------------------------------ #