cytomine
get_image_id(slidename, id_project)
Fetch cytomine image id corresponding to a slide filename. Raises a RuntimeError if image is not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slidename |
str
|
annotated slide's filename. |
required |
id_project |
int
|
cytomine project's id. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Image id |
get_term_id(term, id_project)
Fetch cytomine term id corresponding to a given term.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
term |
str
|
input term. |
required |
id_project |
int
|
cytomine project's id. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Term id, or |
get_uploaded_images(host, public_key, private_key, id_project)
Get a list of uploaded images on a given cytomine project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host |
str
|
cytomine core ip address. |
required |
public_key |
str
|
cytomine API public key. |
required |
private_key |
str
|
cytomine API private key. |
required |
id_project |
int
|
cytomine project id. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
All uploaded images' filenames. |
polygons_to_annotations(polygons, id_image, id_project, object_min_size=1000, polygon_type='polygon')
Converts a shapely MultiPolygon object into a cytomine ready-to-upload
AnnotationCollection object. Can optionally filter small polygons or replace them
with their bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polygons |
MultiPolygon
|
|
required |
id_image |
int
|
cytomine id of the image to annotate. |
required |
id_project |
int
|
cytomine project id. |
required |
object_min_size |
int
|
minimum accepted area of a polygon. |
1000
|
polygon_type |
str
|
if "polygon", upload polygons without changes; if "box", upload their bounding boxes instead. |
'polygon'
|
Returns:
| Type | Description |
|---|---|
AnnotationCollection
|
The collection of cytomine annotations to upload. |
upload_annotations_with_terms(annotations, id_image, id_project, id_term=None)
Upload annotations to cytomine, optionally with given term.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotations |
AnnotationCollection
|
collection of annotations to upload. |
required |
id_image |
int
|
cytomine id of the image to annotate. |
required |
id_project |
int
|
cytomine project id. |
required |
id_term |
Optional[int]
|
cytomine id of the term to use for annotation. |
None
|
upload_image_to_cytomine(filepath, host, public_key, private_key, id_project)
Upload an image to a given cytomine project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath |
PathLike
|
path to image file. |
required |
host |
str
|
cytomine core ip address. |
required |
public_key |
str
|
cytomine API public key. |
required |
private_key |
str
|
cytomine API private key. |
required |
id_project |
str
|
cytomine project id. |
required |
upload_polygons_to_cytomine(polygons, slidename, host, public_key, private_key, id_project, term=None, polygon_type='polygon', object_min_size=1000)
Upload polygons to cytomine. Can optionally specify a term, filter small polygons or upload bounding boxes instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polygons |
MultiPolygon
|
|
required |
slidename |
str
|
annotated slide's filename. |
required |
host |
str
|
cytomine core ip address. |
required |
public_key |
str
|
cytomine API public key. |
required |
private_key |
str
|
cytomine API private key. |
required |
id_project |
int
|
cytomine project id. |
required |
term |
Optional[str]
|
term to use for annotation. |
None
|
polygon_type |
str
|
if "polygon", upload polygons without changes; if "box", upload their bounding boxes instead. |
'polygon'
|
object_min_size |
int
|
minimum accepted area of a polygon. |
1000
|