Page tree
Skip to end of metadata
Go to start of metadata

Introduction

For this HOWTO, we will use the workflow defined in [HOWTO] How to define a simple workflow and complete it so that it can run against a Cytomine server. To achieve this, we will use the cytomine-sldc library which defines the image format and interaction with cytomine server. 

Instantiate the client

You must first instantiate the client so that your workflow is able to communicate with the server. 

# replace the parameters __****__ with relevant values
cytomine = Cytomine(
    __HOST__,
    __PUBLIC_KEY__,
    __PRIVATE_KEY__,
    working_path=__WORKING_PATH__,
    base_path=__BASE_PATH__
)

TileBuilder

In the previous HOWTO, a component called tile_builder wasn't constructed. This component is actually in charge of building the tiles the workflow is going to process during the segmentation phase. When working with cytomine, one can use the CytomineTileBuilder from the cytomine-sldc library which extracts the tiles directly from the server. 

 

# replace the parameters __****__ with relevant values
tile_builder = CytomineTileBuilder(cytomine, working_path=__WORKING_PATH__)

 

Image

The workflow is now ready for processing images. To process a specific tile from cytomine, one can instantiate the CytomineSlide class from cytomine-sldc, apply the workflow on the resulting image and then go through the results. 

# from previous example:
workflow = builder.get()
 
# replace the parameters __****__ with relevant values
slide = CytomineSlide(cytomine, __SLIDE_ID__)
results = workflow.process(slide)

for polygon, dispatch, label, proba in results:
	# 'polygon' is the polygon representing the detected objects
	# 'dispatch' is the label of the dispatching rule that dispatched the label
	# 'label' is the classification label assigned by the classifier
	# 'proba' is the probabilities associated with the label (also assigned by the classifier) 

 

Add the SLDC software to Cytomine

Like with other script/software, you have to declare the software (and its parameter types) to Cytomine-Core, following basic principles. See the add_software.py file in cytomine-sldc repository for a full example.

 

  • No labels