File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1616
1717# Regex to match well positions (eg. A1)
1818WELL_POS_RE = re .compile (r"(?P<row>\D+)(?P<col>\d+)" )
19-
19+ # Regex to match the metadata.xml (could be any xml under xyz.zarr/ directory,
20+ # not only xyz.zarr/OME/METADATA.ome.xml)
21+ METADATA_XML_RE = re .compile (r".+\.zarr\/(.+\.xml)" )
2022
2123def get_extinfo (conn : BlitzGateway , image : ImageWrapper ) -> ExternalInfoI :
2224 """
@@ -186,19 +188,20 @@ def set_external_info(
186188 path = lsid
187189 else :
188190 path = _get_path (conn , img .id )
189- if path .endswith ("OME/METADATA.ome.xml" ):
191+ if METADATA_XML_RE .match (path ):
192+ metadata_xml = METADATA_XML_RE .match (path ).group (1 )
190193 if well :
191194 match = WELL_POS_RE .match (well )
192195 if match :
193196 col = match .group ("col" )
194197 row = match .group ("row" )
195- path = path .replace ("OME/METADATA.ome.xml" , f"{ row } " )
198+ path = path .replace (metadata_xml , f"{ row } " )
196199 path = f"/{ path } /{ col } /{ idx } "
197200 else :
198201 raise ValueError (f"Couldn't parse well position: { well } " )
199202 else :
200203 series = img .getSeries ()._val
201- path = path .replace ("OME/METADATA.ome.xml" , f"{ series } " )
204+ path = path .replace (metadata_xml , f"{ series } " )
202205 path = f"/{ path } "
203206 else :
204207 raise ValueError (
You can’t perform that action at this time.
0 commit comments