pymaid.upload_neuron

pymaid.upload_neuron(x, import_tags=False, import_annotations=False, import_connectors=False, reuse_existing_connectors=True, skeleton_id=None, neuron_id=None, force_id=False, source_id=None, source_project_id=None, source_url=None, source_type=None, remote_instance=None)[source]

Export (upload) neurons to CatmaidInstance.

Note that skeleton, node and connector IDs will change (see server response for old->new mapping). Neuron to import must not have more than one skeleton (i.e. disconnected components = more than one root node).

Parameters
  • x (CatmaidNeuron/List) – Neurons to upload.

  • import_tags (bool, optional) – If True, will upload node tags from x.tags.

  • import_annotations (bool, optional) – If True will upload annotations from x.annotations.

  • import_connectors (bool, optional) – If True will upload connectors from x.connectors.

  • reuse_existing_connectors (bool, optional) – Only matters when import_connectors is True. If True will look in the remote_instance at the location of each of x’s connectors, and if present, x will be linked to that existing connector instead of a new (duplicate) connector being created at that location. If False all of x.connectors are uploaded as new.

  • skeleton_id (int, optional) – Use this to set the Id of the new skeleton(s). If not provided will will generate a new ID upon export.

  • neuron_id (int, optional) – Use this to associate the new skeleton(s) with an existing neuron.

  • force_id (bool, optional) – If True and neuron/skeleton IDs already exist in project, their instances will be replaced. If False and you pass neuron_id or skeleton_id that already exist, an error will be thrown.

  • source_id (int, optional) –

  • source_project_id (int, optional) –

  • source_url (str, optional) –

  • source_type ("skeleton" | "segmentation", optional) – source_{} are optional fields that will be associated with the newly uploaded neuron to help keep track of neurons’ origins. You can use get_origin(), get_skids_by_origin() and find_neurons() to look up neurons by their origin.

  • remote_instance (CatmaidInstance, optional) – CatmaidInstance to upload to. If not passed directly, will try using global.

Returns

Server response with new skeleton/node IDs:

{
 'neuron_id': new neuron ID,
 'skeleton_id': new skeleton ID,
 'node_id_map': {'old_node_id': new_node_id, ...},
 'annotations': if import_annotations=True,
 'tags': if tags=True
}

Return type

dict