Skip to content
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

fix: consider only dimensions with size >1 for plane-coordinate #28

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pylibCZIrw/czi.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ def _create_roi(

def _create_default_plane_coords(self) -> Dict[str, int]:
"""Generates a default plane coordinates dictionary with all indexes to 0.
This default plane coordinate contains all dimensions reported being used by
the CZI-document, but includes only dimensions for which the size is >1.

Returns
-------
Expand All @@ -653,7 +655,7 @@ def _create_default_plane_coords(self) -> Dict[str, int]:
return {
dim: 0
for dim, dim_index in self.CZI_DIMS.items()
if self._czi_reader.GetDimensionSize(_pylibCZIrw.DimensionIndex(dim_index)) > 0
if self._czi_reader.GetDimensionSize(_pylibCZIrw.DimensionIndex(dim_index)) > 1
}

def _create_plane_coords(
Expand Down
14 changes: 7 additions & 7 deletions pylibCZIrw/tests/unit/test_czi_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,14 @@ def test_create_roi_raises_error_on_incorrect_scene() -> None:
@pytest.mark.parametrize(
"GetDimensionSize, expected",
[
(dimension_sizes_test1, {"C": 0}),
(dimension_sizes_test1, {}),
(
dimension_sizes_test2,
{"C": 0, "I": 0, "R": 0, "V": 0},
{"C": 0, "R": 0, "V": 0},
),
(
dimension_sizes_test3,
{"Z": 0, "C": 0, "T": 0, "R": 0, "I": 0, "H": 0, "V": 0, "B": 0},
{"Z": 0, "C": 0, "T": 0, "R": 0, "I": 0, "V": 0, "B": 0},
),
],
)
Expand All @@ -469,17 +469,17 @@ def test_create_default_plane_coords(
@pytest.mark.parametrize(
"plane, GetDimensionSize, expected",
[
(None, dimension_sizes_test1, {"C": 0}),
({"C": 1, "Z": 3, "T": 4}, dimension_sizes_test1, {"C": 1}),
(None, dimension_sizes_test1, {}),
({"C": 1, "Z": 3, "T": 4}, dimension_sizes_test1, {}),
(
{"C": 5, "Z": 3, "T": 4, "B": 12},
dimension_sizes_test2,
{"C": 5, "I": 0, "R": 0, "V": 0},
{"C": 5, "R": 0, "V": 0},
),
(
None,
dimension_sizes_test3,
{"Z": 0, "C": 0, "T": 0, "R": 0, "I": 0, "H": 0, "V": 0, "B": 0},
{"Z": 0, "C": 0, "T": 0, "R": 0, "I": 0, "V": 0, "B": 0},
),
],
)
Expand Down
8 changes: 0 additions & 8 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Used for testing
mypy
types-all
pylint==2.17.7
pylint-runner==0.6.0
flake8
flake8-docstrings
flake8-bugbear
bandit
black
check-python-versions
tox==3.27.1
tox-current-env
Expand Down
Loading