In [1]:
import pymaid
import matplotlib.pyplot as plt

rm = pymaid.CatmaidInstance('server_url', 'api_token', 'http_user', 'http_password')

n = pymaid.get_neurons(16)

fig, ax = n.plot2d(connectors=False, linewidth=1)

plt.show()



In [2]:
# Keep the two highest Strahler orders
backbone = pymaid.prune_by_strahler(n, to_prune=-2, inplace=False)

fig, ax = backbone.plot2d(connectors=False, linewidth=1)
plt.show()



In [3]:
# Keep the two highest Strahler orders
terminals = pymaid.prune_by_strahler(n, to_prune=range(3,100), inplace=False)

fig, ax = terminals.plot2d(connectors=False, linewidth=1)
plt.show()



In [4]:
backbone = n.prune_by_strahler(to_prune=-2, inplace=False)

In [5]:
no_fake_branches = pymaid.remove_tagged_branches(n, 'not a branch', how='segment', inplace=False)
print('Number of terminals before pruning: {}'.format(n.n_end_nodes))
print('Number of terminals after pruning: {}'.format(no_fake_branches.n_end_nodes))


Number of terminals before pruning: 823
Number of terminals after pruning: 814

In [6]:
mt_only = pymaid.remove_tagged_branches(n, 'microtubules end', how='distal', inplace=False)