Timo Friedrich and Jan Kaslin showed me some 3D fluorescent labelled cells invading a wound that they would like to quantify. Initially, quantification along a single axis is acceptable. Let's load a sample dataset:
In [1]:
%matplotlib inline
import os
import numpy as np
from matplotlib import pyplot as plt
datadir = '/Users/nuneziglesiasj/Data/zebrafish-lesion'
os.chdir(datadir)
In [2]:
from gala import imio
im = imio.read_image_stack('sci-quant.tif')
im.shape, im.dtype, im.min(), im.max()
Out[2]:
That took way too long. Additionally, the volume is the wrong shape! I'm going to save the image as an hdf5 file and comment out the above lines.
In [4]:
im8 = np.ascontiguousarray(im.astype(np.uint8).transpose((2, 0, 1)).reshape(104, 18, 512, 512))
Out[4]:
In [5]:
plt.imshow(im8[0, 7, ...])
Out[5]:
In [7]:
imio.write_h5_stack(im8, 'sci-quant.lzf.h5', compression='lzf')
The compression has worked really well (3x size reduction)! We start over with the right file format.