[ome-devel] BF exporter create big ome.tif file

Hadrien Mary hadrien.mary at gmail.com
Tue Jan 27 17:56:16 GMT 2015


Thank you Melissa. Unfortunately the trick with "Stack to Hyperstack"
and "Hyperstack to Stack" is failing sometime (I don't know why)...
Anyway I wrote a small python script which just load the file and save
it while preserving the OME XML string and it seems to work pretty
well. I paste it at the end of this mail.

Is this behaviour to add colormap to each plane a feature or a bug of
SCIFIO ? If it is a bug should I report it to SCIFIO or you guys take
care of it ?

-------------------------
%load_ext autoreload
%autoreload 2

import os
import gc

# Just load tifffile.py from somewhere
from sktracker.io import TiffFile, imsave

data_path = "/home/hadim/Documents/phd/data/test"

for root, dirs, files in os.walk(data_path):
    for f in files:
        if f.endswith('ome.tif'):
            fname = os.path.join(root, f)
            print(fname)
            tf = TiffFile(fname)
            p = tf.pages[0]

            new_path = os.path.join(os.path.dirname(fname), "fixed",
os.path.basename(fname))
            if not os.path.isdir(os.path.join(os.path.dirname(fname), "fixed")):
                os.makedirs(os.path.join(os.path.dirname(fname), "fixed"))

            imsave(new_path, tf.asarray(),
description=p.tags['image_description'].value)
            del p
            del tf
            gc.collect()
-------------------------------


More information about the ome-devel mailing list