Skip to content

Commit

Permalink
Merge pull request #6 from DavidStirling/compat-4-2
Browse files Browse the repository at this point in the history
Zarr fixes
  • Loading branch information
emilroz authored Jul 28, 2022
2 parents 6563394 + 8b56eb3 commit 0c8bc28
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
13 changes: 10 additions & 3 deletions cellprofiler_core/modules/loaddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,11 +1062,18 @@ def fetch_provider(self, name, measurements, is_image_name=True):
if url.endswith('.zarr'):
# Zarrs need czt indexing rather than just index.
c, z, t = None, None, None
if measurements.has_feature("Image", "Metadata_C"):

if measurements.has_feature("Image", f"Channel_{name}"):
c = measurements["Image", f"Channel_{name}"]
elif measurements.has_feature("Image", "Metadata_C"):
c = measurements["Image", "Metadata_C"]
if measurements.has_feature("Image", "Metadata_Z"):
if measurements.has_feature("Image", f"Z_{name}"):
z = measurements["Image", f"Z_{name}"]
elif measurements.has_feature("Image", "Metadata_Z"):
z = measurements["Image", "Metadata_Z"]
if measurements.has_feature("Image", "Metadata_T"):
if measurements.has_feature("Image", f"T_{name}"):
t = measurements["Image", f"T_{name}"]
elif measurements.has_feature("Image", "Metadata_T"):
t = measurements["Image", "Metadata_T"]
return FileImage(
name,
Expand Down
7 changes: 6 additions & 1 deletion cellprofiler_core/preferences/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ def get_config():
try:
config = wx.Config.Get(False)
except wx.PyNoAppError:
app = wx.App(0)
try:
app = wx.App(0)
except SystemExit:
# We're probably building on GitHub Actions
print("Python version doesn't support GUI, no app available.")
return __headless_config
config = wx.Config.Get(False)
if not config:
wx.Config.Set(
Expand Down
2 changes: 1 addition & 1 deletion cellprofiler_core/utilities/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_zarr_metadata(url):
xmlfile = 'METADATA.ome.xml'
parser = urllib.parse.urlparse(url)
if parser.scheme == 'file':
url = parser.path
url = url2pathname(url)
elif parser.scheme == 's3':
client = boto3.client('s3')
bucket_name, key = re.compile('s3://([\w\d\-\.]+)/(.*)').search(
Expand Down

0 comments on commit 0c8bc28

Please sign in to comment.