diff --git a/webknossos/Changelog.md b/webknossos/Changelog.md index 48f470da9..abad273f1 100644 --- a/webknossos/Changelog.md +++ b/webknossos/Changelog.md @@ -21,6 +21,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section - Added options `--layer-name` and `--mag` for compress command of the CLI. [#1141](https://github.com/scalableminds/webknossos-libs/pull/1141) - Added options `--chunk-shape` and `--chunks-per-shard` for convert command of the CLI. [#1150](https://github.com/scalableminds/webknossos-libs/pull/1150) - The `from_images` method of the `Dataset` supports directories and single files as `input_path` now. [#1152](https://github.com/scalableminds/webknossos-libs/pull/1152) +- Argument `organization_id` is mandatory for calling the `Annotation()` constructor now. [#1155](https://github.com/scalableminds/webknossos-libs/pull/1155) ### Fixed - Fixed issue with webknossos URL and context URL being considered different when opening a remote dataset due to trailing slashes. [#1137](https://github.com/scalableminds/webknossos-libs/pull/1137) diff --git a/webknossos/tests/test_skeleton.py b/webknossos/tests/test_skeleton.py index 2e5d13d14..912bcdfc4 100644 --- a/webknossos/tests/test_skeleton.py +++ b/webknossos/tests/test_skeleton.py @@ -65,7 +65,10 @@ def test_doc_example() -> None: from webknossos import Annotation annotation = Annotation( - name="my_annotation", dataset_name="my_dataset", voxel_size=(11, 11, 24) + name="my_annotation", + dataset_name="my_dataset", + voxel_size=(11, 11, 24), + organization_id="my_org", ) group = annotation.skeleton.add_group("a group") tree = group.add_tree("a tree") @@ -177,6 +180,7 @@ def test_nml_generation(tmp_path: Path) -> None: name="MyAnnotation", dataset_name="MyDataset", voxel_size=(1, 1, 1), + organization_id="my_org", zoom_level=0.4, ) diff --git a/webknossos/webknossos/annotation/annotation.py b/webknossos/webknossos/annotation/annotation.py index 10e3e39e3..48d26c5d2 100644 --- a/webknossos/webknossos/annotation/annotation.py +++ b/webknossos/webknossos/annotation/annotation.py @@ -51,6 +51,7 @@ from zipp import Path as ZipPath import webknossos._nml as wknml +from webknossos.client.context import _get_context from ..dataset import ( SEGMENTATION_CATEGORY, @@ -149,6 +150,11 @@ def __attrs_post_init__(self) -> None: assert ( self._voxel_size is not None ), "Please supply a voxel_size for Annotation()." + if self._organization_id is None: + self._organization_id = _get_context().organization_id + assert ( + self._organization_id is not None + ), "Please supply an organization_id for Annotation()." self.skeleton = Skeleton( dataset_name=self._dataset_name, voxel_size=self._voxel_size,