import pymaid
# We will deactivate caching so that we always have the live data
rm = pymaid.connect_catmaid(caching=False)
INFO : Global CATMAID instance set. Caching is OFF. (pymaid)
resp = pymaid.add_annotations(16, "favourite neuron of Philipp")
resp
{'message': 'success', 'annotations': [{'name': 'favourite neuron of Philipp', 'id': 16954141, 'entities': [17]}], 'new_annotations': [16954141], 'existing_annotations': []}
pymaid.get_skids_by_annotation('favourite neuron of Philipp')
[16]
resp = pymaid.remove_annotations(16, 'favourite neuron of Philipp')
resp
INFO : Removed "favourite neuron of Philipp" from 1 entities (0 uses left) (pymaid)
{'deleted_annotations': {'16954141': {'targetIds': [17]}}, 'deleted_links': [16954142], 'left_uses': {'16954141': 0}}
import navis
import pandas as pd
# Create node table
node_table = pd.DataFrame([[0, -1, 0, 0, 0, -1],
[1, 0, 10, 10, 10, -1]],
columns=['node_id', 'parent_id', 'x', 'y', 'z', 'radius'])
# Turn node table into navis neuron
n = navis.TreeNeuron(node_table)
n
type | navis.TreeNeuron |
---|---|
name | None |
n_nodes | 2 |
n_connectors | None |
n_branches | 0 |
n_leafs | None |
cable_length | 17.3205 |
soma | None |
units | 1 dimensionless |
# Upload neuron to our CATMAID server
resp = pymaid.upload_neuron(n)
resp
{'neuron_id': 16954144, 'skeleton_id': 16954143, 'node_id_map': {0: 66611224, 1: 66611225}}
pymaid.get_neuron(resp['skeleton_id'])
HBox(children=(HTML(value='Make nrn'), FloatProgress(value=0.0, max=1.0), HTML(value='')))
type | CatmaidNeuron |
---|---|
name | neuron 16954144 |
id | 16954143 |
n_nodes | 2 |
n_connectors | 0 |
n_branches | 0 |
n_leafs | None |
cable_length | 17.3205 |
soma | None |
units | 1 nanometer |
_ = pymaid.rename_neurons(resp['skeleton_id'], 'Philipps mock neuron')
pymaid.get_names(resp['skeleton_id'])
Current name New name Skeleton ID 0 neuron 16954144 Philipps mock neuron 16954143 Please confirm above renaming [Y/N] y
INFO : All neurons successfully renamed. (pymaid)
{'16954143': 'Philipps mock neuron'}
pymaid.delete_neuron(resp['skeleton_id'])
Neuron "Philipps mock neuron" (#16954143) has 2 nodes (0 reviewed) and 1 annotation(s) Please confirm deletion [Y/N] y
{'skeleton_ids': [16954143], 'success': 'Deleted neuron #16954144 as well as its skeletons and annotations.'}