Skip to content

Commit b48ef5b

Browse files
author
Xing Han Lu
authored
Add 3 new demos using dicom (#24)
* Add ct scan data * Update data * Add mri examples * Update CT data * Add ct lung demo * Update requirements for itk * Apply black to demos * Add dicom demos to tests * Remove whole body data * Update demos requirements * Fix black version * Add acknowledgements * Add acknowledgements
1 parent bf93c7b commit b48ef5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+242
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
command: |
2525
. venv/bin/activate
2626
pip install --upgrade pip
27+
pip install black==20.8b1
2728
pip install -r requirements.txt --quiet
2829
pip install -r tests/requirements.txt --quiet
2930

demos/data/citations.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Pancreas MRI:
2+
Citation: Tatum, J., Kalen, J., Ileva, lilia, L, R., S, K., N, P., Jacobs, P., Sanders, C., A, J., Difilippantonio, S., L, T., hollingshead, melinda, J, P., Y, E., Clunie, D., Y, L., Suloway, C., Smith, K., U, W., … Doroshow, J. (n.d.). Imaging characterization of a metastatic patient derived model of adenocarcinoma pancreas: PDMR-292921-168-R. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.2020.PCAK-8Z10
3+
4+
Brain MRI:
5+
URL: https://wiki.cancerimagingarchive.net/display/Public/Brain-Tumor-Progression
6+
Citation: Schmainda KM, Prah M (2018). Data from Brain-Tumor-Progression. The Cancer Imaging Archive. http://doi.org/10.7937/K9/TCIA.2018.15quzvnb
7+
8+
Lung CT:
9+
URL: https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=70224216#70224216bcab02c187174a288dbcbf95d26179e8
10+
Citation: Li, P., Wang, S., Li, T., Lu, J., HuangFu, Y., & Wang, D. (2020). A Large-Scale CT and PET/CT Dataset for Lung Cancer Diagnosis [Data set]. The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.2020.NNC2-0461

demos/data/ct_lung/1-01.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-02.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-03.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-04.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-05.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-06.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-07.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-08.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-09.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-10.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-11.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-12.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-13.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-14.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-15.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-16.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-17.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-18.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-19.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-20.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-21.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-22.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-23.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-24.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-25.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-26.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-27.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-28.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-29.dcm

515 KB
Binary file not shown.

demos/data/ct_lung/1-30.dcm

515 KB
Binary file not shown.

demos/data/mri_brain/1-01.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-02.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-03.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-04.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-05.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-06.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-07.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-08.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-09.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-10.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-11.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-12.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-13.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-14.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-15.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-16.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-17.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-18.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-19.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-20.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-21.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-22.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-23.dcm

166 KB
Binary file not shown.

demos/data/mri_brain/1-24.dcm

166 KB
Binary file not shown.

demos/data/mri_pancreas/1-01.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-02.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-03.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-04.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-05.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-06.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-07.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-08.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-09.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-10.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-11.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-12.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-13.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-14.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-15.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-16.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-17.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-18.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-19.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-20.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-21.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-22.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-23.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-24.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-25.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-26.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-27.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-28.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-29.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-30.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-31.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-32.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-33.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-34.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-35.dcm

611 KB
Binary file not shown.

demos/data/mri_pancreas/1-36.dcm

611 KB
Binary file not shown.

demos/dicom-ct-lung/README.md

Lines changed: 16 additions & 0 deletions

demos/dicom-ct-lung/app.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os
2+
3+
import dash
4+
import dash_html_components as html
5+
import itk
6+
7+
import dash_vtk
8+
from dash_vtk.utils import to_volume_state
9+
10+
# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc.
11+
demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
12+
itk_image = itk.imread(os.path.join(demo_dir, "data", "ct_lung"))
13+
14+
# Convert itk.Image to vtkImageData
15+
vtk_image = itk.vtk_image_from_image(itk_image)
16+
volume_state = to_volume_state(vtk_image)
17+
18+
19+
vtk_view = dash_vtk.View(
20+
dash_vtk.VolumeRepresentation(
21+
children=[
22+
dash_vtk.VolumeController(),
23+
dash_vtk.Volume(state=volume_state),
24+
]
25+
)
26+
)
27+
28+
app = dash.Dash(__name__)
29+
server = app.server
30+
31+
app.layout = html.Div(
32+
style={"height": "calc(100vh - 50px)", "width": "100%"},
33+
children=[html.Div(vtk_view, style={"height": "100%", "width": "100%"})],
34+
)
35+
36+
37+
if __name__ == "__main__":
38+
app.run_server(debug=True)

demos/dicom-ct-lung/demo.jpg

122 KB

demos/dicom-ct-lung/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi:
2+
dash-vtk
3+
dash-bootstrap-components
4+
vtk
5+
numpy
6+
itk==5.2rc1

demos/dicom-mri-brain/README.md

Lines changed: 18 additions & 0 deletions

demos/dicom-mri-brain/app.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
3+
import dash
4+
import dash_html_components as html
5+
import dash_bootstrap_components as dbc
6+
import itk
7+
8+
import dash_vtk
9+
from dash_vtk.utils import to_volume_state
10+
11+
12+
def dcm_to_volume(dir_path):
13+
itk_image = itk.imread(dir_path)
14+
vtk_image = itk.vtk_image_from_image(itk_image)
15+
volume_state = to_volume_state(vtk_image)
16+
17+
return volume_state
18+
19+
20+
# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc.
21+
demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
22+
volume_state = dcm_to_volume(os.path.join(demo_dir, "data", "mri_brain"))
23+
24+
app = dash.Dash(__name__)
25+
server = app.server
26+
27+
vtk_view = dash_vtk.View(
28+
dash_vtk.VolumeRepresentation(
29+
[dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state)]
30+
)
31+
)
32+
33+
app.layout = html.Div(
34+
style={"height": "calc(100vh - 50px)", "width": "100%"},
35+
children=[html.Div(style={"height": "100%", "width": "100%"}, children=vtk_view)],
36+
)
37+
38+
39+
if __name__ == "__main__":
40+
app.run_server(debug=True)

demos/dicom-mri-brain/demo.jpg

128 KB
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi:
2+
dash-vtk
3+
dash-bootstrap-components
4+
vtk
5+
numpy
6+
itk==5.2rc1

demos/dicom-mri-pancreas/README.md

Lines changed: 17 additions & 0 deletions

demos/dicom-mri-pancreas/app.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
3+
import dash
4+
import dash_html_components as html
5+
import dash_bootstrap_components as dbc
6+
import itk
7+
8+
import dash_vtk
9+
from dash_vtk.utils import to_volume_state
10+
11+
12+
def dcm_to_volume(dir_path):
13+
itk_image = itk.imread(dir_path)
14+
vtk_image = itk.vtk_image_from_image(itk_image)
15+
volume_state = to_volume_state(vtk_image)
16+
17+
return volume_state
18+
19+
20+
# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc.
21+
demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
22+
volume_state = dcm_to_volume(os.path.join(demo_dir, "data", "mri_pancreas"))
23+
24+
app = dash.Dash(__name__)
25+
server = app.server
26+
27+
vtk_view = dash_vtk.View(
28+
dash_vtk.VolumeRepresentation(
29+
[dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state)]
30+
)
31+
)
32+
33+
app.layout = html.Div(
34+
style={"height": "calc(100vh - 50px)", "width": "100%"},
35+
children=[html.Div(style={"height": "100%", "width": "100%"}, children=vtk_view)],
36+
)
37+
38+
39+
if __name__ == "__main__":
40+
app.run_server(debug=True)

demos/dicom-mri-pancreas/demo.jpg

110 KB
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi:
2+
dash-vtk
3+
dash-bootstrap-components
4+
vtk
5+
numpy
6+
itk==5.2rc1

