Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

cytomine/Cytomine-python-client

Repository files navigation

Cytomine Python client

Warning

Deprecated: This repository is no longer maintained. Please see cytomine/cytomine for the latest version.

Cytomine-python-client is an open-source Cytomine client written in Python. This client is a Python wrapper around Cytomine REST API gateway.

GitHub release GitHub

Overview

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.

Requirements

  • Python 3.5+

Installation

cytomine-python-client is available on PyPi using pip:

pip install cytomine-python-client

For versions lower than 2.3.4, refer to manual installation guide.

Usage

See detailed usage documentation for the complete documentation.

Basic example

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)

Other examples

License

Apache-2.0

About

Cytomine client and utilities in Python

Resources

License

Stars

Watchers

Forks

Contributors 15

Languages