Skip to content

Commit

Permalink
[DOC] add disclaimer that this project is for academic research purpo…
Browse files Browse the repository at this point in the history
…ses only (#224) [skip ci]

* add academic research use warning to readme

* add academic research disclaimer

* update float and int types for slide coords and probs

Use np.floating and np.integer.

* do not ignore types when making binary im arr
  • Loading branch information
kaczmarj authored Jul 9, 2024
1 parent e1843de commit ff79695
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Original H&E | Heatmap of Tumor Probability
[![Supported Python versions](https://img.shields.io/pypi/pyversions/wsinfer)](https://pypi.org/project/wsinfer/)
[![Published in npj Precision Oncology](https://img.shields.io/badge/Published-npj_Precision_Oncology-blue)](https://doi.org/10.1038/s41698-024-00499-9)

> [!CAUTION]
> WSInfer is an academic project intended for research use only.
See https://wsinfer.readthedocs.io for documentation.

The main feature of WSInfer is a minimal command-line interface for running deep learning inference
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ WSInfer: blazingly fast inference on whole slide images
on whole slide images. It includes several built-in models, and it can be used with any
PyTorch model as well. The built-in models :ref:`are listed below <available-models>`.

.. caution::

WSInfer is an academic project intended for research use only.

Running inference on whole slide images is done with a single command line:

::
Expand Down
4 changes: 2 additions & 2 deletions wsinfer/modellib/run_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def run_inference(

# Store the coordinates and model probabiltiies of each patch in this slide.
# This lets us know where the probabiltiies map to in the slide.
slide_coords: list[npt.NDArray[np.int_]] = []
slide_probs: list[npt.NDArray[np.float_]] = []
slide_coords: list[npt.NDArray[np.integer]] = []
slide_probs: list[npt.NDArray[np.floating]] = []
for batch_imgs, batch_coords in tqdm.tqdm(loader):
assert batch_imgs.shape[0] == batch_coords.shape[0], "length mismatch"
with torch.no_grad():
Expand Down
5 changes: 1 addition & 4 deletions wsinfer/patchlib/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ def segment_tissue(
_, im_arr = cv.threshold(
im_arr, thresh=binary_threshold, maxval=255, type=cv.THRESH_BINARY
)

# Convert to boolean dtype. This helps with static type analysis because at this
# point, im_arr is a uint8 array.
im_arr_binary: npt.NDArray[np.bool_] = im_arr > 0 # type: ignore
im_arr_binary: npt.NDArray[np.bool_] = im_arr > 0

# Closing. This removes small holes. It might not be entirely necessary because
# we have hole removal below.
Expand Down

0 comments on commit ff79695

Please sign in to comment.