Skip to content

Commit

Permalink
Merge branch 'master' into add-zarrarray-as-mag
Browse files Browse the repository at this point in the history
  • Loading branch information
markbader committed Sep 26, 2024
2 parents fcea522 + 7e554c5 commit e26d32d
Show file tree
Hide file tree
Showing 28 changed files with 6,014 additions and 204 deletions.
14 changes: 13 additions & 1 deletion cluster_tools/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/) `MAJOR.MIN
For upgrade instructions, please check the respective *Breaking Changes* sections.

## Unreleased
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.2...HEAD)
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.5...HEAD)

### Breaking Changes

Expand All @@ -18,6 +18,18 @@ For upgrade instructions, please check the respective *Breaking Changes* section
### Fixed


## [0.15.5](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.5) - 2024-09-26
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.4...v0.15.5)


## [0.15.4](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.4) - 2024-09-23
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.3...v0.15.4)


## [0.15.3](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.3) - 2024-09-11
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.2...v0.15.3)


## [0.15.2](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.2) - 2024-09-05
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.1...v0.15.2)

Expand Down
4 changes: 4 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ nav:
- webknossos-py/examples/zarr_and_dask.md
- webknossos-py/examples/convert_4d_tiff.md
- webknossos-py/examples/announce_dataset_upload.md
- webknossos-py/examples/accessing_metadata.md
- webknossos-py/examples/explore_and_add_remote.md
- Annotation Examples:
- webknossos-py/examples/apply_merger_mode.md
- webknossos-py/examples/learned_segmenter.md
Expand All @@ -110,6 +112,7 @@ nav:
- webknossos-py/examples/skeleton_path_length.md
- webknossos-py/examples/upsample_skeleton.md
- Administration Examples:
- webknossos-py/examples/teams_and_users.md
- webknossos-py/examples/user_times.md
- webknossos-py/examples/annotation_project_administration.md
- API Reference:
Expand All @@ -125,6 +128,7 @@ nav:
- Layer: api/webknossos/dataset/layer.md
- MagView: api/webknossos/dataset/mag_view.md
- View: api/webknossos/dataset/view.md
- RemoteFolder: api/webknossos/dataset/remote_folder.md
- Annotation: api/webknossos/annotation/annotation.md
- Skeleton:
- Skeleton: api/webknossos/skeleton/skeleton.md
Expand Down
9 changes: 9 additions & 0 deletions docs/src/webknossos-py/examples/accessing_metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Accessing Metadata

This example show how to access and work with metadata in [remote datasets](../../api/webknossos/dataset/dataset.md#webknossos.dataset.dataset.RemoteDataset) and [remote folders](../../api/webknossos/dataset/remote_folder.md#webknossos.dataset.remote_folder.RemoteFolder).

```python
--8<--
webknossos/examples/accessing_metadata.py
--8<--
```
9 changes: 9 additions & 0 deletions docs/src/webknossos-py/examples/explore_and_add_remote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Explore and add Remote Dataset

This example shows how to create a [remote dataset](../../api/webknossos/dataset/dataset.md#webknossos.dataset.dataset.RemoteDataset) in webknossos from an existing Zarr dataset.

```python
--8<--
webknossos/examples/explore_and_add_remote.py
--8<--
```
9 changes: 9 additions & 0 deletions docs/src/webknossos-py/examples/teams_and_users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Teams and Users

This example uses the [`User` class](../../api/webknossos/administration/user.md#webknossos.administration.user.User) and the [`Team` class](../../api/webknossos/administration/user.md#webknossos.administration.user.Team) to access information about the current user, all managed users and all teams this user is in. It also shows how to add a new team and assign a user as a team manager.

```python
--8<--
webknossos/examples/teams_and_users.py
--8<--
```
26 changes: 25 additions & 1 deletion webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/) `MAJOR.MIN
For upgrade instructions, please check the respective _Breaking Changes_ sections.

## Unreleased
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.2...HEAD)
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.5...HEAD)

