From bc58490d63ccc482fa6a0893dd7a8fa5c33456d9 Mon Sep 17 00:00:00 2001 From: David Stirling Date: Fri, 29 Nov 2024 13:01:23 +0000 Subject: [PATCH 1/3] Support ome-zarr v0.4 --- cellprofiler_core/utilities/zarr.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cellprofiler_core/utilities/zarr.py b/cellprofiler_core/utilities/zarr.py index bbf07c60..e4cef62a 100644 --- a/cellprofiler_core/utilities/zarr.py +++ b/cellprofiler_core/utilities/zarr.py @@ -204,11 +204,18 @@ def map_wells(self): if 'plate' not in attrs or 'wells' not in attrs['plate']: return False well_data = attrs['plate']['wells'] + if not well_data: + # Empty well data for some reason + return False mapper = {} if 'column_index' in well_data[0]: - # Standard format + # v0.2 format for row in well_data: mapper[(str(row['column_index']), str(row['row_index']))] = row['path'] + elif "columnIndex" in well_data[0]: + # v0.4 format + for row in well_data: + mapper[(str(row['columnIndex']), str(row['rowIndex']))] = row['path'] else: for row in well_data: path = row['path'] From 890ed1df1b4b0e563fabf3607b18bd1074ac92d4 Mon Sep 17 00:00:00 2001 From: David Stirling Date: Fri, 29 Nov 2024 13:04:09 +0000 Subject: [PATCH 2/3] Bump version --- cellprofiler_core/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cellprofiler_core/__init__.py b/cellprofiler_core/__init__.py index 213df64a..ee4eeee5 100644 --- a/cellprofiler_core/__init__.py +++ b/cellprofiler_core/__init__.py @@ -1 +1 @@ -__version__ = "4.2.8" +__version__ = "4.2.80002" diff --git a/setup.py b/setup.py index 45181574..bbf96bf0 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,6 @@ packages=setuptools.find_packages(exclude=["tests"]), python_requires=">=3.8, <4", url="https://github.com/CellProfiler/core", - version="4.2.8", + version="4.2.80002", zip_safe=False, ) From b5a036ffff620ed7d2cfcf922f6e0155393ece0d Mon Sep 17 00:00:00 2001 From: David Stirling Date: Fri, 29 Nov 2024 13:44:02 +0000 Subject: [PATCH 3/3] Clarify comments, check for modern NGFF metadata first --- cellprofiler_core/utilities/zarr.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cellprofiler_core/utilities/zarr.py b/cellprofiler_core/utilities/zarr.py index e4cef62a..ff4be9e1 100644 --- a/cellprofiler_core/utilities/zarr.py +++ b/cellprofiler_core/utilities/zarr.py @@ -208,14 +208,14 @@ def map_wells(self): # Empty well data for some reason return False mapper = {} - if 'column_index' in well_data[0]: - # v0.2 format - for row in well_data: - mapper[(str(row['column_index']), str(row['row_index']))] = row['path'] - elif "columnIndex" in well_data[0]: - # v0.4 format + if "columnIndex" in well_data[0]: + # NGFF v0.4 format for row in well_data: mapper[(str(row['columnIndex']), str(row['rowIndex']))] = row['path'] + elif 'column_index' in well_data[0]: + # Older bioformats2raw format + for row in well_data: + mapper[(str(row['column_index']), str(row['row_index']))] = row['path'] else: for row in well_data: path = row['path']