Skip to content

Commit

Permalink
Merge pull request #87 from qupath/0.4
Browse files Browse the repository at this point in the history
Add WSInfer TIL script
  • Loading branch information
petebankhead committed Nov 9, 2023
2 parents dc5f7b4 + edac9c2 commit fe0873e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/advanced/exporting_annotations.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(exporting-annotations)=
# Exporting annotations

People often ask about exporting QuPath annotations, to which the response is invariably *'In which format exactly?'*
Expand Down
1 change: 1 addition & 0 deletions docs/advanced/exporting_images.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Exporting an RGB image as a JPEG, for example, may introduce new compression art
The point is that no bit-depth or channel conversion is involved.
:::

(exporting-rendered-images)=
### Rendered images

Images within QuPath can have different numbers of channels and various bit-depths, but when they are displayed they generally need to be *rendered* as [3-channel, 8-bit RGB](https://petebankhead.gitbooks.io/imagej-intro/content/chapters/colors/colors.html#rgb-images).
Expand Down
22 changes: 20 additions & 2 deletions docs/deep/wsinfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The [WSInfer QuPath extension](https://github.com/qupath/qupath-extension-wsinfer/) makes it possible to do patch-based deep learning inference for digital pathology, without any need for scripting.

It's a collaboration between the QuPath group (the extension) and Stony Brook University ([WSInfer](https://wsinfer.readthedocs.io/en/latest/)).
It's a collaboration between Stony Brook University ([WSInfer](https://wsinfer.readthedocs.io/en/latest/)) and the QuPath group (the [extension](https://github.com/qupath/qupath-extension-wsinfer/) that brings WSInfer models to QuPath).

:::{admonition} Cite the paper!
:class: warning
Expand All @@ -17,6 +17,12 @@ If you use WSInfer and/or this extension in a publication, please make sure to c
- [WSInfer QuPath Extension](https://github.com/qupath/qupath-extension-wsinfer/releases)
- PyTorch (this can be downloaded while using the extension)

:::{tip}
A GPU is not required but can dramatically speed up processing.
If you have an NVIDIA GPU and want to use it with WSInfer, you will need to install a version of CUDA compatible with PyTorch - please see [the Deep Java Library page](deep-java-library-gpu).
:::


## Set-up

With QuPath installed and running, drag and drop the WSInfer extension into the application and restart QuPath.
Expand Down Expand Up @@ -129,7 +135,7 @@ selectAnnotations()
qupath.ext.wsinfer.WSInfer.runInference("kaczmarj/pancancer-lymphocytes-inceptionv4.tcga")
```

where the `selectAnnotation()` line was added when I pressed the {guilabel}`Annotations` button in the WSInfer dialog, and the following line runs the specified models (creating tiles automatically).
where the `selectAnnotation()` line was added when I pressed the {guilabel}`Annotations` button in the WSInfer dialog, and the following line runs the specified model (creating tiles automatically).

To process in batch, I would need to

Expand All @@ -138,3 +144,15 @@ To process in batch, I would need to
* Open the above script in QuPath's script editor
* Choose {menuselection}`Run --> Run for project`, and select the images I want to process


## Identifying TILs (overlaying predictions of two models)

By combining multiple WSInfer models, it's possible to develop more complex end-to-end workflows in QuPath.
This is easiest to achieve using scripting.

The script below aims to identify regions containing **tumor-infiltrating lymphocytes (TILs)**.
It does this by applying a lymphocyte patch classification model and then a breast tumor classification model on the same patches.

After running the script, you can [export results](exporting-measurements) or [markup images](exporting-rendered-images).

<script src="https://gist.github.com/petebankhead/aebd135d3f5a080f6216fb05d8029c42.js"></script>
1 change: 1 addition & 0 deletions docs/tutorials/exporting_measurements.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(exporting-measurements)=
# Exporting measurements

There are 3 different ways to export measurements within QuPath, via:
Expand Down

0 comments on commit fe0873e

Please sign in to comment.