demos/pyvista-terrain-following-mesh/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def updateWarp(factor=1):
6868
],
6969
colorMapPreset="erdc_blue2green_muted",
7070
colorDataRange=color_range,
71-
property={"edgeVisibility": True,},
71+
property={
72+
"edgeVisibility": True,
73+
},
7274
)
7375
],
7476
)

demos/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
-r ./volume-rendering/requirements.txt
66
-r ./usage-vtk-cfd/requirements.txt
77
-r ./usage-algorithm/requirements.txt
8-
-r ./synthetic-volume-rendering/requirements.txt
8+
-r ./synthetic-volume-rendering/requirements.txt
9+
-r ./dicom-ct-lung/requirements.txt
10+
-r ./dicom-mri-brain/requirements.txt
11+
-r ./dicom-mri-pancreas/requirements.txt

demos/slice-rendering/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@
8585
children=[
8686
html.Div(
8787
style={"height": "20%", "display": "flex", "align-items": "center"},
88-
children=[html.Br(), controls, html.Br(),],
88+
children=[
89+
html.Br(),
90+
controls,
91+
html.Br(),
92+
],
8993
),
9094
html.Div(slice_view, style={"height": "80%"}),
9195
],

demos/usage-algorithm/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
dbc.Col(
6464
width=8,
6565
children=[
66-
html.Div(vtk_view, style={"height": "100%", "width": "100%"},)
66+
html.Div(
67+
vtk_view,
68+
style={"height": "100%", "width": "100%"},
69+
)
6770
],
6871
),
6972
],

demos/usage-vtk-cfd/app.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,36 @@ def getSeedState(self):
115115
children=[
116116
dash_vtk.GeometryRepresentation(
117117
id="bike-rep",
118-
children=[dash_vtk.Mesh(id="bike", state=viz.getBikeMesh(),)],
118+
children=[
119+
dash_vtk.Mesh(
120+
id="bike",
121+
state=viz.getBikeMesh(),
122+
)
123+
],
119124
),
120125
dash_vtk.GeometryRepresentation(
121126
id="tubes-rep",
122127
colorMapPreset="erdc_rainbow_bright",
123128
colorDataRange=viz.getColorRange(),
124-
children=[dash_vtk.Mesh(id="tubes-mesh", state=viz.getTubesMesh("p"),)],
129+
children=[
130+
dash_vtk.Mesh(
131+
id="tubes-mesh",
132+
state=viz.getTubesMesh("p"),
133+
)
134+
],
125135
),
126136
dash_vtk.GeometryRepresentation(
127137
id="seed-rep",
128-
property={"color": [0.8, 0, 0], "representation": 0, "pointSize": 8,},
138+
property={
139+
"color": [0.8, 0, 0],
140+
"representation": 0,
141+
"pointSize": 8,
142+
},
129143
children=[
130144
dash_vtk.Algorithm(
131-
id="seed-line", vtkClass="vtkLineSource", state=viz.getSeedState(),
145+
id="seed-line",
146+
vtkClass="vtkLineSource",
147+
state=viz.getSeedState(),
132148
)
133149
],
134150
),

demos/volume-rendering/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
vtk_view = dash_vtk.View(
2222
dash_vtk.VolumeRepresentation(
23-
children=[dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state),]
23+
children=[
24+
dash_vtk.VolumeController(),
25+
dash_vtk.Volume(state=volume_state),
26+
]
2427
)
2528
)
2629

tests/test_render.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ def take_snapshot(dash_duo, name):
1919
names = [
2020
"usage",
2121
"demos.pyvista-terrain-following-mesh.app",
22-
"demos.slice-rendering.app",
2322
"demos.pyvista-point-cloud.app",
23+
"demos.dicom-ct-lung.app",
24+
"demos.dicom-mri-brain.app",
25+
"demos.dicom-mri-pancreas.app",
26+
"demos.slice-rendering.app",
2427
"demos.volume-rendering.app",
2528
"demos.usage-vtk-cfd.app",
2629
"demos.usage-algorithm.app",

0 commit comments

Comments
 (0)