Skip to content

Commit 1e6bda4

Browse files
authored
Merge pull request #41 from Leengit/example_notebook
ENH: Example notebook to create tensorflow Dataset via histomics_stream
2 parents eb799f0 + 47b1e52 commit 1e6bda4

File tree

5 files changed

+30
-24
lines changed

5 files changed

+30
-24
lines changed

example/TA232-mask.png

1.56 KB
Loading

example/TA232-source.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Data source
2+
The file `example/TA232.svs` comes from the zip file available as
3+
```
4+
https://stanfordmedicine.box.com/s/ub8e0wlhsdenyhdsuuzp6zhj0i82xrb1
5+
```
6+
from the web page
7+
```
8+
https://github.com/stanfordmlgroup/DLBCL-Morph
9+
```
10+
It is in that zip file as
11+
```
12+
DLBCL-Morph/TMA/MYC/TA232.svs
13+
```
14+
15+
The corresponding mask `example/TA232-mask.png` is randomly generated in Python with
16+
```python
17+
import numpy as np
18+
from PIL import Image
19+
arr = np.random.randint(0, 2, (number_of_rows_of_mask, number_of_columns_of_mask), dtype=np.int8)
20+
im = Image.fromarray(arr)
21+
im.save("TA232-mask.png")
22+
```

example/tensorflow_stream.ipynb

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": null,
6-
"id": "25408cb3-b6d6-4244-9346-6f3b3166cdb6",
7-
"metadata": {},
8-
"outputs": [],
9-
"source": [
10-
"# install histomics_stream\n",
11-
"!pip install -e /tf/notebooks/histomics_stream\n",
12-
"\n",
13-
"# add to system path\n",
14-
"import sys\n",
15-
"\n",
16-
"sys.path.append(\"/tf/notebooks/histomics_stream/\")"
17-
]
18-
},
193
{
204
"cell_type": "code",
215
"execution_count": null,
@@ -38,9 +22,9 @@
3822
"\n",
3923
"# Add a slide to the study, including slide-wide information with it.\n",
4024
"my_slide0 = my_slides[\"Slide_0\"] = {}\n",
41-
"my_slide0[\"filename\"] = \"/tf/notebooks/histomics_stream/example/TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913.svs\"\n",
42-
"my_slide0[\"slide_name\"] = \"TCGA-BH-A0BZ-01Z-00-DX1\"\n",
43-
"my_slide0[\"slide_group\"] = \"TCGA-BH-A0BZ\"\n",
25+
"my_slide0[\"filename\"] = \"TA232.svs\"\n",
26+
"my_slide0[\"slide_name\"] = \"TA232\"\n",
27+
"my_slide0[\"slide_group\"] = \"MYC\"\n",
4428
"my_slide0[\"number_pixel_rows_for_chunk\"] = 2048\n",
4529
"my_slide0[\"number_pixel_columns_for_chunk\"] = 2048\n",
4630
"\n",
@@ -88,8 +72,8 @@
8872
" my_study_tiles_by_grid_and_mask,\n",
8973
" number_pixel_overlap_rows_for_tile=0,\n",
9074
" number_pixel_overlap_columns_for_tile=0,\n",
91-
" mask_filename=\"/tf/notebooks/histomics_stream/example/TCGA-BH-A0BZ-01Z-00-DX1.45EB3E93-A871-49C6-9EAE-90D98AE01913-mask.png\",\n",
92-
" randomly_select=100,\n",
75+
" mask_filename=\"TA232-mask.png\",\n",
76+
" randomly_select=50,\n",
9377
")\n",
9478
"# We could apply this to a subset of the slides, but we will apply it to all slides in\n",
9579
"# this example.\n",
@@ -165,7 +149,7 @@
165149
"name": "python",
166150
"nbconvert_exporter": "python",
167151
"pygments_lexer": "ipython3",
168-
"version": "3.8.0"
152+
"version": "3.8.10"
169153
}
170154
},
171155
"nbformat": 4,

histomics_stream/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Whole-slide image streamer for TensorFlow."""
22

3-
__version__ = "2.1.0"
3+
__version__ = "2.1.1"
44

55
"""
66

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="histomics_stream",
8-
version="2.1.0",
8+
version="2.1.1",
99
author="Lee Newberg",
1010
author_email="lee.newberg@kitware.com",
1111
description="A TensorFlow 2 package for reading whole slide images",

0 commit comments

Comments
 (0)