-
Notifications
You must be signed in to change notification settings - Fork 14
WIP: add basic support for RFC5 transformations #243
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
Draft
jo-mueller
wants to merge
14
commits into
fideus-labs:main
Choose a base branch
from
jo-mueller:basic-rfc5support2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+202
−38
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
deb1a38
add basic support for RFC5 transformations
jo-mueller fb236c1
Merge branch 'main' into basic-rfc5support2
jo-mueller f73b013
Update py/ngff_zarr/v06/zarr_metadata.py
jo-mueller a04994a
Update py/ngff_zarr/from_ngff_zarr.py
jo-mueller e22c566
remove redundant Optional/None declaration
jo-mueller 4e99ce1
Update py/ngff_zarr/from_ngff_zarr.py
jo-mueller 058cfdd
add license header
jo-mueller 93d22c3
Merge branch 'basic-rfc5support2' of https://github.com/jo-mueller/ng…
jo-mueller ef7ee4e
Change class name for PEP8 compliance
jo-mueller 2a0c95c
immutable dims
jo-mueller 693b4e7
don't default to type space
jo-mueller 2ab2262
type consistency
jo-mueller dad6b50
basic version dispatch in reader
jo-mueller 788e6c2
simplify type annotations
jo-mueller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC | ||
| # SPDX-License-Identifier: MIT | ||
| from dataclasses import dataclass | ||
jo-mueller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from typing import List, Optional, Union | ||
|
|
||
| from ..v04.zarr_metadata import Axis, Omero, MethodMetadata | ||
|
|
||
| @dataclass | ||
| class CoordinateSystem: | ||
| name: str | ||
| axes: List[Axis] | ||
|
|
||
| @dataclass | ||
| class Scale: | ||
| scale: List[float] | ||
| name: Optional[str] | ||
| input: Optional[Union[str, CoordinateSystem]] | ||
| output: Optional[Union[str, CoordinateSystem]] | ||
| type: str = "scale" | ||
|
|
||
|
|
||
| @dataclass | ||
| class Translation: | ||
| translation: List[float] | ||
| name: Optional[str] | ||
| input: Optional[Union[str, CoordinateSystem]] | ||
| output: Optional[Union[str, CoordinateSystem]] | ||
| type: str = "translation" | ||
|
|
||
|
|
||
| coordinateTransformations = Union[Scale, Translation] | ||
|
|
||
|
|
||
| @dataclass | ||
| class TransformSequence: | ||
| input: Optional[Union[str, CoordinateSystem]] | ||
| output: Optional[Union[str, CoordinateSystem]] | ||
| transformations: List[coordinateTransformations] | ||
| type: str = "sequence" | ||
| name: Optional[str] = None | ||
|
|
||
|
|
||
| @dataclass | ||
| class Dataset: | ||
jo-mueller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| path: str | ||
| coordinateTransformations: Optional[Union[coordinateTransformations, TransformSequence]] | ||
|
|
||
|
|
||
| @dataclass | ||
| class Metadata: | ||
| datasets: List[Dataset] | ||
| coordinateSystems: List[CoordinateSystem] | ||
| coordinateTransformations: Optional[List[Union[Scale, Translation, TransformSequence]]] = None | ||
| omero: Optional[Omero] = None | ||
| name: str = "image" | ||
| type: Optional[str] = None | ||
| metadata: Optional[MethodMetadata] = None | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent unit handling: uses
ax["unit"]at line 54 butax.get("unit")at line 64. For coordinateSystems axes, the code safely uses.get()to avoid KeyError if "unit" is missing, but for regular axes it directly accessesax["unit"]which could raise KeyError. Consider usingax.get("unit")for consistency and safety at line 54 as well, or ensure the dict access is safe.