navis 1.4.0
  • Install
  • Quickstart
  • Tutorials
  • API
  • Changelog
  • Github
  • Ecosystem
  • Site
    • Page
        • navis.Viewer
          • Viewer
            • Viewer.picking
            • Viewer.selected
            • Viewer.show_legend
            • Viewer.legend_font_size
            • Viewer.__init__()

    navis.Viewer¶

    class navis.Viewer(picking=False, **kwargs)[source]¶

    Vispy 3D viewer.

    Parameters:
    • picking (bool, default = False) – If True, allow selecting neurons by shift-clicking on neurons and placing a 3D cursor via control-click (for OSX: command-click).

    • **kwargs – Keyword arguments passed to vispy.scene.SceneCanvas.

    picking¶

    Set to True to allow picking via shift-clicking.

    Type:

    bool,

    selected¶

    List of currently selected neurons. Can also be used to set the selection.

    Type:

    np.array

    show_legend¶

    Set to True or press L to show legend. This may impact performance.

    Type:

    bool

    legend_font_size¶

    Font size for legend.

    Type:

    int

    Examples

    This viewer is what navis.plot3d() uses when backend='vispy'. Instead of navis.plot3d() we can interact with the viewer directly:

    >>> # Open a 3D viewer
    >>> import navis
    >>> v = navis.Viewer()
    >>> # Close the 3D viewer
    >>> v.close()
    

    You can change the background color from the start or on-the-go:

    >>> # Set background to green
    >>> v = navis.Viewer(bgcolor='green')
    >>> # Set background back to white
    >>> v.set_bgcolor((1, 1, 1))
    >>> # Alternative to v.close():
    >>> navis.close3d()
    
    __init__(picking=False, **kwargs)[source]¶

    Methods

    __init__([picking])

    add(x[, center, clear, combine])

    Add objects to canvas.

    center_camera()

    Center camera on visuals.

    clear()

    Clear canvas.

    clear_legend()

    Clear legend.

    close()

    Close viewer.

    colorize([palette, include_connectors])

    Colorize neurons using a seaborn color palette.

    hide_neurons(n)

    Hide given neuron(s).

    hide_selected()

    Hide currently selected neuron(s).

    pin_neurons(n)

    Pin given neuron(s).

    pop([N])

    Remove the most recently added N visuals.

    remove(to_remove)

    Remove given neurons/visuals from canvas.

    remove_bounds()

    Remove bounding box visual.

    screenshot([filename, pixel_scale, alpha, ...])

    Save a screenshot of this viewer.

    set_alpha(a[, include_connectors])

    Set neuron color alphas.

    set_bgcolor(c)

    Set background color.

    set_colors(c[, include_connectors])

    Set neuron color.

    set_view(view)

    (Re-)set camera position.

    show()

    Show viewer.

    toggle_bounds()

    Toggle bounding box.

    toggle_neurons(n)

    Toggle neuron(s) visibility.

    toggle_overlay()

    Toggle legend on and off.

    toggle_picking()

    Toggle picking and overlay text.

    toggle_select(n)

    Toggle selected of given neuron.

    unhide_neurons([n, check_alpha])

    Unhide given neuron(s).

    unpin_neurons([n])

    Unpin given neuron(s).

    update_bounds([color, width])

    Update bounding box visual.

    update_legend()

    Update legend.

    visuals_at(pos)

    List visuals at given canvas position.

    Attributes

    bounds

    Bounds of all currently visuals (visible and invisible).

    invisible

    List IDs of currently visible neurons.

    legend_font_size

    Change legend's font size.

    neurons

    Return visible and invisible neuron visuals currently on the canvas.

    objects

    Ordered dictionary {uuid->[visuals]} of all objects in order of addition.

    picking

    Set to True to allow picking.

    pinned

    List IDs of currently pinned neurons.

    selected

    Return IDs of or set selected neurons.

    show_bounds

    Set to True to show bounding box.

    show_legend

    Set to True to hide neuron legend.

    visible

    List IDs of currently visible neurons.

    visuals

    List of all 3D visuals on this canvas.

    canvas

    from PyQt5.QtWidgets import QPushButton

    Back to top

    Source

    © Copyright 2018, Philipp Schlegel.
    Created using Sphinx 5.3.0.