Skip to content

Upload DICOM stack

To convert a DICOM image stack to a WEBKNOSSOS dataset and upload it to the bioformats reader is necessary. This example shows how to create a new dataset from a dicom sequence, compress it and upload it to WEBKNOSSOS.

from pathlib import Path
from time import gmtime, strftime

import webknossos as wk

def main() -> None:
    time_str = strftime("%Y-%m-%d_%H-%M-%S", gmtime())
    dataset = wk.Dataset.from_images(
        str(Path(__file__).parent.parent / "testdata" / "dicoms"),
        voxel_size=(12, 12, 12),

    remote_dataset = dataset.upload()
    url = remote_dataset.url
    print(f"Successfully uploaded {url}")

if __name__ == "__main__":