Skip to content

Commit

Permalink
Fix metadata issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
aacic committed Feb 7, 2025
1 parent b8dd291 commit 63aae0d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tiatoolbox/utils/tiff_to_fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ def main(svs_file_path: str, json_file_path: str, final_url: str) -> None:
# Decode `.zattrs` JSON string into a dictionary
zattrs = json.loads(json_data[".zattrs"])

# Ensure "multiscales" exists and is a list
if "multiscales" not in zattrs or not isinstance(zattrs["multiscales"], list):
zattrs["multiscales"] = [{}] # Initialize as a list with an empty dictionary

# Update metadata into `.zattrs`
if "multiscales" in zattrs and isinstance(zattrs["multiscales"], list):
zattrs["multiscales"][0]["metadata"] = metadata_serializable
zattrs["multiscales"][0]["metadata"] = metadata_serializable

# Convert back to a JSON string
json_data[".zattrs"] = json.dumps(zattrs)
Expand Down

0 comments on commit 63aae0d

Please sign in to comment.