diff --git a/.circleci/config.yml b/.circleci/config.yml index 99256f3..1183c5f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,7 @@ jobs: command: | . venv/bin/activate pip install --upgrade pip + pip install black==20.8b1 pip install -r requirements.txt --quiet pip install -r tests/requirements.txt --quiet diff --git a/demos/data/citations.txt b/demos/data/citations.txt new file mode 100644 index 0000000..fed59f7 --- /dev/null +++ b/demos/data/citations.txt @@ -0,0 +1,10 @@ +Pancreas MRI: + 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 + +Brain MRI: + URL: https://wiki.cancerimagingarchive.net/display/Public/Brain-Tumor-Progression + Citation: Schmainda KM, Prah M (2018). Data from Brain-Tumor-Progression. The Cancer Imaging Archive. http://doi.org/10.7937/K9/TCIA.2018.15quzvnb + +Lung CT: + URL: https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=70224216#70224216bcab02c187174a288dbcbf95d26179e8 + 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 \ No newline at end of file diff --git a/demos/data/ct_lung/1-01.dcm b/demos/data/ct_lung/1-01.dcm new file mode 100644 index 0000000..f3c8817 Binary files /dev/null and b/demos/data/ct_lung/1-01.dcm differ diff --git a/demos/data/ct_lung/1-02.dcm b/demos/data/ct_lung/1-02.dcm new file mode 100644 index 0000000..4b1e6a7 Binary files /dev/null and b/demos/data/ct_lung/1-02.dcm differ diff --git a/demos/data/ct_lung/1-03.dcm b/demos/data/ct_lung/1-03.dcm new file mode 100644 index 0000000..852fad4 Binary files /dev/null and b/demos/data/ct_lung/1-03.dcm differ diff --git a/demos/data/ct_lung/1-04.dcm b/demos/data/ct_lung/1-04.dcm new file mode 100644 index 0000000..0cac3cb Binary files /dev/null and b/demos/data/ct_lung/1-04.dcm differ diff --git a/demos/data/ct_lung/1-05.dcm b/demos/data/ct_lung/1-05.dcm new file mode 100644 index 0000000..d613c72 Binary files /dev/null and b/demos/data/ct_lung/1-05.dcm differ diff --git a/demos/data/ct_lung/1-06.dcm b/demos/data/ct_lung/1-06.dcm new file mode 100644 index 0000000..c9338fd Binary files /dev/null and b/demos/data/ct_lung/1-06.dcm differ diff --git a/demos/data/ct_lung/1-07.dcm b/demos/data/ct_lung/1-07.dcm new file mode 100644 index 0000000..a0f60bf Binary files /dev/null and b/demos/data/ct_lung/1-07.dcm differ diff --git a/demos/data/ct_lung/1-08.dcm b/demos/data/ct_lung/1-08.dcm new file mode 100644 index 0000000..9c1e357 Binary files /dev/null and b/demos/data/ct_lung/1-08.dcm differ diff --git a/demos/data/ct_lung/1-09.dcm b/demos/data/ct_lung/1-09.dcm new file mode 100644 index 0000000..bc6c6aa Binary files /dev/null and b/demos/data/ct_lung/1-09.dcm differ diff --git a/demos/data/ct_lung/1-10.dcm b/demos/data/ct_lung/1-10.dcm new file mode 100644 index 0000000..217cf7d Binary files /dev/null and b/demos/data/ct_lung/1-10.dcm differ diff --git a/demos/data/ct_lung/1-11.dcm b/demos/data/ct_lung/1-11.dcm new file mode 100644 index 0000000..26fbb7a Binary files /dev/null and b/demos/data/ct_lung/1-11.dcm differ diff --git a/demos/data/ct_lung/1-12.dcm b/demos/data/ct_lung/1-12.dcm new file mode 100644 index 0000000..c0ccb33 Binary files /dev/null and b/demos/data/ct_lung/1-12.dcm differ diff --git a/demos/data/ct_lung/1-13.dcm b/demos/data/ct_lung/1-13.dcm new file mode 100644 index 0000000..9c3fd07 Binary files /dev/null and b/demos/data/ct_lung/1-13.dcm differ diff --git a/demos/data/ct_lung/1-14.dcm b/demos/data/ct_lung/1-14.dcm new file mode 100644 index 0000000..6271b0f Binary files /dev/null and b/demos/data/ct_lung/1-14.dcm differ diff --git a/demos/data/ct_lung/1-15.dcm b/demos/data/ct_lung/1-15.dcm new file mode 100644 index 0000000..6b85234 Binary files /dev/null and b/demos/data/ct_lung/1-15.dcm differ diff --git a/demos/data/ct_lung/1-16.dcm b/demos/data/ct_lung/1-16.dcm new file mode 100644 index 0000000..26b06ce Binary files /dev/null and b/demos/data/ct_lung/1-16.dcm differ diff --git a/demos/data/ct_lung/1-17.dcm b/demos/data/ct_lung/1-17.dcm new file mode 100644 index 0000000..f30db30 Binary files /dev/null and b/demos/data/ct_lung/1-17.dcm differ diff --git a/demos/data/ct_lung/1-18.dcm b/demos/data/ct_lung/1-18.dcm new file mode 100644 index 0000000..985d3b9 Binary files /dev/null and b/demos/data/ct_lung/1-18.dcm differ diff --git a/demos/data/ct_lung/1-19.dcm b/demos/data/ct_lung/1-19.dcm new file mode 100644 index 0000000..dc2e63f Binary files /dev/null and b/demos/data/ct_lung/1-19.dcm differ diff --git a/demos/data/ct_lung/1-20.dcm b/demos/data/ct_lung/1-20.dcm new file mode 100644 index 0000000..2630e2d Binary files /dev/null and b/demos/data/ct_lung/1-20.dcm differ diff --git a/demos/data/ct_lung/1-21.dcm b/demos/data/ct_lung/1-21.dcm new file mode 100644 index 0000000..eab6986 Binary files /dev/null and b/demos/data/ct_lung/1-21.dcm differ diff --git a/demos/data/ct_lung/1-22.dcm b/demos/data/ct_lung/1-22.dcm new file mode 100644 index 0000000..dcea6dd Binary files /dev/null and b/demos/data/ct_lung/1-22.dcm differ diff --git a/demos/data/ct_lung/1-23.dcm b/demos/data/ct_lung/1-23.dcm new file mode 100644 index 0000000..9f6a35a Binary files /dev/null and b/demos/data/ct_lung/1-23.dcm differ diff --git a/demos/data/ct_lung/1-24.dcm b/demos/data/ct_lung/1-24.dcm new file mode 100644 index 0000000..7fc23b1 Binary files /dev/null and b/demos/data/ct_lung/1-24.dcm differ diff --git a/demos/data/ct_lung/1-25.dcm b/demos/data/ct_lung/1-25.dcm new file mode 100644 index 0000000..cb00c82 Binary files /dev/null and b/demos/data/ct_lung/1-25.dcm differ diff --git a/demos/data/ct_lung/1-26.dcm b/demos/data/ct_lung/1-26.dcm new file mode 100644 index 0000000..8745b04 Binary files /dev/null and b/demos/data/ct_lung/1-26.dcm differ diff --git a/demos/data/ct_lung/1-27.dcm b/demos/data/ct_lung/1-27.dcm new file mode 100644 index 0000000..1468d0e Binary files /dev/null and b/demos/data/ct_lung/1-27.dcm differ diff --git a/demos/data/ct_lung/1-28.dcm b/demos/data/ct_lung/1-28.dcm new file mode 100644 index 0000000..0b77c07 Binary files /dev/null and b/demos/data/ct_lung/1-28.dcm differ diff --git a/demos/data/ct_lung/1-29.dcm b/demos/data/ct_lung/1-29.dcm new file mode 100644 index 0000000..1a5ee92 Binary files /dev/null and b/demos/data/ct_lung/1-29.dcm differ diff --git a/demos/data/ct_lung/1-30.dcm b/demos/data/ct_lung/1-30.dcm new file mode 100644 index 0000000..891cf85 Binary files /dev/null and b/demos/data/ct_lung/1-30.dcm differ diff --git a/demos/data/mri_brain/1-01.dcm b/demos/data/mri_brain/1-01.dcm new file mode 100644 index 0000000..7ddbffd Binary files /dev/null and b/demos/data/mri_brain/1-01.dcm differ diff --git a/demos/data/mri_brain/1-02.dcm b/demos/data/mri_brain/1-02.dcm new file mode 100644 index 0000000..99904c6 Binary files /dev/null and b/demos/data/mri_brain/1-02.dcm differ diff --git a/demos/data/mri_brain/1-03.dcm b/demos/data/mri_brain/1-03.dcm new file mode 100644 index 0000000..4ac5696 Binary files /dev/null and b/demos/data/mri_brain/1-03.dcm differ diff --git a/demos/data/mri_brain/1-04.dcm b/demos/data/mri_brain/1-04.dcm new file mode 100644 index 0000000..264f571 Binary files /dev/null and b/demos/data/mri_brain/1-04.dcm differ diff --git a/demos/data/mri_brain/1-05.dcm b/demos/data/mri_brain/1-05.dcm new file mode 100644 index 0000000..8f70943 Binary files /dev/null and b/demos/data/mri_brain/1-05.dcm differ diff --git a/demos/data/mri_brain/1-06.dcm b/demos/data/mri_brain/1-06.dcm new file mode 100644 index 0000000..1a1fe24 Binary files /dev/null and b/demos/data/mri_brain/1-06.dcm differ diff --git a/demos/data/mri_brain/1-07.dcm b/demos/data/mri_brain/1-07.dcm new file mode 100644 index 0000000..6e975bd Binary files /dev/null and b/demos/data/mri_brain/1-07.dcm differ diff --git a/demos/data/mri_brain/1-08.dcm b/demos/data/mri_brain/1-08.dcm new file mode 100644 index 0000000..dd28498 Binary files /dev/null and b/demos/data/mri_brain/1-08.dcm differ diff --git a/demos/data/mri_brain/1-09.dcm b/demos/data/mri_brain/1-09.dcm new file mode 100644 index 0000000..5346d58 Binary files /dev/null and b/demos/data/mri_brain/1-09.dcm differ diff --git a/demos/data/mri_brain/1-10.dcm b/demos/data/mri_brain/1-10.dcm new file mode 100644 index 0000000..7644339 Binary files /dev/null and b/demos/data/mri_brain/1-10.dcm differ diff --git a/demos/data/mri_brain/1-11.dcm b/demos/data/mri_brain/1-11.dcm new file mode 100644 index 0000000..7cebd06 Binary files /dev/null and b/demos/data/mri_brain/1-11.dcm differ diff --git a/demos/data/mri_brain/1-12.dcm b/demos/data/mri_brain/1-12.dcm new file mode 100644 index 0000000..e4e47d2 Binary files /dev/null and b/demos/data/mri_brain/1-12.dcm differ diff --git a/demos/data/mri_brain/1-13.dcm b/demos/data/mri_brain/1-13.dcm new file mode 100644 index 0000000..f63c5ed Binary files /dev/null and b/demos/data/mri_brain/1-13.dcm differ diff --git a/demos/data/mri_brain/1-14.dcm b/demos/data/mri_brain/1-14.dcm new file mode 100644 index 0000000..d2a8763 Binary files /dev/null and b/demos/data/mri_brain/1-14.dcm differ diff --git a/demos/data/mri_brain/1-15.dcm b/demos/data/mri_brain/1-15.dcm new file mode 100644 index 0000000..8bc2c17 Binary files /dev/null and b/demos/data/mri_brain/1-15.dcm differ diff --git a/demos/data/mri_brain/1-16.dcm b/demos/data/mri_brain/1-16.dcm new file mode 100644 index 0000000..bcdfef1 Binary files /dev/null and b/demos/data/mri_brain/1-16.dcm differ diff --git a/demos/data/mri_brain/1-17.dcm b/demos/data/mri_brain/1-17.dcm new file mode 100644 index 0000000..a8efa01 Binary files /dev/null and b/demos/data/mri_brain/1-17.dcm differ diff --git a/demos/data/mri_brain/1-18.dcm b/demos/data/mri_brain/1-18.dcm new file mode 100644 index 0000000..6411bda Binary files /dev/null and b/demos/data/mri_brain/1-18.dcm differ diff --git a/demos/data/mri_brain/1-19.dcm b/demos/data/mri_brain/1-19.dcm new file mode 100644 index 0000000..a82e857 Binary files /dev/null and b/demos/data/mri_brain/1-19.dcm differ diff --git a/demos/data/mri_brain/1-20.dcm b/demos/data/mri_brain/1-20.dcm new file mode 100644 index 0000000..f501e4b Binary files /dev/null and b/demos/data/mri_brain/1-20.dcm differ diff --git a/demos/data/mri_brain/1-21.dcm b/demos/data/mri_brain/1-21.dcm new file mode 100644 index 0000000..28a55eb Binary files /dev/null and b/demos/data/mri_brain/1-21.dcm differ diff --git a/demos/data/mri_brain/1-22.dcm b/demos/data/mri_brain/1-22.dcm new file mode 100644 index 0000000..a81622a Binary files /dev/null and b/demos/data/mri_brain/1-22.dcm differ diff --git a/demos/data/mri_brain/1-23.dcm b/demos/data/mri_brain/1-23.dcm new file mode 100644 index 0000000..2d727aa Binary files /dev/null and b/demos/data/mri_brain/1-23.dcm differ diff --git a/demos/data/mri_brain/1-24.dcm b/demos/data/mri_brain/1-24.dcm new file mode 100644 index 0000000..4901c7a Binary files /dev/null and b/demos/data/mri_brain/1-24.dcm differ diff --git a/demos/data/mri_pancreas/1-01.dcm b/demos/data/mri_pancreas/1-01.dcm new file mode 100644 index 0000000..26ad7dd Binary files /dev/null and b/demos/data/mri_pancreas/1-01.dcm differ diff --git a/demos/data/mri_pancreas/1-02.dcm b/demos/data/mri_pancreas/1-02.dcm new file mode 100644 index 0000000..e063636 Binary files /dev/null and b/demos/data/mri_pancreas/1-02.dcm differ diff --git a/demos/data/mri_pancreas/1-03.dcm b/demos/data/mri_pancreas/1-03.dcm new file mode 100644 index 0000000..ff05b54 Binary files /dev/null and b/demos/data/mri_pancreas/1-03.dcm differ diff --git a/demos/data/mri_pancreas/1-04.dcm b/demos/data/mri_pancreas/1-04.dcm new file mode 100644 index 0000000..1611d86 Binary files /dev/null and b/demos/data/mri_pancreas/1-04.dcm differ diff --git a/demos/data/mri_pancreas/1-05.dcm b/demos/data/mri_pancreas/1-05.dcm new file mode 100644 index 0000000..562dd6a Binary files /dev/null and b/demos/data/mri_pancreas/1-05.dcm differ diff --git a/demos/data/mri_pancreas/1-06.dcm b/demos/data/mri_pancreas/1-06.dcm new file mode 100644 index 0000000..56b3062 Binary files /dev/null and b/demos/data/mri_pancreas/1-06.dcm differ diff --git a/demos/data/mri_pancreas/1-07.dcm b/demos/data/mri_pancreas/1-07.dcm new file mode 100644 index 0000000..31f5629 Binary files /dev/null and b/demos/data/mri_pancreas/1-07.dcm differ diff --git a/demos/data/mri_pancreas/1-08.dcm b/demos/data/mri_pancreas/1-08.dcm new file mode 100644 index 0000000..42bcdbe Binary files /dev/null and b/demos/data/mri_pancreas/1-08.dcm differ diff --git a/demos/data/mri_pancreas/1-09.dcm b/demos/data/mri_pancreas/1-09.dcm new file mode 100644 index 0000000..4cea3a1 Binary files /dev/null and b/demos/data/mri_pancreas/1-09.dcm differ diff --git a/demos/data/mri_pancreas/1-10.dcm b/demos/data/mri_pancreas/1-10.dcm new file mode 100644 index 0000000..5d1e888 Binary files /dev/null and b/demos/data/mri_pancreas/1-10.dcm differ diff --git a/demos/data/mri_pancreas/1-11.dcm b/demos/data/mri_pancreas/1-11.dcm new file mode 100644 index 0000000..68c322b Binary files /dev/null and b/demos/data/mri_pancreas/1-11.dcm differ diff --git a/demos/data/mri_pancreas/1-12.dcm b/demos/data/mri_pancreas/1-12.dcm new file mode 100644 index 0000000..b1f3d33 Binary files /dev/null and b/demos/data/mri_pancreas/1-12.dcm differ diff --git a/demos/data/mri_pancreas/1-13.dcm b/demos/data/mri_pancreas/1-13.dcm new file mode 100644 index 0000000..a4ad705 Binary files /dev/null and b/demos/data/mri_pancreas/1-13.dcm differ diff --git a/demos/data/mri_pancreas/1-14.dcm b/demos/data/mri_pancreas/1-14.dcm new file mode 100644 index 0000000..b18da47 Binary files /dev/null and b/demos/data/mri_pancreas/1-14.dcm differ diff --git a/demos/data/mri_pancreas/1-15.dcm b/demos/data/mri_pancreas/1-15.dcm new file mode 100644 index 0000000..783516b Binary files /dev/null and b/demos/data/mri_pancreas/1-15.dcm differ diff --git a/demos/data/mri_pancreas/1-16.dcm b/demos/data/mri_pancreas/1-16.dcm new file mode 100644 index 0000000..36324de Binary files /dev/null and b/demos/data/mri_pancreas/1-16.dcm differ diff --git a/demos/data/mri_pancreas/1-17.dcm b/demos/data/mri_pancreas/1-17.dcm new file mode 100644 index 0000000..1addcd4 Binary files /dev/null and b/demos/data/mri_pancreas/1-17.dcm differ diff --git a/demos/data/mri_pancreas/1-18.dcm b/demos/data/mri_pancreas/1-18.dcm new file mode 100644 index 0000000..4ff943b Binary files /dev/null and b/demos/data/mri_pancreas/1-18.dcm differ diff --git a/demos/data/mri_pancreas/1-19.dcm b/demos/data/mri_pancreas/1-19.dcm new file mode 100644 index 0000000..26ae9bd Binary files /dev/null and b/demos/data/mri_pancreas/1-19.dcm differ diff --git a/demos/data/mri_pancreas/1-20.dcm b/demos/data/mri_pancreas/1-20.dcm new file mode 100644 index 0000000..d0272a5 Binary files /dev/null and b/demos/data/mri_pancreas/1-20.dcm differ diff --git a/demos/data/mri_pancreas/1-21.dcm b/demos/data/mri_pancreas/1-21.dcm new file mode 100644 index 0000000..e8e51fe Binary files /dev/null and b/demos/data/mri_pancreas/1-21.dcm differ diff --git a/demos/data/mri_pancreas/1-22.dcm b/demos/data/mri_pancreas/1-22.dcm new file mode 100644 index 0000000..4ad44f0 Binary files /dev/null and b/demos/data/mri_pancreas/1-22.dcm differ diff --git a/demos/data/mri_pancreas/1-23.dcm b/demos/data/mri_pancreas/1-23.dcm new file mode 100644 index 0000000..6c2d63e Binary files /dev/null and b/demos/data/mri_pancreas/1-23.dcm differ diff --git a/demos/data/mri_pancreas/1-24.dcm b/demos/data/mri_pancreas/1-24.dcm new file mode 100644 index 0000000..110cc99 Binary files /dev/null and b/demos/data/mri_pancreas/1-24.dcm differ diff --git a/demos/data/mri_pancreas/1-25.dcm b/demos/data/mri_pancreas/1-25.dcm new file mode 100644 index 0000000..a72653f Binary files /dev/null and b/demos/data/mri_pancreas/1-25.dcm differ diff --git a/demos/data/mri_pancreas/1-26.dcm b/demos/data/mri_pancreas/1-26.dcm new file mode 100644 index 0000000..6ebedd8 Binary files /dev/null and b/demos/data/mri_pancreas/1-26.dcm differ diff --git a/demos/data/mri_pancreas/1-27.dcm b/demos/data/mri_pancreas/1-27.dcm new file mode 100644 index 0000000..abe2f26 Binary files /dev/null and b/demos/data/mri_pancreas/1-27.dcm differ diff --git a/demos/data/mri_pancreas/1-28.dcm b/demos/data/mri_pancreas/1-28.dcm new file mode 100644 index 0000000..a947db4 Binary files /dev/null and b/demos/data/mri_pancreas/1-28.dcm differ diff --git a/demos/data/mri_pancreas/1-29.dcm b/demos/data/mri_pancreas/1-29.dcm new file mode 100644 index 0000000..030cfea Binary files /dev/null and b/demos/data/mri_pancreas/1-29.dcm differ diff --git a/demos/data/mri_pancreas/1-30.dcm b/demos/data/mri_pancreas/1-30.dcm new file mode 100644 index 0000000..cac2375 Binary files /dev/null and b/demos/data/mri_pancreas/1-30.dcm differ diff --git a/demos/data/mri_pancreas/1-31.dcm b/demos/data/mri_pancreas/1-31.dcm new file mode 100644 index 0000000..3cfe8be Binary files /dev/null and b/demos/data/mri_pancreas/1-31.dcm differ diff --git a/demos/data/mri_pancreas/1-32.dcm b/demos/data/mri_pancreas/1-32.dcm new file mode 100644 index 0000000..1158ca1 Binary files /dev/null and b/demos/data/mri_pancreas/1-32.dcm differ diff --git a/demos/data/mri_pancreas/1-33.dcm b/demos/data/mri_pancreas/1-33.dcm new file mode 100644 index 0000000..a1d24b4 Binary files /dev/null and b/demos/data/mri_pancreas/1-33.dcm differ diff --git a/demos/data/mri_pancreas/1-34.dcm b/demos/data/mri_pancreas/1-34.dcm new file mode 100644 index 0000000..6534837 Binary files /dev/null and b/demos/data/mri_pancreas/1-34.dcm differ diff --git a/demos/data/mri_pancreas/1-35.dcm b/demos/data/mri_pancreas/1-35.dcm new file mode 100644 index 0000000..b5f431e Binary files /dev/null and b/demos/data/mri_pancreas/1-35.dcm differ diff --git a/demos/data/mri_pancreas/1-36.dcm b/demos/data/mri_pancreas/1-36.dcm new file mode 100644 index 0000000..4773368 Binary files /dev/null and b/demos/data/mri_pancreas/1-36.dcm differ diff --git a/demos/dicom-ct-lung/README.md b/demos/dicom-ct-lung/README.md new file mode 100644 index 0000000..647e346 --- /dev/null +++ b/demos/dicom-ct-lung/README.md @@ -0,0 +1,16 @@ +# Visualizing MRi volumes from dicom files + +![Image demo](./demo.jpg) + +## Instructions + +See instructions from [README.md](../../README.md) to create a virtual environment and install the dependencies. + + +## Acknowledgements + +Dataset: [Lung CT](https://wiki.cancerimagingarchive.net/pages/viewpage.action?pageId=70224216#70224216bcab02c187174a288dbcbf95d26179e8) + +``` +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 +``` \ No newline at end of file diff --git a/demos/dicom-ct-lung/app.py b/demos/dicom-ct-lung/app.py new file mode 100644 index 0000000..63f73dd --- /dev/null +++ b/demos/dicom-ct-lung/app.py @@ -0,0 +1,38 @@ +import os + +import dash +import dash_html_components as html +import itk + +import dash_vtk +from dash_vtk.utils import to_volume_state + +# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc. +demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +itk_image = itk.imread(os.path.join(demo_dir, "data", "ct_lung")) + +# Convert itk.Image to vtkImageData +vtk_image = itk.vtk_image_from_image(itk_image) +volume_state = to_volume_state(vtk_image) + + +vtk_view = dash_vtk.View( + dash_vtk.VolumeRepresentation( + children=[ + dash_vtk.VolumeController(), + dash_vtk.Volume(state=volume_state), + ] + ) +) + +app = dash.Dash(__name__) +server = app.server + +app.layout = html.Div( + style={"height": "calc(100vh - 50px)", "width": "100%"}, + children=[html.Div(vtk_view, style={"height": "100%", "width": "100%"})], +) + + +if __name__ == "__main__": + app.run_server(debug=True) diff --git a/demos/dicom-ct-lung/demo.jpg b/demos/dicom-ct-lung/demo.jpg new file mode 100644 index 0000000..d912044 Binary files /dev/null and b/demos/dicom-ct-lung/demo.jpg differ diff --git a/demos/dicom-ct-lung/requirements.txt b/demos/dicom-ct-lung/requirements.txt new file mode 100644 index 0000000..8acaf0b --- /dev/null +++ b/demos/dicom-ct-lung/requirements.txt @@ -0,0 +1,6 @@ +# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi: +dash-vtk +dash-bootstrap-components +vtk +numpy +itk==5.2rc1 \ No newline at end of file diff --git a/demos/dicom-mri-brain/README.md b/demos/dicom-mri-brain/README.md new file mode 100644 index 0000000..fd06045 --- /dev/null +++ b/demos/dicom-mri-brain/README.md @@ -0,0 +1,18 @@ +# Visualizing CT Scans as volume from dicom files + +![Image demo](./demo.jpg) + +## Instructions + +See instructions from [README.md](../../README.md) to create a virtual environment and install the dependencies. + + +## Acknowledgements + +The datasets used here include: + +[Brain MRI](https://wiki.cancerimagingarchive.net/display/Public/Brain-Tumor-Progression) + +``` +Citation: Schmainda KM, Prah M (2018). Data from Brain-Tumor-Progression. The Cancer Imaging Archive. http://doi.org/10.7937/K9/TCIA.2018.15quzvnb +``` diff --git a/demos/dicom-mri-brain/app.py b/demos/dicom-mri-brain/app.py new file mode 100644 index 0000000..792172f --- /dev/null +++ b/demos/dicom-mri-brain/app.py @@ -0,0 +1,40 @@ +import os + +import dash +import dash_html_components as html +import dash_bootstrap_components as dbc +import itk + +import dash_vtk +from dash_vtk.utils import to_volume_state + + +def dcm_to_volume(dir_path): + itk_image = itk.imread(dir_path) + vtk_image = itk.vtk_image_from_image(itk_image) + volume_state = to_volume_state(vtk_image) + + return volume_state + + +# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc. +demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +volume_state = dcm_to_volume(os.path.join(demo_dir, "data", "mri_brain")) + +app = dash.Dash(__name__) +server = app.server + +vtk_view = dash_vtk.View( + dash_vtk.VolumeRepresentation( + [dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state)] + ) +) + +app.layout = html.Div( + style={"height": "calc(100vh - 50px)", "width": "100%"}, + children=[html.Div(style={"height": "100%", "width": "100%"}, children=vtk_view)], +) + + +if __name__ == "__main__": + app.run_server(debug=True) diff --git a/demos/dicom-mri-brain/demo.jpg b/demos/dicom-mri-brain/demo.jpg new file mode 100644 index 0000000..e1c9f0b Binary files /dev/null and b/demos/dicom-mri-brain/demo.jpg differ diff --git a/demos/dicom-mri-brain/requirements.txt b/demos/dicom-mri-brain/requirements.txt new file mode 100644 index 0000000..8acaf0b --- /dev/null +++ b/demos/dicom-mri-brain/requirements.txt @@ -0,0 +1,6 @@ +# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi: +dash-vtk +dash-bootstrap-components +vtk +numpy +itk==5.2rc1 \ No newline at end of file diff --git a/demos/dicom-mri-pancreas/README.md b/demos/dicom-mri-pancreas/README.md new file mode 100644 index 0000000..22e8495 --- /dev/null +++ b/demos/dicom-mri-pancreas/README.md @@ -0,0 +1,17 @@ +# Visualizing MRi volumes from dicom files + +![Image demo](./demo.jpg) + +## Instructions + +See instructions from [README.md](../../README.md) to create a virtual environment and install the dependencies. + + +## Acknowledgements + +The datasets used here include: + +[Pancreas MRI](https://wiki.cancerimagingarchive.net/display/Public/Imaging+characterization+of+a+metastatic+patient+derived+model+of+adenocarcinoma+pancreas%3A+PDMR-292921-168-R) +``` +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 +``` \ No newline at end of file diff --git a/demos/dicom-mri-pancreas/app.py b/demos/dicom-mri-pancreas/app.py new file mode 100644 index 0000000..3667904 --- /dev/null +++ b/demos/dicom-mri-pancreas/app.py @@ -0,0 +1,40 @@ +import os + +import dash +import dash_html_components as html +import dash_bootstrap_components as dbc +import itk + +import dash_vtk +from dash_vtk.utils import to_volume_state + + +def dcm_to_volume(dir_path): + itk_image = itk.imread(dir_path) + vtk_image = itk.vtk_image_from_image(itk_image) + volume_state = to_volume_state(vtk_image) + + return volume_state + + +# Place a DICOM series (a set of per-file slices) in a directory. ITK sorts, sets spatial metadata, etc. +demo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +volume_state = dcm_to_volume(os.path.join(demo_dir, "data", "mri_pancreas")) + +app = dash.Dash(__name__) +server = app.server + +vtk_view = dash_vtk.View( + dash_vtk.VolumeRepresentation( + [dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state)] + ) +) + +app.layout = html.Div( + style={"height": "calc(100vh - 50px)", "width": "100%"}, + children=[html.Div(style={"height": "100%", "width": "100%"}, children=vtk_view)], +) + + +if __name__ == "__main__": + app.run_server(debug=True) diff --git a/demos/dicom-mri-pancreas/demo.jpg b/demos/dicom-mri-pancreas/demo.jpg new file mode 100644 index 0000000..f156560 Binary files /dev/null and b/demos/dicom-mri-pancreas/demo.jpg differ diff --git a/demos/dicom-mri-pancreas/requirements.txt b/demos/dicom-mri-pancreas/requirements.txt new file mode 100644 index 0000000..8acaf0b --- /dev/null +++ b/demos/dicom-mri-pancreas/requirements.txt @@ -0,0 +1,6 @@ +# If you skipped `pip install -e ../../`, the package below will be retrieved from pypi: +dash-vtk +dash-bootstrap-components +vtk +numpy +itk==5.2rc1 \ No newline at end of file diff --git a/demos/pyvista-terrain-following-mesh/app.py b/demos/pyvista-terrain-following-mesh/app.py index b6dc359..e74fd08 100644 --- a/demos/pyvista-terrain-following-mesh/app.py +++ b/demos/pyvista-terrain-following-mesh/app.py @@ -68,7 +68,9 @@ def updateWarp(factor=1): ], colorMapPreset="erdc_blue2green_muted", colorDataRange=color_range, - property={"edgeVisibility": True,}, + property={ + "edgeVisibility": True, + }, ) ], ) diff --git a/demos/requirements.txt b/demos/requirements.txt index d9537cc..9b638f4 100644 --- a/demos/requirements.txt +++ b/demos/requirements.txt @@ -5,4 +5,7 @@ -r ./volume-rendering/requirements.txt -r ./usage-vtk-cfd/requirements.txt -r ./usage-algorithm/requirements.txt --r ./synthetic-volume-rendering/requirements.txt \ No newline at end of file +-r ./synthetic-volume-rendering/requirements.txt +-r ./dicom-ct-lung/requirements.txt +-r ./dicom-mri-brain/requirements.txt +-r ./dicom-mri-pancreas/requirements.txt \ No newline at end of file diff --git a/demos/slice-rendering/app.py b/demos/slice-rendering/app.py index 8cabb0b..3340f90 100644 --- a/demos/slice-rendering/app.py +++ b/demos/slice-rendering/app.py @@ -85,7 +85,11 @@ children=[ html.Div( style={"height": "20%", "display": "flex", "align-items": "center"}, - children=[html.Br(), controls, html.Br(),], + children=[ + html.Br(), + controls, + html.Br(), + ], ), html.Div(slice_view, style={"height": "80%"}), ], diff --git a/demos/usage-algorithm/app.py b/demos/usage-algorithm/app.py index 04176f3..b164f9f 100644 --- a/demos/usage-algorithm/app.py +++ b/demos/usage-algorithm/app.py @@ -63,7 +63,10 @@ dbc.Col( width=8, children=[ - html.Div(vtk_view, style={"height": "100%", "width": "100%"},) + html.Div( + vtk_view, + style={"height": "100%", "width": "100%"}, + ) ], ), ], diff --git a/demos/usage-vtk-cfd/app.py b/demos/usage-vtk-cfd/app.py index 92f9bb2..97a15bf 100644 --- a/demos/usage-vtk-cfd/app.py +++ b/demos/usage-vtk-cfd/app.py @@ -115,20 +115,36 @@ def getSeedState(self): children=[ dash_vtk.GeometryRepresentation( id="bike-rep", - children=[dash_vtk.Mesh(id="bike", state=viz.getBikeMesh(),)], + children=[ + dash_vtk.Mesh( + id="bike", + state=viz.getBikeMesh(), + ) + ], ), dash_vtk.GeometryRepresentation( id="tubes-rep", colorMapPreset="erdc_rainbow_bright", colorDataRange=viz.getColorRange(), - children=[dash_vtk.Mesh(id="tubes-mesh", state=viz.getTubesMesh("p"),)], + children=[ + dash_vtk.Mesh( + id="tubes-mesh", + state=viz.getTubesMesh("p"), + ) + ], ), dash_vtk.GeometryRepresentation( id="seed-rep", - property={"color": [0.8, 0, 0], "representation": 0, "pointSize": 8,}, + property={ + "color": [0.8, 0, 0], + "representation": 0, + "pointSize": 8, + }, children=[ dash_vtk.Algorithm( - id="seed-line", vtkClass="vtkLineSource", state=viz.getSeedState(), + id="seed-line", + vtkClass="vtkLineSource", + state=viz.getSeedState(), ) ], ), diff --git a/demos/volume-rendering/app.py b/demos/volume-rendering/app.py index ed7502b..fdc323e 100644 --- a/demos/volume-rendering/app.py +++ b/demos/volume-rendering/app.py @@ -20,7 +20,10 @@ vtk_view = dash_vtk.View( dash_vtk.VolumeRepresentation( - children=[dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state),] + children=[ + dash_vtk.VolumeController(), + dash_vtk.Volume(state=volume_state), + ] ) ) diff --git a/tests/test_render.py b/tests/test_render.py index 7f337f8..d5c4c88 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -19,8 +19,11 @@ def take_snapshot(dash_duo, name): names = [ "usage", "demos.pyvista-terrain-following-mesh.app", - "demos.slice-rendering.app", "demos.pyvista-point-cloud.app", + "demos.dicom-ct-lung.app", + "demos.dicom-mri-brain.app", + "demos.dicom-mri-pancreas.app", + "demos.slice-rendering.app", "demos.volume-rendering.app", "demos.usage-vtk-cfd.app", "demos.usage-algorithm.app",