Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/01-wsi-reading.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Read and Visualize a WSI\n",
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/develop/examples/01-wsi-reading.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/develop/examples/01-wsi-reading.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/develop/examples/01-wsi-reading.ipynb)]"
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/master/examples/01-wsi-reading.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/master/examples/01-wsi-reading.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/01-wsi-reading.ipynb)]"
]
},
{
Expand All @@ -29,7 +29,7 @@
"## About this notebook\n",
"This jupyter notebook can be run on any computer with a standard browser and no prior installation of any programming language is required. It can run remotely over the Internet, free of charge, thanks to Google Colaboratory or Kaggle. To connect with Colab or Kaggle, click on one of the URLs above. Check that \"colab\" or \"kaggle\", as appropriate, appears in the address bar. You can right click on \"Open in Colab\" and select \"Open in new tab\" if left click does not work for you. Familiarize yourself with the drop-down menus near the top of the window. You can edit the notebook during the session, for example substituting your own image files for the image files used in this demo. Experiment by changing the parameters of functions. It is not possible for an ordinary user to permanently change this version of the notebook on GitHub, Colab or Kaggle, so you cannot inadvertently mess it up. Use the notebook's File Menu if you wish to save your own (changed) notebook.\n",
"\n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the \n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the\n",
"[README](https://tia-toolbox.readthedocs.io/en/develop/installation.html) file."
]
},
Expand Down Expand Up @@ -863,7 +863,7 @@
"wsi_thumb = wsi_reader_v3.slide_thumbnail(resolution=1.25, units='power')\n",
"plt.imshow(wsi_thumb)\n",
"plt.axis('off')\n",
"plt.show()"
"plt.show()\n"
]
}
],
Expand Down Expand Up @@ -898,4 +898,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
10 changes: 5 additions & 5 deletions examples/02-stain-normalization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Stain Normalization\n",
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/develop/examples/02-stain-normalization.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/develop/examples/02-stain-normalization.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/develop/examples/02-stain-normalization.ipynb)]"
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/master/examples/02-stain-normalization.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/master/examples/02-stain-normalization.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/02-stain-normalization.ipynb)]"
]
},
{
Expand All @@ -29,7 +29,7 @@
"## About this notebook\n",
"This jupyter notebook can be run on any computer with a standard browser and no prior installation of any programming language is required. It can run remotely over the Internet, free of charge, thanks to Google Colaboratory or Kaggle. To connect with Colab or Kaggle, click on one of the URLs above. Check that \"colab\" or \"kaggle\", as appropriate, appears in the address bar. You can right click on \"Open in Colab\" and select \"Open in new tab\" if left click does not work for you. Familiarize yourself with the drop-down menus near the top of the window. You can edit the notebook during the session, for example substituting your own image files for the image files used in this demo. Experiment by changing the parameters of functions. It is not possible for an ordinary user to permanently change this version of the notebook on GitHub, Colab or Kaggle, so you cannot inadvertently mess it up. Use the notebook's File Menu if you wish to save your own (changed) notebook.\n",
"\n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the \n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the\n",
"[README](https://tia-toolbox.readthedocs.io/en/develop/installation.html) file."
]
},
Expand Down Expand Up @@ -435,7 +435,7 @@
"id": "aIQ7194lEi5j"
},
"source": [
"You can investigate one or more of the stain normalization methods we have implemented, by using either the class name as above, or our getter function `get_normaliser`. The getter function is applied to the corresponding method name. Below, we illustrate the latter approach. The stain normalisation names are provided in the `method_name_list` variable. We sequentially apply each method on the `sample` image and plot them for visual comparison. "
"You can investigate one or more of the stain normalization methods we have implemented, by using either the class name as above, or our getter function `get_normaliser`. The getter function is applied to the corresponding method name. Below, we illustrate the latter approach. The stain normalisation names are provided in the `method_name_list` variable. We sequentially apply each method on the `sample` image and plot them for visual comparison."
]
},
{
Expand Down Expand Up @@ -567,7 +567,7 @@
"plt.imshow(normed_sample2)\n",
"plt.title('Vahadane')\n",
"plt.axis('off')\n",
"plt.show()"
"plt.show()\n"
]
}
],
Expand Down Expand Up @@ -599,4 +599,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
8 changes: 4 additions & 4 deletions examples/03-tissue-masking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Masking tissue region in whole slide images\n",
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/develop/examples/03-tissue-masking.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/develop/examples/03-tissue-masking.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/develop/examples/03-tissue-masking.ipynb)]"
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/master/examples/03-tissue-masking.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/master/examples/03-tissue-masking.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/03-tissue-masking.ipynb)]"
]
},
{
Expand All @@ -29,7 +29,7 @@
"## About this notebook\n",
"This jupyter notebook can be run on any computer with a standard browser and no prior installation of any programming language is required. It can run remotely over the Internet, free of charge, thanks to Google Colaboratory or Kaggle. To connect with Colab or Kaggle, click on one of the URLs above. Check that \"colab\" or \"kaggle\", as appropriate, appears in the address bar. You can right click on \"Open in Colab\" and select \"Open in new tab\" if left click does not work for you. Familiarize yourself with the drop-down menus near the top of the window. You can edit the notebook during the session, for example substituting your own image files for the image files used in this demo. Experiment by changing the parameters of functions. It is not possible for an ordinary user to permanently change this version of the notebook on GitHub, Colab or Kaggle, so you cannot inadvertently mess it up. Use the notebook's File Menu if you wish to save your own (changed) notebook.\n",
"\n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the \n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the\n",
"[README](https://tia-toolbox.readthedocs.io/en/develop/installation.html) file."
]
},
Expand Down Expand Up @@ -584,7 +584,7 @@
"source": [
"As you can see, changing the parameters can change the resulting mask considerably. But don't worry! Normally you don't need to change or set anything when you are working with WSIs in`tiatoolbox`. Use the default arguments of functions—the toolbox will try to find the best parameters for your input WSI (as we did when we called`mask = wsi.tissue_mask()`).\n",
"\n",
"Feel free to try these functionalities on your own data, or change the parameters to see how they can affect the output mask."
"Feel free to try these functionalities on your own data, or change the parameters to see how they can affect the output mask.\n"
]
}
],
Expand Down Expand Up @@ -615,4 +615,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
8 changes: 4 additions & 4 deletions examples/04-patch-extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Patch extraction from Histology Images\n",
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/develop/examples/04-patch-extraction.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/develop/examples/04-patch-extraction.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/develop/examples/04-patch-extraction.ipynb)]"
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/master/examples/04-patch-extraction.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/master/examples/04-patch-extraction.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/04-patch-extraction.ipynb)]"
]
},
{
Expand All @@ -26,7 +26,7 @@
"## About this notebook\n",
"This jupyter notebook can be run on any computer with a standard browser and no prior installation of any programming language is required. It can run remotely over the Internet, free of charge, thanks to Google Colaboratory or Kaggle. To connect with Colab or Kaggle, click on one of the URLs above. Check that \"colab\" or \"kaggle\", as appropriate, appears in the address bar. You can right click on \"Open in Colab\" and select \"Open in new tab\" if left click does not work for you. Familiarize yourself with the drop-down menus near the top of the window. You can edit the notebook during the session, for example substituting your own image files for the image files used in this demo. Experiment by changing the parameters of functions. It is not possible for an ordinary user to permanently change this version of the notebook on GitHub, Colab or Kaggle, so you cannot inadvertently mess it up. Use the notebook's File Menu if you wish to save your own (changed) notebook.\n",
"\n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the \n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the\n",
"[README](https://tia-toolbox.readthedocs.io/en/develop/installation.html) file."
]
},
Expand Down Expand Up @@ -590,7 +590,7 @@
"id": "36PJ5qAFeV7m"
},
"source": [
"As you can see, the extracted patch is the same as the middle one in the above example."
"As you can see, the extracted patch is the same as the middle one in the above example.\n"
]
}
],
Expand Down Expand Up @@ -621,4 +621,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
24 changes: 12 additions & 12 deletions examples/05-patch-prediction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Patch Prediction Models\n",
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/develop/examples/05-patch-prediction.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/develop/examples/05-patch-prediction.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/develop/examples/05-patch-prediction.ipynb)]"
"Click to open in: [[GitHub](https://github.com/TissueImageAnalytics/tiatoolbox/tree/master/examples/05-patch-prediction.ipynb)][[Colab](https://colab.research.google.com/github/TissueImageAnalytics/tiatoolbox/blob/master/examples/05-patch-prediction.ipynb)][[Kaggle](https://kaggle.com/kernels/welcome?src=https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/05-patch-prediction.ipynb)]"
]
},
{
Expand All @@ -31,7 +31,7 @@
"## About this notebook\n",
"This jupyter notebook can be run on any computer with a standard browser and no prior installation of any programming language is required. It can run remotely over the Internet, free of charge, thanks to Google Colaboratory or Kaggle. To connect with Colab or Kaggle, click on one of the URLs above. Check that \"colab\" or \"kaggle\", as appropriate, appears in the address bar. You can right click on \"Open in Colab\" and select \"Open in new tab\" if left click does not work for you. Familiarize yourself with the drop-down menus near the top of the window. You can edit the notebook during the session, for example substituting your own image files for the image files used in this demo. Experiment by changing the parameters of functions. It is not possible for an ordinary user to permanently change this version of the notebook on GitHub, Colab or Kaggle, so you cannot inadvertently mess it up. Use the notebook's File Menu if you wish to save your own (changed) notebook.\n",
"\n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the \n",
"To run the notebook on any platform, except for Colab or Kaggle, set up your Python environment, as explained in the\n",
"[README](https://tia-toolbox.readthedocs.io/en/develop/installation.html) file."
]
},
Expand Down Expand Up @@ -350,8 +350,8 @@
" print('Class ID: {} -- Class Name: {} -- Number of images: {}'.format(\n",
" label, class_name, label_list.count(label)\n",
" ))\n",
" \n",
" \n",
"\n",
"\n",
"# overall dataset statistics\n",
"print('Total number of patches: {}'.format(len(patch_list)))"
]
Expand All @@ -370,10 +370,10 @@
"- MUS ⟶ Smooth muscle\n",
"- STR ⟶ Cancer-associated stroma\n",
"- ADI ⟶ Adipose\n",
"- MUC ⟶ Mucus \n",
"- MUC ⟶ Mucus\n",
"- TUM ⟶ Colorectal adenocarcinoma epithelium\n",
"\n",
"It is easy to use this code for your dataset - just ensure that your dataset is arranged like this example (images of different classes are placed into different subfolders), and set the right image extension in the `image_ext` variable. "
"It is easy to use this code for your dataset - just ensure that your dataset is arranged like this example (images of different classes are placed into different subfolders), and set the right image extension in the `image_ext` variable."
]
},
{
Expand Down Expand Up @@ -415,8 +415,8 @@
],
"source": [
"predictor = PatchPredictor(pretrained_model='resnet18-kather100k', batch_size=32)\n",
"output = predictor.predict(imgs=patch_list, \n",
" mode='patch', \n",
"output = predictor.predict(imgs=patch_list,\n",
" mode='patch',\n",
" on_gpu=ON_GPU)"
]
},
Expand All @@ -435,7 +435,7 @@
"- `batch_size`: Number of images fed into the model each time. Higher values for this parameter require a larger (GPU) memory capacity.\n",
"\n",
"The second line in the snippet above calls the `predict` method to apply the CNN on the input patches and get the results. Here are some important `predict` input arguments and their descriptions:\n",
"- `mode`: Type of input to be processed. Choose from `patch`, `tile` or `wsi` according to your application. In this first example, we predict the tissue type of histology patches, so we use the `patch` option. The use of `tile` and `wsi` options are explained below. \n",
"- `mode`: Type of input to be processed. Choose from `patch`, `tile` or `wsi` according to your application. In this first example, we predict the tissue type of histology patches, so we use the `patch` option. The use of `tile` and `wsi` options are explained below.\n",
"- `imgs`: List of inputs. When using `patch` mode, the input must be a list of images OR a list of image file paths, OR a Numpy array corresponding to an image list. However, for the `tile` and `wsi` modes, the `imgs` argument should be a list of paths to the input tiles or WSIs.\n",
"- `return_probabilities`: set to *__True__* to get per class probabilities alongside predicted labels of input patches. If you wish to merge the predictions to generate prediction maps for `tile` or `wsi` modes, you can set `return_probabilities=True`.\n",
"\n",
Expand Down Expand Up @@ -798,7 +798,7 @@
"source": [
"## Get predictions for patches within a WSI\n",
"\n",
"We demonstrate how to obtain predictions for all patches within a whole-slide image. As in previous sections, we will use `PatchPredictor` and its `predict` method, but this time we set the `mode` to `'wsi'`. We also introduce `IOPatchPredictorConfig`, a class that specifies the configuration of image reading and prediction writing for the model prediction engine. "
"We demonstrate how to obtain predictions for all patches within a whole-slide image. As in previous sections, we will use `PatchPredictor` and its `predict` method, but this time we set the `mode` to `'wsi'`. We also introduce `IOPatchPredictorConfig`, a class that specifies the configuration of image reading and prediction writing for the model prediction engine."
]
},
{
Expand Down Expand Up @@ -951,7 +951,7 @@
"source": [
"In this notebook, we show how we can use the `PatchPredictor` class and its `predict` method to predict the label for patches of big tiles and WSIs. We introduce `merge_predictions` and `overlay_patch_prediction` helper functions that merge the patch prediction outputs and visualize the resulting prediction map as an overlay on the input image/WSI.\n",
"\n",
"All the processes take place within the TIAToolbox and you can easily put the pieces together, following our example code. Just make sure to set inputs and options correctly. We encourage you to further investigate the effect on the prediction output of changing `predict` function parameters. Furthermore, if you want to use your own pretrained model for patch classification in the TIAToolbox framework (even if the model structure is not defined in the TIAToolbox model class), you can follow the instructions in our example notebook on [advanced model techniques](https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/07-advanced-modeling.ipynb) to gain some insights and guidance."
"All the processes take place within the TIAToolbox and you can easily put the pieces together, following our example code. Just make sure to set inputs and options correctly. We encourage you to further investigate the effect on the prediction output of changing `predict` function parameters. Furthermore, if you want to use your own pretrained model for patch classification in the TIAToolbox framework (even if the model structure is not defined in the TIAToolbox model class), you can follow the instructions in our example notebook on [advanced model techniques](https://github.com/TissueImageAnalytics/tiatoolbox/blob/master/examples/07-advanced-modeling.ipynb) to gain some insights and guidance.\n"
]
}
],
Expand Down Expand Up @@ -983,4 +983,4 @@
},
"nbformat": 4,
"nbformat_minor": 1
}
}
Loading