Skip to content

Instantly share code, notes, and snippets.

@Omnistic
Last active May 27, 2024 14:18
Show Gist options
  • Save Omnistic/b3f0d67fc59c11deafdcfca5c25f2114 to your computer and use it in GitHub Desktop.
Save Omnistic/b3f0d67fc59c11deafdcfca5c25f2114 to your computer and use it in GitHub Desktop.
Convert CZI to TIFFs for CD7 screens
import os
import tifffile as tiff
from bioio import BioImage
img = BioImage("E:/240416_NA_1-unprocessed-202404171807.czi")
destination = "E:/temp/"
if not os.path.exists(destination):
os.makedirs(destination)
for scene_id, scene in enumerate(img.scenes):
img.set_scene(scene)
for time_point in range(img.dims.T):
for z_slice in range(img.dims.Z):
for channel in range(img.dims.C):
filename = destination + f"Image-03_H(0)_S{scene_id:04d}({scene})_T{time_point:06d}_Z{z_slice:04d}_C{channel:02d}_M0000_ORG.tif"
tiff.imwrite(filename, img.get_image_data("YX", T=time_point, Z=z_slice, C=channel))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment