Skip to content

Commit fe67170

Browse files
author
Lee Newberg
committed
ENH: Notebook now runs on Google Colab.
Install python3-openslide. Add tensorflow<2.7 dependency. Add advice that Google Colab may require 'Runtime->Restart runtime'. Add GitHub badge to README.md.
1 parent b4436e4 commit fe67170

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ The goal of this project is to create a whole-slide image file reader for machin
77
## Installation for Python
88

99
[![PyPI Version](https://img.shields.io/pypi/v/histomics_stream.svg)](https://pypi.python.org/pypi/histomics_stream)
10-
[![Open In CoLab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DigitalSlideArchive/histomics_stream/blob/master/example/tensorflow_stream.ipynb?authuser=1)
10+
[![GitHub repository](https://img.shields.io/badge/Powered%20by-histomics__stream-blue.svg)](https://github.com/DigitalSlideArchive/histomics_stream)
11+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DigitalSlideArchive/histomics_stream/blob/master/example/tensorflow_stream.ipynb?authuser=1)
1112

1213
histomics_stream can be easily installed with Python wheels. If you do not want the installation to be to your current Python environment, you should first create and activate a [Python virtual environment (venv)](https://docs.python.org/3/tutorial/venv.html) to work in. Then, run the following from the command line:
1314

1415
```shell-script
15-
pip uninstall -y large_image tensorflow histomics_stream
16-
pip install 'large_image[all]' --find-links https://girder.github.io/large_image_wheels
17-
pip install histomics_stream
16+
apt update
17+
apt install -y python3-openslide openslide-tools
18+
pip uninstall -y histomics_stream large_image tensorflow
19+
pip install histomics_stream 'large_image[all]' --find-links https://girder.github.io/large_image_wheels
1820
```
1921

2022
Launch `python3`, import the histomics_stream package, and use it

example/tensorflow_stream.ipynb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@
2929
"metadata": {},
3030
"outputs": [],
3131
"source": [
32-
"!pip uninstall -y large_image tensorflow histomics_stream\n",
33-
"!pip install 'large_image[all]' --find-links https://girder.github.io/large_image_wheels\n",
34-
"!pip install histomics_stream"
32+
"!apt update\n",
33+
"!apt install -y python3-openslide openslide-tools\n",
34+
"!pip uninstall -y histomics_stream large_image tensorflow\n",
35+
"!pip install histomics_stream 'large_image[all]' --find-links https://girder.github.io/large_image_wheels\n",
36+
"print(\n",
37+
" \"NOTE!: On Google Colab you may need to choose 'Runtime->Restart runtime' for these updates to take effect.\"\n",
38+
")"
3539
]
3640
},
3741
{
@@ -69,6 +73,7 @@
6973
"mask_filename = os.path.splitext(local_filename)[0] + \"-mask.png\"\n",
7074
"if not os.path.exists(mask_filename):\n",
7175
" import large_image\n",
76+
"\n",
7277
" print(f\"Creating {mask_filename} ...\")\n",
7378
" ts = large_image.open(local_filename)\n",
7479
" import numpy as np\n",

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
"histomics_stream": "histomics_stream",
1818
},
1919
install_requires=[
20-
# tensorflow is not listed as a requirement because the user
21-
# will likely want to specify the version for compatibility
22-
# with the CUDA libraries, etc.
20+
"tensorflow>=2.6.0,<2.7",
2321
"itk",
2422
"pillow",
2523
"imagecodecs",

0 commit comments

Comments
 (0)