function zt2stks(filename, csize, zsize, tsize) % Summary: % take in a tif stack of the name filename taken from the leica format % *.lif (where the ordering of the planes in the stack are: channel, z, % time)... and outputs z-stacks at each time point of each channel. % % Created by: Louise Jawerth (ljawerth@fas.harvard.edu), use if you like. % % % INPUTS: % % % csize : number of channels % tsize : number of timepoints % zsize : number of slices % % Output: % writes tif stacks of the z data (where each stack corresponds to a % channel and a specific time point) % % UPDATES: % 08-21-07 : Created. basename = filename(1:end-4); for t = 1:tsize for z = 1:zsize for c = 1:csize currplanenum = (t-1)*csize*zsize+ (z-1)*csize + c ; %the current plane number currplane = imread(filename, currplanenum); outname = strcat('ch', num2str(c), basename, '_t', num2str(t), '.tif'); imwrite(currplane, outname, 'tif', 'Compression', 'none', 'WriteMode','append'); end end end