|
925 | 925 | "id": "GXdR9lJvQ5Tf" |
926 | 926 | }, |
927 | 927 | "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", |
929 | 929 | "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", |
930 | 930 | "\n", |
931 | 931 | "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 | 1396 | "id": "3eN9444WE2ew" |
1397 | 1397 | }, |
1398 | 1398 | "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: " |
1400 | 1400 | ] |
1401 | 1401 | }, |
1402 | 1402 | { |
|
1477 | 1477 | "source": [ |
1478 | 1478 | "query = '''\n", |
1479 | 1479 | "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", |
1486 | 1484 | "FROM\n", |
1487 | 1485 | " index\n", |
1488 | 1486 | "JOIN\n", |
|
1535 | 1533 | "os.makedirs(example_slides_dir, exist_ok=True)\n", |
1536 | 1534 | "\n", |
1537 | 1535 | "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')" |
1539 | 1537 | ] |
1540 | 1538 | }, |
1541 | 1539 | { |
|
1944 | 1942 | }, |
1945 | 1943 | "outputs": [], |
1946 | 1944 | "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", |
1948 | 1946 | "IFrame(viewer_url, width=1000, height=500)" |
1949 | 1947 | ] |
1950 | 1948 | }, |
|
1996 | 1994 | "\n", |
1997 | 1995 | "# Open slide with wsidicom\n", |
1998 | 1996 | "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", |
2000 | 1998 | "# Check which levels are available\n", |
2001 | 1999 | "print('Available levels: ')\n", |
2002 | 2000 | "for level in slide.levels:\n", |
|
2055 | 2053 | "# Open slide with openslide\n", |
2056 | 2054 | "file_path = os.path.join(slides_metadata.iloc[0]['local_path'], os.listdir(slides_metadata.iloc[0]['local_path'])[0])\n", |
2057 | 2055 | "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", |
2059 | 2057 | "# Check which levels are available\n", |
2060 | 2058 | "print(f'Number of available levels: {slide.level_count}')\n", |
2061 | 2059 | "print(f'Dimensions of available levels: {slide.level_dimensions}')\n", |
|
0 commit comments