Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require organisation id in Annotation constructor. #1155

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion webknossos/tests/test_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
)

Expand Down
6 changes: 6 additions & 0 deletions webknossos/webknossos/annotation/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading