diff --git a/examples/integrations/itk/IDC_Seg_Primer_Examples.ipynb b/examples/integrations/itk/IDC_Seg_Primer_Examples.ipynb
index 2093a0ed..ad87864c 100644
--- a/examples/integrations/itk/IDC_Seg_Primer_Examples.ipynb
+++ b/examples/integrations/itk/IDC_Seg_Primer_Examples.ipynb
@@ -19,7 +19,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 7,
"id": "c98ddf17-b608-448c-9253-cd7b806b96db",
"metadata": {
"colab": {
@@ -33,12 +33,12 @@
"source": [
"import sys\n",
"\n",
- "!{sys.executable} -m pip install -q pooch itk-io \"itkwidgets[all]>=1.0a49\" pydicom pydicom-seg numpy"
+ "!{sys.executable} -m pip install -q pooch itk-io \"itkwidgets[all]>=1.0a53\" \"pydicom<=2\" pydicom-seg numpy"
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 8,
"id": "4120f9bf-e7f3-48a1-ab14-ce57b4d95621",
"metadata": {
"id": "4120f9bf-e7f3-48a1-ab14-ce57b4d95621",
@@ -99,7 +99,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 9,
"id": "1beba815-ea88-45f0-9dae-84038a13ba3d",
"metadata": {},
"outputs": [],
@@ -118,7 +118,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 10,
"id": "c214d4f2-b6fc-4e02-963f-1738ce02957e",
"metadata": {},
"outputs": [],
@@ -137,7 +137,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 11,
"id": "0bbe6f14-a34e-4280-bc21-7343a78af88b",
"metadata": {},
"outputs": [
@@ -145,21 +145,21 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "--2023-05-25 14:18:24-- https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz\n",
- "Resolving github.com (github.com)... 140.82.113.3\n",
- "Connecting to github.com (github.com)|140.82.113.3|:443... connected.\n",
+ "--2024-10-21 17:16:27-- https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz\n",
+ "Resolving github.com (github.com)... 140.82.112.3\n",
+ "Connecting to github.com (github.com)|140.82.112.3|:443... connected.\n",
"HTTP request sent, awaiting response... 302 Found\n",
- "Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/73909333/2e177ae0-614f-48ba-92fd-04cf9bf41529?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230525%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230525T181825Z&X-Amz-Expires=300&X-Amz-Signature=4327982d7fc3e663e05504d6f396f1bb67a31dfce4e3fce9fdaa939e35094d2d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=73909333&response-content-disposition=attachment%3B%20filename%3Ds5cmd_2.0.0_Linux-64bit.tar.gz&response-content-type=application%2Foctet-stream [following]\n",
- "--2023-05-25 14:18:24-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/73909333/2e177ae0-614f-48ba-92fd-04cf9bf41529?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230525%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230525T181825Z&X-Amz-Expires=300&X-Amz-Signature=4327982d7fc3e663e05504d6f396f1bb67a31dfce4e3fce9fdaa939e35094d2d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=73909333&response-content-disposition=attachment%3B%20filename%3Ds5cmd_2.0.0_Linux-64bit.tar.gz&response-content-type=application%2Foctet-stream\n",
- "Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.111.133, ...\n",
- "Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.\n",
+ "Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/73909333/2e177ae0-614f-48ba-92fd-04cf9bf41529?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241021%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241021T211627Z&X-Amz-Expires=300&X-Amz-Signature=f0ca8191cf05701f9657800125c96f5a898485823f8f347115a37ad97d2ea62a&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Ds5cmd_2.0.0_Linux-64bit.tar.gz&response-content-type=application%2Foctet-stream [following]\n",
+ "--2024-10-21 17:16:27-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/73909333/2e177ae0-614f-48ba-92fd-04cf9bf41529?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241021%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241021T211627Z&X-Amz-Expires=300&X-Amz-Signature=f0ca8191cf05701f9657800125c96f5a898485823f8f347115a37ad97d2ea62a&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Ds5cmd_2.0.0_Linux-64bit.tar.gz&response-content-type=application%2Foctet-stream\n",
+ "Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.109.133, 185.199.110.133, ...\n",
+ "Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 4276789 (4.1M) [application/octet-stream]\n",
"Saving to: ‘s5cmd_2.0.0_Linux-64bit.tar.gz’\n",
"\n",
- "s5cmd_2.0.0_Linux-6 100%[===================>] 4.08M 22.3MB/s in 0.2s \n",
+ "s5cmd_2.0.0_Linux-6 100%[===================>] 4.08M --.-KB/s in 0.08s \n",
"\n",
- "2023-05-25 14:18:25 (22.3 MB/s) - ‘s5cmd_2.0.0_Linux-64bit.tar.gz’ saved [4276789/4276789]\n",
+ "2024-10-21 17:16:27 (49.0 MB/s) - ‘s5cmd_2.0.0_Linux-64bit.tar.gz’ saved [4276789/4276789]\n",
"\n"
]
}
@@ -171,7 +171,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 12,
"id": "aOnyE_7hllIl",
"metadata": {
"id": "aOnyE_7hllIl",
@@ -189,7 +189,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 13,
"id": "RJzY1NUmneKZ",
"metadata": {
"id": "RJzY1NUmneKZ",
@@ -202,7 +202,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 14,
"id": "0e588f46-01b4-4ae4-886b-63742d59984d",
"metadata": {
"tags": []
@@ -222,7 +222,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 15,
"id": "264e1ce0-dd11-4197-a033-574d601cab50",
"metadata": {
"colab": {
@@ -238,11 +238,11 @@
"data": {
"text/html": [
"\n",
- "
\n",
+ "
\n",
" \n",
@@ -258,7 +258,7 @@
{
"data": {
"application/javascript": [
- "window.connectPlugin && window.connectPlugin(\"7a4d3388-37d8-410f-9cd2-0f4c8cb74f46\")"
+ "window.connectPlugin && window.connectPlugin(\"a205f07b-639e-4397-b96d-a6b63f9cb300\")"
],
"text/plain": [
""
@@ -270,7 +270,7 @@
{
"data": {
"text/html": [
- ""
+ ""
],
"text/plain": [
""
@@ -286,9 +286,13 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 16,
"id": "de4dfee3-1f5e-41d4-a599-02d1d9cbdf0e",
- "metadata": { "tags": ["skip-execution"] },
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
"outputs": [],
"source": [
"segthor_viewer.set_image_color_range([-1260, 2385])\n",
@@ -319,7 +323,11 @@
"cell_type": "code",
"execution_count": 10,
"id": "03988ee1-90eb-4e75-99af-2c56d932fad9",
- "metadata": { "tags": ["skip-execution"] },
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
"outputs": [],
"source": [
"head_image_file = pooch.retrieve('https://data.kitware.com/api/v1/file/61b61cd74acac99f42a7ec84/download',\n",
@@ -332,7 +340,11 @@
"cell_type": "code",
"execution_count": 11,
"id": "091d4d0e-fdc5-4034-b6a5-a4d7350b98d5",
- "metadata": { "tags": ["skip-execution"] },
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
"outputs": [
{
"data": {
@@ -388,7 +400,11 @@
"cell_type": "code",
"execution_count": null,
"id": "0f4633af-fd01-4ab5-8202-3fb642276040",
- "metadata": { "tags": ["skip-execution"] },
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
"outputs": [],
"source": []
}
@@ -412,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/examples/integrations/itkwasm/.gitignore b/examples/integrations/itkwasm/.gitignore
new file mode 100644
index 00000000..b8c4a834
--- /dev/null
+++ b/examples/integrations/itkwasm/.gitignore
@@ -0,0 +1 @@
+nsclc_radiogenomics
\ No newline at end of file
diff --git a/examples/integrations/itkwasm/DICOM_SEG.ipynb b/examples/integrations/itkwasm/DICOM_SEG.ipynb
new file mode 100644
index 00000000..b9973025
--- /dev/null
+++ b/examples/integrations/itkwasm/DICOM_SEG.ipynb
@@ -0,0 +1,255 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "7d6a1a99-7979-41e5-9a3d-4c94918da61b",
+ "metadata": {
+ "id": "7d6a1a99-7979-41e5-9a3d-4c94918da61b"
+ },
+ "source": [
+ "# DICOM SEG\n",
+ "\n",
+ "This example demonstrates how to read DICOM CT volumes with and DICOM SEG, AI-generated segmentations, with [ITK-Wasm](https://wasm.itk.org). Data is pulled from the [NIH Imaging Data Commons (IDC)](https://portal.imaging.datacommons.cancer.go).\n",
+ "\n",
+ "You can run this notebook locally or with any of the following platforms: \n",
+ "[](https://colab.research.google.com/github/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/itkwasm/DICOM_SEG.ipynb)\n",
+ "[](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/HEAD?labpath=examples%2Fintegrations%2Fitkwasm%2FDICOM_SEG.ipynb)\n",
+ "[](https://studiolab.sagemaker.aws/import/github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/integrations/itkwasm/DICOM_SEG.ipynb)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "c98ddf17-b608-448c-9253-cd7b806b96db",
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "c98ddf17-b608-448c-9253-cd7b806b96db",
+ "outputId": "f0c84ed1-a871-42e5-bc6f-eec881e469a9",
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "import sys\n",
+ "\n",
+ "!{sys.executable} -m pip install -q \"itkwidgets[all]>=1.0a53\" idc-index itkwasm-dicom"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "4120f9bf-e7f3-48a1-ab14-ce57b4d95621",
+ "metadata": {
+ "id": "4120f9bf-e7f3-48a1-ab14-ce57b4d95621",
+ "tags": []
+ },
+ "outputs": [],
+ "source": [
+ "from pathlib import Path\n",
+ "import glob\n",
+ "from itkwidgets import view\n",
+ "from itkwasm_dicom import read_segmentation, read_image_dicom_file_series"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fb85dba6-d7e3-4996-9f1d-7598b184ae50",
+ "metadata": {
+ "id": "fb85dba6-d7e3-4996-9f1d-7598b184ae50"
+ },
+ "source": [
+ "## Segmentation of lung cancer from CT series"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "aOnyE_7hllIl",
+ "metadata": {
+ "id": "aOnyE_7hllIl",
+ "tags": []
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "2024-10-21 19:15:03,278 - Downloading from IDC v19 index\n",
+ "2024-10-21 19:15:03,371 - Identified matching SeriesInstanceUID: ['1.3.6.1.4.1.14519.5.2.1.4334.1501.193624308604131216732637940838']\n",
+ "2024-10-21 19:15:03,386 - Total free space on disk: 47.984467968 GB\n",
+ "2024-10-21 19:15:03,442 - Not using s5cmd sync as the destination folder is empty or sync or progress bar is not requested\n",
+ "2024-10-21 19:15:03,442 - Initial size of the directory: 0 bytes\n",
+ "2024-10-21 19:15:03,443 - Approximate size of the files that need to be downloaded: 138.68 MB\n",
+ "Downloading data: 100%|█████████████████████▉| 139M/139M [00:02<00:00, 68.9MB/s]\n",
+ "2024-10-21 19:15:05,457 - Successfully downloaded files to /home/paul/src/itkwidgets-stuff/itkwidgets/examples/integrations/itkwasm\n",
+ "2024-10-21 19:15:08,299 - Downloading from IDC v19 index\n",
+ "2024-10-21 19:15:08,398 - Identified matching SeriesInstanceUID: ['1.2.276.0.7230010.3.1.3.17436516.2700181.1720647744.757708']\n",
+ "2024-10-21 19:15:08,417 - Total free space on disk: 47.84543744 GB\n",
+ "2024-10-21 19:15:08,483 - Not using s5cmd sync as the destination folder is empty or sync or progress bar is not requested\n",
+ "2024-10-21 19:15:08,483 - Initial size of the directory: 0 bytes\n",
+ "2024-10-21 19:15:08,484 - Approximate size of the files that need to be downloaded: 0.41 bytes\n",
+ "Downloading data: 99%|██████████████████████▋| 406k/410k [00:00<00:00, 810kB/s]\n",
+ "2024-10-21 19:15:08,988 - Successfully downloaded files to /home/paul/src/itkwidgets-stuff/itkwidgets/examples/integrations/itkwasm\n"
+ ]
+ }
+ ],
+ "source": [
+ "# CT series downloaded from TCIA / IDC, NSCLC Radiogenomics collection, https://www.cancerimagingarchive.net/collection/nsclc-radiogenomics/#citations\n",
+ "# Bakr, S., Gevaert, O., Echegaray, S., Ayers, K., Zhou, M., Shafiq, M., Zheng, H., Zhang, W., Leung, A., Kadoch, M., Shrager, J., Quon, A., Rubin, D., Plevritis, S., & Napel, S. (2017). Data for NSCLC Radiogenomics (Version 4) [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/K9/TCIA.2017.7hs46erv\n",
+ "!idc download 1.3.6.1.4.1.14519.5.2.1.4334.1501.193624308604131216732637940838\n",
+ "# Segmentation of this series downloaded from TCIA, IDC, BAMF under the AIMI Annotations initiative (https://zenodo.org/doi/10.5281/zenodo.8345959)\n",
+ "!idc download 1.2.276.0.7230010.3.1.3.17436516.2700181.1720647744.757708"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "a6472390-89a1-4235-8d79-f5d05b749867",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "ct_image_files = glob.glob('./nsclc_radiogenomics/AMC-010/1.3.6.1.4.1.14519.5.2.1.4334.1501.116565501097532779730890753589/CT_1.3.6.1.4.1.14519.5.2.1.4334.1501.193624308604131216732637940838/*')\n",
+ "ct_image, sorted_file_names = read_image_dicom_file_series(ct_image_files)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "0e588f46-01b4-4ae4-886b-63742d59984d",
+ "metadata": {
+ "tags": []
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Row direction: 1 0 0\n",
+ "Col direction: 0 1 0\n",
+ "Z direction: 0 0 1\n",
+ "Total frames: 76\n",
+ "Total frames with unique IPP: 76\n",
+ "Total overlapping frames: 0\n",
+ "Origin: [-348.177, -348.177, -454.93]\n",
+ "Slice extent: 245.25\n",
+ "Slice spacing: 3.26999\n",
+ "Image Orientation Patient set to : 1, 0, 0, 0, 1, 0\n",
+ "Identified 1 groups of non-overlapping segments\n"
+ ]
+ }
+ ],
+ "source": [
+ "seg_file_name = './nsclc_radiogenomics/AMC-010/1.3.6.1.4.1.14519.5.2.1.4334.1501.116565501097532779730890753589/SEG_1.2.276.0.7230010.3.1.3.17436516.2700181.1720647744.757708/1e7767a6-46f6-4685-a248-ac0eec8a0b98.dcm'\n",
+ "seg_image, seg_info = read_segmentation(seg_file_name)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "264e1ce0-dd11-4197-a033-574d601cab50",
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 567
+ },
+ "id": "264e1ce0-dd11-4197-a033-574d601cab50",
+ "outputId": "0dd9122e-599b-47ac-83ec-e2af41f1657e",
+ "tags": []
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
\n",
+ " \n",
+ " "
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/javascript": "window.connectPlugin && window.connectPlugin(\"892336ea-b595-4f5e-a028-c2ed86a3a80b\")",
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ ""
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "viewer = view(ct_image, label_image=seg_image)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "41b3e608-70f9-4d87-a7ed-eb1ef7897cee",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "viewer.set_image_color_range([-1260, 2385])\n",
+ "viewer.set_label_image_blend(0.90)\n",
+ "viewer.set_image_gradient_opacity(0.45)\n",
+ "viewer.set_image_gradient_opacity_scale(0.55)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "92990082-0c74-4305-9e8f-7e4dd02c9eaa",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "colab": {
+ "provenance": []
+ },
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.12"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}