### Breaking Changes

Expand All @@ -22,6 +22,30 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
### Fixed


## [0.15.5](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.5) - 2024-09-26
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.4...v0.15.5)

### Added
- Webknossos API functions were added: `Team.get_list()`, `Team.add("new_name")`, `User.assign_team_roles("teamName", isTeamManager: True)` and `RemoteDataset.explore_and_add_remote()` are available now. [#1196](https://github.com/scalableminds/webknossos-libs/pull/1196)


## [0.15.4](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.4) - 2024-09-23
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.3...v0.15.4)

### Added
- Enable metadata access for remote datasets. [#1163](https://github.com/scalableminds/webknossos-libs/pull/1163)


## [0.15.3](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.3) - 2024-09-11
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.2...v0.15.3)

### Breaking Changes
- Conversion of images with 4 channels creates a dataset with four layers instead of a dataset with one RGB layer. [#1192](https://github.com/scalableminds/webknossos-libs/pull/1192)

### Changed
- Updated tifffile dependency to v2024.8.30. [#1190](https://github.com/scalableminds/webknossos-libs/pull/1190)


## [0.15.2](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.15.2) - 2024-09-05
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.15.1...v0.15.2)

Expand Down
21 changes: 21 additions & 0 deletions webknossos/examples/accessing_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import webknossos as wk


def main() -> None:
with wk.webknossos_context(url="https://webknossos.org/"):
l4_sample_dataset = wk.Dataset.open_remote("l4_sample")
# Access the metadata of the dataset
print(l4_sample_dataset.metadata)

# Edit the metadata of the dataset
l4_sample_dataset.metadata["new_key"] = "new_value"

# Access metadata of a folder
print(l4_sample_dataset.folder.metadata)

# Edit the metadata of the folder
l4_sample_dataset.folder.metadata["new_folder_key"] = "new_folder_value"


if __name__ == "__main__":
main()
14 changes: 14 additions & 0 deletions webknossos/examples/explore_and_add_remote.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import webknossos as wk


def main() -> None:
# Explore a zarr dataset with webknossos by adding it as a remote dataset
wk.RemoteDataset.explore_and_add_remote(
"https://data-humerus.webknossos.org/data/zarr/b2275d664e4c2a96/HuaLab-CBA_Ca-mouse-unexposed-M1/color",
"Ca-mouse-unexposed-M1",
"/Datasets",
)


if __name__ == "__main__":
main()
5 changes: 4 additions & 1 deletion webknossos/examples/load_annotation_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ def load_annotation(annotation_file: Path) -> None:
mag_view = segmentation_layer.get_finest_mag()
segments = mag_view.read(absolute_bounding_box=BOUNDING_BOX)

# Drop channel dimension as it has depth 1
segments = segments[0]

# Write segmentation IDs to an OME Tiff file
imwrite(
"segmentation.ome.tiff",
segments.T, # note, the tiff lib use different channel order
ome=True,
metadata={
"axes": "ZYXC",
"axes": "ZYX",
},
)

Expand Down
31 changes: 31 additions & 0 deletions webknossos/examples/teams_and_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import webknossos as wk


def main() -> None:
# Get the current user
current_user = wk.User.get_current_user()
print(
f"You are currently logged in as: {current_user.first_name} {current_user.last_name} ({current_user.email})."
)

# Get all users managed by the current user
all_my_users = wk.User.get_all_managed_users()
print("Managed users:")
for user in all_my_users:
print(f"\t{user.first_name} {user.last_name} ({user.email})")

# Get teams of current user
all_my_teams = wk.Team.get_list()
print("Teams:")
for team in all_my_teams:
print(f"\t{team.name} ({team.organization_id})")

# Add a new team
wk.Team.add("My new team")

# Set current user as team manager
current_user.assign_team_roles("My new team", is_team_manager=True)


if __name__ == "__main__":
main()
Loading

0 comments on commit e26d32d

Please sign in to comment.