Cytomine-python-client is an open-source Cytomine client written in Python. This client is a Python wrapper around Cytomine REST API gateway.
All data available from the Cytomine graphical interface can be manipulated programmatically from your computer. This page introduces the key concepts on how to interact with Cytomine without this graphical interface. Cytomine is a RESTful application. It means that the data stored and managed by Cytomine can be obtained through specific URLs. Contrary to the graphical interface, these URLs only provide relevant information data. To ease interaction with Cytomine, the Cytomine API client for Python encapsulates all the technical details relative to the HTTP API so that you can manipulate Cytomine resources without complexity.
- See https://doc.uliege.cytomine.org/ for more details.
- See https://uliege.cytomine.org/ for more information about Cytomine.
- Python 3.5+
The client can be installed from the github repository using pip:
pip install 'cytomine-python-client @ git+https://github.com/Cytomine-ULiege/bigpicture-cytomine-python-client.git'
See detailed usage documentation for the complete documentation.
Three parameters are required to connect:
HOST
: The full URL of Cytomine core (e.g. “http://demo.cytomine.be”).PUBLIC_KEY
: Your cytomine public key.PRIVATE_KEY
: Your cytomine private key.
First, the connection object has to be initialised.
from cytomine import Cytomine
host = "demo.cytomine.be"
public_key = "XXX" # check your own keys from your account page in the web interface
private_key = "XXX"
cytomine = Cytomine.connect(host, public_key, private_key)
The next sample code should print “Hello {username}” where {username} is replaced by your Cytomine username and print the list of available projects.
from cytomine.models import ProjectCollection
print(f"Hello {cytomine.current_user}")
projects = ProjectCollection().fetch()
print(projects)
for project in projects:
print(project)
Apache-2.0