API Reference¶
Connecting to a Server¶
Connections to servers are represented by a CatmaidInstance
object. You
can either initialize it directly or store credentials as environmental
variables and use connect_catmaid()
to do that for you.
|
Connect to CATMAID server using environmental variables. |
|
Class representing connection to a CATMAID project. |
Returns a copy of this CatmaidInstance. |
|
Clear cache. |
|
|
Fetch data from given URL(s). |
|
Load cache from file. |
|
Generates URL. |
Set up a cache for responses from the CATMAID server. |
|
|
Save cache to file. |
Fetching data¶
This section contains functions to pull data from a CATMAID server.
Neurons¶
Functions related to searching for neurons and fetching their 3D skeletons:
|
Find neurons matching given search criteria. |
|
Retrieve skeleton data for a list of skeleton ids. |
|
Retrieve neuron names for a list of skeleton ids. |
|
Retrieve 3D skeleton data as CatmaidNeuron/List. |
|
Get neuron ID(s) for given skeleton(s). |
|
Retrieves neurons with processes within CATMAID volumes. |
|
Get origin of given neuron(s). |
|
Retrieve the neurons annotated with given annotation(s). |
|
Retrieve the all neurons with matching name. |
|
Get skeleton IDs by origin. |
|
Get split and merge history of skeletons. |
|
Get all skeleton IDs from the project matching given filters. |
Neuron labels¶
Class for calculating neurons' labels, as used in the CATMAID frontend. |
|
LabelComponent which adds a skeleton ID modelling a neuron to its label. |
|
LabelComponent which adds a neuron's name to its label. |
|
LabelComponent which adds annotations to a neuron's label. |
|
Class containing some very basic information about a neuron as needed by NeuronLabeller. |
Annotations¶
Functions to fetch annotations:
|
Retrieve entities (neurons + annotations) with given annotation(s). |
|
Retrieve annotations for a list of skeleton ids. |
|
Retrieve annotations for a set of neuron. |
|
Retrieve annotations used by given user(s). |
|
Retrieve the annotation ID for single or list of annotation(s). |
|
Get a networkx DiGraph of semantic objects. |
Nodes¶
Functions to fetch nodes and connectors:
|
Get nodes by tag (label), ID or associated skeleton. |
|
Retrieves connectors within given bounding box. |
|
Retrieve skeleton IDs from a list of nodes. |
|
Retrieve detailed info for nodes and/or connectors. |
|
Retrieve nodes and connectors in given bounding box. |
|
Retrieves location for a set of nodes or connectors. |
|
Retrieve node table(s) for a list of neurons. |
|
Retrieve info for a set of nodes. |
Connectivity¶
Functions to fetch connectivity data:
|
Generate adjacency matrix between source and target neurons. |
|
Regenerate adjacency matrices from neurons' connectors. |
|
Generate connectivity table from neurons' connectors. |
|
Fetch number of connections of a given type for a set of neurons. |
|
Retrieve connectors based on a set of filters. |
|
Retrieve details on sets of connectors. |
|
Retrieve connectors between sets of neurons. |
|
Retrieve connectors links for a set of neurons. |
|
Retrieves connectors within given bounding box. |
|
Retrieve edges between sets of neurons. |
|
Retrieve partners connected by synapses, gap junctions or attachments. |
|
Retrieve the synaptic/gap junction partners within a CATMAID Volume. |
|
Retrieve Nth partners. |
|
Fetch paths between two sets of neurons. |
User stats¶
Functions to fetch user stats:
|
Retrieve contributor statistics for given skeleton ids. |
|
Retrieves CATMAID project history. |
|
Retrieve logs (same data as in log widget). |
|
Retrieve individual transactions with server. |
|
Get contributions by teams (nodes, reviews, connectors, time invested). |
|
Calculate the time spent working on a set of neurons. |
|
Get list of users. |
|
Return number of nodes and synapses contributed by each user. |
|
Get user stats similar to the pie chart statistics widget in CATMAID. |
Volumes¶
Functions to fetch volumes (meshes):
|
Retrieves volume (mesh). |
Landmarks¶
Functions to fetch data about landmarks.
|
Get all landmarks from CATMAID, optionall with locations associated with them. |
|
Get the landmark groups, optionally with IDs of their members and locations. |
|
Class for finding matching pairs of landmark locations between two groups. |
|
Class for finding matching pairs of landmark locations between two instances. |
Reconstruction samplers¶
Functions for reconstruction samplers:
|
Get list of reconstruction samplers. |
|
Get list of domains for given sampler. |
|
Get number of reconstruction samplers for a set of neurons. |
Image metadata¶
Functions to fetch information about the image stacks CATMAID knows about.
|
Get summary of all stacks in the project. |
|
Get information about an image stack. |
|
Get information about a stack mirror. |
Image data (tiles and N5 volumes)¶
Functions to fetch and process image data. Note that this is not imported at top level but has to be imported explicitly:
>>> from pymaid import tiles
>>> help(tiles.crop_neuron)
>>> from pymaid.stack import Stack
>>> help(Stack)
|
Load tiles from CATMAID, stitch into image and render output. |
|
Crop and save EM tiles following a neuron's segments. |
|
Class representing a CATMAID stack of images. |
Misc¶
Functions to fetch miscellaneous data:
Clear cache of global CatmaidInstance. |
|
|
Check if neuron(s) has soma. |
|
Get cable lengths directly from Catmaid Server. |
|
Get count of imported nodes for given neuron(s). |
|
Retrieve review status for a set of neurons. |
|
Retrieve review status (reviewer + timestamp) by node for given neuron. |
|
Generate URL to a location. |
Uploading data¶
Functions to push data to a CATMAID server. Use these with caution!
Neurons¶
Upload, rename, move or delete neurons:
|
Completely delete neurons. |
|
Upload only changes made to a neuron. |
|
Reroot neuron on server. |
|
Rename neuron(s). |
|
Replace skeleton in CatmaidInstance. |
|
Join multiple skeletons by minimizing the length of the newly added edges (minimum spanning tree). |
|
Copy neuron(s) from one CatmaidInstance to another. |
|
Change radii [nm] of given nodes. |
|
Export (upload) neurons to CatmaidInstance. |
Annotations¶
Edit neuron annotations:
|
Add annotation(s) to a list of neuron(s). |
|
Add meta-annotation(s) to annotation(s). |
|
Remove annotation(s) from a list of neuron(s). |
|
Remove meta-annotation(s) from annotation(s). |
Nodes¶
Edit nodes:
|
Create single (!) node at given location. |
|
Delete given nodes or connectors. |
|
Join two skeletons by nodes. |
|
Update location of given nodes or connectors. |
|
Set a list of nodes as reviewed. |
|
Change node confidences. |
Connectivity¶
Edit connectors and connector links:
|
Create connector(s) at given location. |
|
Link connectors with nodes. |
Tags¶
Edit tags:
|
Add or edit tag(s) for a list of node(s) or connector(s). |
|
Remove tag(s) for a list of node(s) or connector(s). |
Volumes¶
Upload volumes:
|
Upload volume/mesh to CatmaidInstance. |
CatmaidNeuron/List¶
Neuron/List objects representing neurons and lists thereof:
|
Catmaid neuron object holding neuron data (nodes, connectors, name, etc) and providing quick access to various PyMaid functions. |
|
Compilation of |
CatmaidNeuron
are a subclasses of
<navis https://navis.readthedocs.io/en/latest/>_ TreeNeuron
and
as such can be used with navis
functions.
CatmaidNeuron/List methods¶
Methods common to both CatmaidNeurons
and CatmaidNeuronLists
:
|
Return a copy of this neuron. |
|
Downsample the neuron by given factor. |
|
Plot neuron using |
|
Plot neuron using |
|
Prune neuron based on Strahler order. |
|
Prune neuron by intersection with given volume(s). |
|
Cut off nodes distal to given nodes. |
Remove nodes proximal to given node. |
|
Prune neuron down to the longest neurite. |
|
|
Prune terminal twigs under a given size. |
|
Reroot neuron to given node ID or node tag. |
|
Reload neuron from server. |
|
Resample neuron to given resolution. |
|
Get a summary of this neuron. |
CatmaidNeuronList-specific¶
Methods specific to CatmaidNeuronLists:
|
Generate JSON file which can be loaded in CATMAID selection tables. |
Generate NeuronList from CATMAID JSON file. |
|
|
Filter neurons by their annotations. |
Return summary for top N neurons. |
|
Return summary for bottom N neurons. |
|
Helper to mimic |
|
Remove duplicate neurons from list. |
|
Return random subset of neurons. |
|
|
Get summary over all neurons in this NeuronList. |
Return mean numeric and boolean values over all neurons. |
|
Return sum numeric and boolean values over all neurons. |
|
|
Sort neurons by given key. |
Working with Neurons¶
As said previously, CatmaidNeuron
can be used with
<navis https://navis.readthedocs.io/en/latest/>_. This includes functions
to manipulate (e.g. prune, subset, resample), analyze (e.g. strahler index,
synapse flow) or plot neurons.
In addition, pymaid
has a few more CATMAID-specific functions:
Morphology¶
|
Removes branches with a given treenode tag (e.g. |
|
Reverses time and make neurons young again! |
|
Remove segments of given length. |
|
Generate the union of a set of neurons. |
Analysis¶
Various morphology metrics:
|
Calculate along-the-arbor confidence for each treenode. |
Predicting connectivity¶
Function to predict connectivity:
|
Calculate potential synapses from source onto target neurons. |
Analyses¶
Functions to analyse connectivity:
|
Cluster neurons based on connectivity. |
|
Cluster neurons based on their synapse placement. |
|
Class to handle, analyze and plot similarity/distance matrices. |
|
Calculate connection density. |
|
Calculate sparseness. |
Filtering¶
Functions to filter connectivity data:
|
Filter connectivity data by volume or skeleton data. |
|
Return shared partners between neuron(s) A and B. |
Utility¶
Various utility functions.
|
Extract skeleton IDs from input. |
|
Set global progress bar behaviors. |
|
Helper function to set levels for all associated module loggers. |
|
Shorten a neuron name by iteratively removing non-essential bits. |