Skip to content

Cytomine-ULiege/bigpicture-cytomine-python-client

 
 

Repository files navigation

Bigpicture Cytomine Python client

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

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'

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

Client to interact with Cytomine BIGPICTURE API in Python.

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%