From c4ba72a0eb6d456f44199eba550aecfb2d3116dd Mon Sep 17 00:00:00 2001 From: sinberlin2 Date: Mon, 17 Jan 2022 16:30:53 +0100 Subject: [PATCH 1/3] add instructions for wsi label upload --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 95b5e31..835f4bd 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,30 @@ Utilities and command-line interface to interact with the [SlideScore](https://s - Python SlideScore API client - command-line utilities * For downloading from and uploading to SlideScore. + + +## Guide to using the slidescore API +For uploading or downloading labels or whole-slide images, the following steps need to be undertaken: +- Contact Jan (j.hudecek@nki.nl) to obtain an API token which allows you to access the slidescore or rhpc server. You need to give the following information: study_id(s), upload download or both, server: slidescore or rhpc server on which the study is located +- Export the token to as an environment variable (every time you access our server) and also when you switch between accessing the slidescore or the rhpc-slidescore server :
 export SLIDESCORE_API_KEY=”your_token”
+- use slidescore-api command + +### Example command for uploading labels: +
 slidescore --slidescore-url "https://slidescore.nki.nl" --study "818"  --disable-certificate-check upload-labels --user "user_name@nki.nl" --results-file "path_to_file/file.csv" --csv-delimiter "," 
+- short flags do not work properly at the moment) +##### Requirements for the labels file: +- format: csv +- separator: default is tab “/t”. +- Every whole-slide image is one line. +- Csv columns are: "imageID", "imageName", "user", "question", "answer", however no header should be present in the annotation file. +- If you do not have the imageID or imageName the mapping for this can be copied on slidescore under: → study → export cases. +- imageID: type string +- imageName: type string +- question: type string + - Refers to the type of label, e.g. ducts or lymphocytes. + - This question needs to be added to the study on slidescore: go to → study → edit study → questions → select question type e.g. annotate shapes for bounding box → name the question by clicking on it after it appears under "scoring sheet". The colour of the annotation can be also changed here. +- answer: type string + - Needs to be in a very specific format: “[{annotation 1}, {annotation 2}, {annotation n}]”. This list is inside the string. + - It can be achieved with using json.dumps(wsi_results) + - Every annotation is also in a specific format. + - For rectangle annotations: {"type": "rect", "corner": {"x": 123, "y": 456}, "size": {"x": 12, "y": 34}}. The corner coordinates refer to the top left corner of the rect. The size coordinates refer to the width (x) and the height (y). From a05c152653ce22f30b984ec40244dd1882f0991a Mon Sep 17 00:00:00 2001 From: sinberlin2 Date: Tue, 18 Jan 2022 14:53:28 +0100 Subject: [PATCH 2/3] made json dumps a bit clearer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 835f4bd..5165479 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,6 @@ For uploading or downloading labels or whole-slide images, the following steps n - This question needs to be added to the study on slidescore: go to → study → edit study → questions → select question type e.g. annotate shapes for bounding box → name the question by clicking on it after it appears under "scoring sheet". The colour of the annotation can be also changed here. - answer: type string - Needs to be in a very specific format: “[{annotation 1}, {annotation 2}, {annotation n}]”. This list is inside the string. - - It can be achieved with using json.dumps(wsi_results) + - Using json.dumps(), you can transform your list of annotation dictionaries into a sting in the format above. - Every annotation is also in a specific format. - For rectangle annotations: {"type": "rect", "corner": {"x": 123, "y": 456}, "size": {"x": 12, "y": 34}}. The corner coordinates refer to the top left corner of the rect. The size coordinates refer to the width (x) and the height (y). From df1b28183f6528a1dc41b242a5094b8818bfe08e Mon Sep 17 00:00:00 2001 From: sinberlin2 Date: Wed, 19 Jan 2022 11:46:04 +0100 Subject: [PATCH 3/3] added level 0 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5165479..e95770e 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,5 @@ For uploading or downloading labels or whole-slide images, the following steps n - Needs to be in a very specific format: “[{annotation 1}, {annotation 2}, {annotation n}]”. This list is inside the string. - Using json.dumps(), you can transform your list of annotation dictionaries into a sting in the format above. - Every annotation is also in a specific format. - - For rectangle annotations: {"type": "rect", "corner": {"x": 123, "y": 456}, "size": {"x": 12, "y": 34}}. The corner coordinates refer to the top left corner of the rect. The size coordinates refer to the width (x) and the height (y). + - For rectangle annotations: {"type": "rect", "corner": {"x": 123, "y": 456}, "size": {"x": 12, "y": 34}}. The corner coordinates refer to the top left corner of the rect. The size coordinates refer to the width (x) and the height (y). The coordinates need to be given at level 0 which corresponds to the entire view of the whole-slide image. + - The \ No newline at end of file