Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,34 @@
"source": [
"This tutorial is shared as part of the tutorials prepared by the Imaging Data Commons team and available at https://github.com/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks.\n",
"\n",
"---\n",
"\n",
"`RMS-Mutation-Prediction-Expert-Annotations` is collection available in the [NCI Imaging Data Commons (IDC)](https://portal.imaging.datacommons.cancer.gov) that contains expert annotations of tissue types for 95 patients of the digital pathology slide images in the `RMS-Mutation-Prediction` collection released earlier. You can learn more about this collection in the following dataset record:\n",
"\n",
"> Bridge, C., Brown, G. T., Jung, H., Lisle, C., Clunie, D., Milewski, D., Liu, Y., Collins, J., Linardic, C. M., Hawkins, D. S., Venkatramani, R., Fedorov, A., & Khan, J. (2024). Expert annotations of the tissue types for the `RMS-Mutation-Prediction` microscopy images [Data set]. Zenodo. https://doi.org/10.5281/zenodo.10462858\n",
"\n",
"You can access this annotations collection in the IDC Portal using [this link](https://portal.imaging.datacommons.cancer.gov/explore/filters/?analysis_results_id=RMS-Mutation-Prediction-Expert-Annotations), or you can explore its content using this [custom Google Looker dashboard](https://tinyurl.com/idc-rms-annotations).\n",
"If you are new to IDC and DICOM for digital pathology applications, you may want to check out other introductory tutorials on this topic available here: https://github.com/ImagingDataCommons/IDC-Tutorials/tree/master/notebooks/pathomics.\n",
"\n",
"As is the case with all of the content of IDC, both the images and annotations are publicly available and are free to download!\n",
"This tutorial is aimed for the users of Imaging Data Commons that are interested to understand how to use annotations of slide microscopy images. You will learn how to:\n",
"\n",
"In this notebook we give you an overview of this collection, and demonstrate how to navigate its content programmatically.\n",
"select and download specific types of slide annotations, represented as polygons\n",
"parse annotations stored in DICOM Structured Reporting (SR) format\n",
"display and utilize the annotations for further analyses To learn more about the IDC, please visit the [IDC user guide](https://learn.canceridc.dev/).\n",
"If you have any questions, bug reports, or feature requests please feel free to contact us at the IDC discussion forum!\n",
"\n",
"---\n",
"\n",
"There are different ways to store annotations in DICOM, depending on the type of the annotation, and the specific DICOM object used. In this notebook we will discuss how to use planar closed contour annotations stored in [DICOM Structured Report](https://dicom.nema.org/dicom/2013/output/chtml/part20/sect_A.3.html) (SR) documents, which is the representation of annotations adopted in the `RMS-Mutation-Prediction-Expert-Annotations` collection. Using the example of expert-generated region annotations in rhabdomyosarcoma tumour slides, which have [recently been ingested into the NCI Imaging Data Commons](https://datascience.cancer.gov/news-events/news/rhabdomyosarcoma-images-now-available-through-nci-imaging-data-commons) (IDC), the organization of annotations stored in such SR objects is explained, and examples of how those annotations can be used and combined with the respective DICOM whole-slide images (WSIs) are provided.\n",
"Initial version: May 2024 \n",
"Updated: Feb 2026"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Background\n",
"\n",
"If you have any questions about this tutorial, please ask them on IDC forum: https://discourse.canceridc.dev\n",
"There are different ways to store annotations in DICOM, depending on the type of the annotation, and the specific DICOM object used. In this notebook we will discuss how to use planar closed contour annotations stored in DICOM **Structured Reporting** (SR) documents, which is also the representation of annotations adopted in the RMS-Mutation-Prediction-Expert-Annotations collection. The RMS-Mutation-Prediction-Expert-Annotations contains **expert-generated region annotations for rhabdomyosarcoma tumour slides** of 95 patients in the RMS-Mutation-Prediction collection released earlier. You can learn more about this collection in the following dataset record:\n",
"\n",
"---\n",
"> Bridge, C., Brown, G. T., Jung, H., Lisle, C., Clunie, D., Milewski, D., Liu, Y., Collins, J., Linardic, C. M., Hawkins, D. S., Venkatramani, R., Fedorov, A., & Khan, J. (2024). Expert annotations of the tissue types for the RMS-Mutation-Prediction microscopy images [Data set]. Zenodo. https://doi.org/10.5281/zenodo.10462858\n",
"\n",
"Initial version: May 2024\n",
"You can access this annotations collection in the IDC Portal using [this link](https://portal.imaging.datacommons.cancer.gov/explore/filters/?analysis_results_id=RMS-Mutation-Prediction-Expert-Annotations), or you can explore its content using this [custom Google Looker dashboard](https://tinyurl.com/idc-rms-annotations). As is the case with all of the content of IDC, both the images and annotations are publicly available and are free to download!\n",
"\n",
"Updated: Feb 2026"
"In the following notebook, the organization of annotations stored in SR objects is explained, and examples of how those annotations can be used and combined with the respective DICOM whole-slide images (WSIs) are provided."
]
},
{
Expand Down Expand Up @@ -118,26 +123,22 @@
"outputs": [],
"source": [
"import os\n",
"from glob import glob\n",
"import json\n",
"import random\n",
"import pydicom\n",
"import shapely\n",
"import duckdb\n",
"import highdicom as hd\n",
"import numpy as np\n",
"np.set_printoptions(threshold = 50)\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib import colors\n",
"import seaborn as sns\n",
"from idc_index import IDCClient\n",
"from wsidicom import WsiDicom\n",
"from wsidicom.instance.dataset import WsiDataset\n",
"from collections import defaultdict\n",
"from rasterio.features import is_valid_geom, rasterize\n",
"from shapely.geometry.polygon import Polygon\n",
"from typing import Dict, List, Tuple, Union"
"from typing import List, Tuple"
]
},
{
Expand All @@ -158,8 +159,7 @@
},
"outputs": [],
"source": [
"idc_client = IDCClient() # set-up idc_client\n",
"index_df = idc_client.index # get general metadata table"
"idc_client = IDCClient() # set-up idc_client"
]
},
{
Expand All @@ -176,7 +176,7 @@
" StudyInstanceUID,\n",
" PatientID\n",
"FROM\n",
" index_df\n",
" index\n",
"WHERE\n",
" collection_id = 'rms_mutation_prediction' AND Modality = 'SR'\n",
"'''\n",
Expand Down Expand Up @@ -3040,7 +3040,7 @@
"SELECT\n",
" SeriesInstanceUID\n",
"FROM\n",
" index_df\n",
" index\n",
"WHERE\n",
" SeriesInstanceUID = '{referenced_series_instance_uid}' AND Modality = 'SM'\n",
"'''\n",
Expand Down