From 116781aad0c800fae3dd4d210177bfaace5c43d3 Mon Sep 17 00:00:00 2001 From: "Soyer, Sebastian" Date: Mon, 26 Aug 2024 10:06:44 +0200 Subject: [PATCH] fix: name_is_valid tuple --- _pylibCZIrw/src/api/CZIwriteAPI.cpp | 2 +- pylibCZIrw/tests/integration/write/test_write.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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/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,