From 04316fe5861f4e3a5f7a5cb6797903cf75c770e6 Mon Sep 17 00:00:00 2001 From: soyers Date: Mon, 26 Aug 2024 17:07:05 +0200 Subject: [PATCH] fix: Channel ID and Name in display settings metadata (#37) This PR inlcudes the latest version ov libczirw to fix #13 Fixes #13 --- _pylibCZIrw/src/api/CZIwriteAPI.cpp | 2 +- libs/libCZIrw | 2 +- pylibCZIrw/tests/integration/write/test_write.py | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/_pylibCZIrw/src/api/CZIwriteAPI.cpp b/_pylibCZIrw/src/api/CZIwriteAPI.cpp index 5917506..7459cc5 100644 --- a/_pylibCZIrw/src/api/CZIwriteAPI.cpp +++ b/_pylibCZIrw/src/api/CZIwriteAPI.cpp @@ -92,7 +92,7 @@ void CZIwriteAPI::WriteMetadata( ssName << ""; nameIsValid = false; } - return make_tuple(ssId.str(), make_tuple(true, ssName.str())); + return make_tuple(ssId.str(), make_tuple(nameIsValid, ssName.str())); }; auto mdBldr = this->spWriter_->GetPreparedMetadata(prepareInfo); diff --git a/libs/libCZIrw b/libs/libCZIrw index 0c4f6c7..87c06cb 160000 --- a/libs/libCZIrw +++ b/libs/libCZIrw @@ -1 +1 @@ -Subproject commit 0c4f6c7373fadf27c56349f1c5a3c6aebd38e7f8 +Subproject commit 87c06cbf5eee5b91ca2d3560ad0a247d6ed9c810 diff --git a/pylibCZIrw/tests/integration/write/test_write.py b/pylibCZIrw/tests/integration/write/test_write.py index 6030b9f..83e8868 100644 --- a/pylibCZIrw/tests/integration/write/test_write.py +++ b/pylibCZIrw/tests/integration/write/test_write.py @@ -200,6 +200,8 @@ def test_write_metadata_application_version_matches_package_version() -> None: }, [ { + "@Id": "Channel:0", + "@Name": "TestCh0", "IsSelected": "true", "Color": "#FF010203", "ColorMode": "Color", @@ -207,6 +209,8 @@ def test_write_metadata_application_version_matches_package_version() -> None: "High": "0.8", }, { + "@Id": "Channel:1", + "@Name": "TestCh1", "IsSelected": "true", "Color": "#FFFFFEFD", "ColorMode": "Color", @@ -239,6 +243,10 @@ def __flatten(setting: Union[List[OrderedDict], OrderedDict]) -> Iterator[Ordere with tempfile.TemporaryDirectory() as td: # Act with create_czi(join(td, "test.czi")) as test_czi: + # Write data to the CZI since behavior on empty images in not well-defined + test_czi.write(data=np.zeros((100, 100), dtype=np.uint8), plane={"C": 0}) + test_czi.write(data=np.zeros((100, 100), dtype=np.uint8), plane={"C": 1}) + # Write metadata test_czi.write_metadata( document_name="TestWriteMetadata", scale_x=1.0,