Skip to content

Instantly share code, notes, and snippets.

@whtns
whtns / fix_tiff_ome_xml.py
Last active October 7, 2025 17:40
Rename xenium ome.tiff files with a new naming pattern in morphology_focus for input into spatialdata
#!/usr/bin/env python3
"""Rename morphology_focus OME-TIFFs and update OME-XML in TIFF comments.
This script reads a simple mapping file (default: data/xenium_output_format.md)
containing lines like:
morphology_focus_0000.ome.tif: DAPI image
It will scan the `morphology_focus` folders under the data directory, plan
renames based on the mapping, optionally perform backups, rename files, and