Skip to content

Commit

Permalink
Merge pull request #548 from fractal-analytics-platform/547-omero-cha…
Browse files Browse the repository at this point in the history
…nnels-window-parameters-became-required-unintentionally-with-0120-changes

Make `Channel.window` attribute optional in `lib_ngff.py`
  • Loading branch information
tcompa authored Oct 4, 2023
2 parents 3ed0b95 + 7004516 commit 0efcf33
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
**Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository.

# Unreleased
# 0.12.1

* Make `Channel.window` attribute optional in `lib_ngff.py` (\#548).
* Automate procedure for publishing package to PyPI (\#545).

# 0.12.0
Expand Down
2 changes: 1 addition & 1 deletion fractal_tasks_core/lib_ngff.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Channel(BaseModel):
See https://ngff.openmicroscopy.org/0.4/#omero-md.
"""

window: Window
window: Optional[Window] = None
label: Optional[str] = None
family: Optional[str] = None
color: str
Expand Down
53 changes: 53 additions & 0 deletions tests/data/ngff_examples/image_no_omero_channel_window.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"multiscales": [
{
"axes": [
{
"name": "y",
"type": "space",
"unit": "micrometer"
},
{
"name": "x",
"type": "space",
"unit": "micrometer"
}
],
"datasets": [
{
"path": 0,
"coordinateTransformations": [
{
"type": "scale",
"scale": [
0.1625,
0.1625
]
}
]
}
],
"version": "0.4"
}
],
"omero": {
"channels": [
{
"wavelength_id": "A01_C01",
"label": "some-label-1",
"color": "00FFFF"
},
{
"wavelength_id": "A01_C02",
"label": "some-label-2",
"color": "00FFFF",
"window":{
"start": 0,
"end": 1,
"min": 0,
"max": 1
}
}
]
}
}
8 changes: 8 additions & 0 deletions tests/test_unit_ngff.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ def test_NgffImageMeta(ngffdata_path):
debug(e.value)
assert "are too small" in str(e.value)

# Load an image where not all omero channels have a window attribute
ngff_image_meta = _load_and_validate(
ngffdata_path / "image_no_omero_channel_window.json", NgffImageMeta
)
debug(ngff_image_meta.omero)
assert ngff_image_meta.omero.channels[0].window is None
assert ngff_image_meta.omero.channels[1].window is not None


def test_ImageNgffMeta_missing_Z(ngffdata_path, caplog):
ngff_image_meta = _load_and_validate(
Expand Down

0 comments on commit 0efcf33

Please sign in to comment.