Skip to content

Commit 9cc6e3f

Browse files
Add DICOM support (#1014)
* Add pims dicom reader, testdata and test for reading the dicom file. * Run formatter. * Use bioformats instead of dicom reader and add example in docs. * Add list of suffixes supported by bioformats. * Add test cassette for upload dicom example. * Update changelog. * Update test cassette for upload dicom stack example. * Update webknossos/webknossos/dataset/_utils/pims_images.py Co-authored-by: Tom Herold <[email protected]> --------- Co-authored-by: Tom Herold <[email protected]>
1 parent c68f9a8 commit 9cc6e3f

File tree

21 files changed

+1060
-6
lines changed

21 files changed

+1060
-6
lines changed

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ nav:
9090
- Dataset Examples:
9191
- webknossos-py/examples/dataset_usage.md
9292
- webknossos-py/examples/upload_tiff_stack.md
93+
- webknossos-py/examples/upload_dicom_stack.md
9394
- webknossos-py/examples/upload_image_data.md
9495
- webknossos-py/examples/create_dataset_from_images.md
9596
- webknossos-py/examples/image_stack_to_dataset.md
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Upload DICOM stack
2+
3+
To convert a DICOM image stack to a WEBKNOSSOS dataset and upload it to [webknossos.org](https://webknossos.org) the bioformats reader is necessary. This example shows how to [create a new dataset from a dicom sequence](../../api/webknossos/dataset/dataset.md#Dataset.from_images), [compress](../../api/webknossos/dataset/dataset.md#Dataset.compress) it and [upload](../../api/webknossos/dataset/dataset.md#Dataset.upload) it to WEBKNOSSOS.
4+
5+
```python
6+
--8<--
7+
webknossos/examples/upload_dicom_stack.py
8+
--8<--
9+
```

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
1616

1717
### Added
1818
- Add CLI tool for offline merging of zip annotations with fallback datasets. [#996](https://github.com/scalableminds/webknossos-libs/pull/996)
19+
- Added support for converting new file formats such as DICOM, using the bioformats reader. [#1014](https://github.com/scalableminds/webknossos-libs/pull/1014)
1920

2021
### Changed
2122
- The rules for naming the layers have been tightened to match the allowed layer names on webknossos. [#1016](https://github.com/scalableminds/webknossos-libs/pull/1016)

webknossos/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ Excerpts for testing purposes have been sampled from:
5151
* Dow Jacobo Hossain Siletti Hudspeth (2018). **Connectomics of the zebrafish's lateral-line neuromast reveals wiring and miswiring in a simple microcircuit.** eLife. [DOI:10.7554/eLife.33988](https://elifesciences.org/articles/33988)
5252
* Zheng Lauritzen Perlman Robinson Nichols Milkie Torrens Price Fisher Sharifi Calle-Schuler Kmecova Ali Karsh Trautman Bogovic Hanslovsky Jefferis Kazhdan Khairy Saalfeld Fetter Bock (2018). **A Complete Electron Microscopy Volume of the Brain of Adult Drosophila melanogaster.** Cell. [DOI:10.1016/j.cell.2018.06.019](https://www.cell.com/cell/fulltext/S0092-8674(18)30787-6). License: [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)
5353
* Bosch Ackels Pacureanu et al (2022). **Functional and multiscale 3D structural investigation of brain tissue through correlative in vivo physiology, synchrotron microtomography and volume electron microscopy.** Nature Communications. [DOI:10.1038/s41467-022-30199-6](https://www.nature.com/articles/s41467-022-30199-6)
54+
* Hanke, M., Baumgartner, F. J., Ibe, P., Kaule, F. R., Pollmann, S., Speck, O., Zinke, W. & Stadler, J. (2014). **A high-resolution 7-Tesla fMRI dataset from complex natural stimulation with an audio movie. Scientific Data, 1:140003.** [DOI:10.1038/sdata.2014.3](http://www.nature.com/articles/sdata20143)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from pathlib import Path
2+
from time import gmtime, strftime
3+
4+
import webknossos as wk
5+
6+
7+
def main() -> None:
8+
time_str = strftime("%Y-%m-%d_%H-%M-%S", gmtime())
9+
dataset = wk.Dataset.from_images(
10+
str(Path(__file__).parent.parent / "testdata" / "dicoms"),
11+
f"dicom_dataset_{time_str}",
12+
voxel_size=(12, 12, 12),
13+
)
14+
dataset.compress()
15+
16+
remote_dataset = dataset.upload()
17+
url = remote_dataset.url
18+
print(f"Successfully uploaded {url}")
19+
20+
21+
if __name__ == "__main__":
22+
main()

webknossos/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
207 KB
Binary file not shown.
207 KB
Binary file not shown.
207 KB
Binary file not shown.
207 KB
Binary file not shown.

0 commit comments

Comments
 (0)