Sunday, April 12, 2020
load and wirte tif stacks in matlab
It takes time to search for these codes, for convenience, let me keep a copy her for everyone.
This will read from a tif stack (not many single files):
Read part:
fname = '20191229_fov02_14.tif';
info = imfinfo(fname);
num_images = numel(info);
B = imread(fname,1);
for k = 2:num_images
A = imread(fname, k);
B = cat(3,B,A);
end
Save part:
outputFileName = 'filteredbinary.tif';
imwrite(afterOp(:, :, 1), outputFileName, 'Compression','none');
for K=2:length(afterOp(1, 1, :))
imwrite(afterOp(:, :, K), outputFileName, 'WriteMode', 'append', 'Compression','none');
end
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment