In [1]:
import pymaid
# Connect to CATMAID
rm = pymaid.CatmaidInstance('https://www.your.catmaid-server.org',
api_token='YOURTOKEN',
http_user='user', # omit if not required
http_password='pw') # omit if not required
# Get some neurons
nl = pymaid.get_neurons(['57311', '27295'])
In [2]:
# Generate a plotly figure
fig = nl.plot3d(backend='plotly', connectors=True, width=800)
In [3]:
# Import plotly bindings
import plotly.offline
plotly.offline.init_notebook_mode(connected=True)
# Generate the figure without plotting it right away
fig = nl.plot3d(backend='plotly', connectors=True, width=1200, plotly_inline=False)
# This will open the plot in a separate browser window
plotly.offline.plot(fig, filename='3d_plot.html')
In [4]:
# Provide colors
vols = [pymaid.get_volume('LH_R', color=(255, 0, 0, .2)),
pymaid.get_volume('LH_L', color=(0, 255, 0, .2))]
fig = pymaid.plot3d([nl, *vols], backend='plotly', width=1200)
In [5]:
cust_vol = pymaid.Volume(vertices = [(1, 2, 1), (5, 6, 7), (8, 6, 4)],
faces = [(0, 1, 2)],
name = 'custom volume',
color = (255, 0, 0))
fig = pymaid.plot3d(cust_vol, backend='plotly', width=1200)
In [6]:
viewer = nl.plot3d()
In [7]:
viewer.screenshot('screenshot.png', alpha=True)
In [8]:
nl2 = pymaid.get_neurons([987675, 543210])
nl2.plot3d()
In [9]:
nl2.plot3d(clear3d=True)
In [10]:
pymaid.clear3d()
viewer.clear()
In [11]:
pymaid.close3d() #or
viewer.close()
In [12]:
# Open two viewers
v1 = pymaid.Viewer()
v2 = pymaid.Viewer()
# Add neurons to each one separately
v1.add(nl)
v2.add(nl2)
# Clear one viewer
v1.clear()
# Close the second viewer
v2.close()