Skip to content

Commit c41d373

Browse files
adapted query
1 parent ac697c4 commit c41d373

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

notebooks/pathomics/getting_started_with_digital_pathology.ipynb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@
925925
"id": "GXdR9lJvQ5Tf"
926926
},
927927
"source": [
928-
"In case of DICOM-derived attributes the attributes' naming is corresponding directly to the name of the respective DICOM attribute plus a suffix, which indicates whether the column contains `CodeSchemeDesignator` and `CodeValue`, or `CodeMeaning`. If this is new to you, a brief explanation on the three-value based coding scheme in DICOM can be found at https://learn.canceridc.dev/dicom/coding-schemes.\n",
928+
"A description for each of the metadata attributes can be found [here]() as part of `idc-index`s documentation. In case of DICOM-derived attributes the attributes' naming is corresponding directly to the name of the respective DICOM attribute plus a suffix, which indicates whether the column contains `CodeSchemeDesignator` and `CodeValue`, or `CodeMeaning`. If this is new to you, a brief explanation on the three-value based coding scheme in DICOM can be found at https://learn.canceridc.dev/dicom/coding-schemes.\n",
929929
"Note that many columns have the datatype \"object\" due to missing (None Type) data, but also the fact that they might contain a list. In case of `sm_instance_index` this is, because slide preparation, e.g. staining, might consist of multiple steps, such as Eosin stain first, followed by Hematoxylin stain (H&E). In case of `sm_index`, all values of the instances belonging to the respective DICOM `Series` are listed.\n",
930930
"\n",
931931
"However, with the index tables being simply pandas DataFrames, the easiest way to get an overview of the values in the index tables are basic pandas operations:"
@@ -1396,7 +1396,7 @@
13961396
"id": "3eN9444WE2ew"
13971397
},
13981398
"source": [
1399-
"We now check all unique values available in `primaryAnatomicStructureModifier_CodeMeaning`, which tells us more about the tissue type (tumor, normal or other): "
1399+
"We now check all unique values available in `primaryAnatomicStructureModifier_CodeMeaning`, which tells us more about additional characteristics of the slide, such as whether it is tumor or normal tissue: "
14001400
]
14011401
},
14021402
{
@@ -1477,12 +1477,10 @@
14771477
"source": [
14781478
"query = '''\n",
14791479
"SELECT\n",
1480-
" index.SeriesInstanceUID as digital_slide_id,\n",
1481-
" index.StudyInstanceUID as case_id,\n",
1482-
" -- The 'cancer_subtype' can be easily infered from the collection_id.\n",
1483-
" (REPLACE (REPLACE(index.collection_id, 'cptac_luad', 'luad'), 'cptac_lscc', 'lscc')) AS cancer_subtype,\n",
1484-
" -- The 'tissue_types' indicates whether a slides contains normal, tumor or other tisse.\n",
1485-
" sm_index.primaryAnatomicStructureModifier_CodeMeaning as tissue_type\n",
1480+
" index.SeriesInstanceUID,\n",
1481+
" index.StudyInstanceUID,\n",
1482+
" index.collection_id,\n",
1483+
" sm_index.primaryAnatomicStructureModifier_CodeMeaning\n",
14861484
"FROM\n",
14871485
" index\n",
14881486
"JOIN\n",
@@ -1535,7 +1533,7 @@
15351533
"os.makedirs(example_slides_dir, exist_ok=True)\n",
15361534
"\n",
15371535
"idc_client.download_from_selection(downloadDir=example_slides_dir,\n",
1538-
" seriesInstanceUID=selection['digital_slide_id'].tolist(), dirTemplate='%SeriesInstanceUID')"
1536+
" seriesInstanceUID=selection['SeriesInstanceUID'].tolist(), dirTemplate='%SeriesInstanceUID')"
15391537
]
15401538
},
15411539
{
@@ -1944,7 +1942,7 @@
19441942
},
19451943
"outputs": [],
19461944
"source": [
1947-
"viewer_url = idc_client.get_viewer_URL(seriesInstanceUID=slides_metadata.iloc[0]['digital_slide_id'])\n",
1945+
"viewer_url = idc_client.get_viewer_URL(seriesInstanceUID=selection.iloc[0]['SeriesInstanceUID'])\n",
19481946
"IFrame(viewer_url, width=1000, height=500)"
19491947
]
19501948
},
@@ -1996,7 +1994,7 @@
19961994
"\n",
19971995
"# Open slide with wsidicom\n",
19981996
"slide = WsiDicom.open(slides_metadata.iloc[0]['local_path'])\n",
1999-
"print('Tissue type: ', slides_metadata.iloc[0]['reference_class_label'])\n",
1997+
"print('Tissue type: ', selection.iloc[0]['primaryAnatomicStructureModifier_CodeMeaning'])\n",
20001998
"# Check which levels are available\n",
20011999
"print('Available levels: ')\n",
20022000
"for level in slide.levels:\n",
@@ -2055,7 +2053,7 @@
20552053
"# Open slide with openslide\n",
20562054
"file_path = os.path.join(slides_metadata.iloc[0]['local_path'], os.listdir(slides_metadata.iloc[0]['local_path'])[0])\n",
20572055
"slide = OpenSlide(file_path)\n",
2058-
"print('Tissue type: ', slides_metadata.iloc[0]['reference_class_label'])\n",
2056+
"print('Tissue type: ', selection.iloc[0]['primaryAnatomicStructureModifier_CodeMeaning'])\n",
20592057
"# Check which levels are available\n",
20602058
"print(f'Number of available levels: {slide.level_count}')\n",
20612059
"print(f'Dimensions of available levels: {slide.level_dimensions}')\n",

0 commit comments

Comments
 (0)