-Techniques and tricks‎ > ‎Matlab‎ > ‎

Reading/writing images


Creating a 3-D TIF file from images.

You can write a 3-d TIF file using individual frames using the imwrite command in Matlab.

Read in the frames:  

im{1} = imread('yourimage1.tif');
im{2} = imread('yourimage2.tif');
im{3} = imread('yourimage3.tif');
im{4} = imread('yourimage4.tif');
im{5} = imread('yourimage5.tif');

Now write it out 1 frame at a time:

for i=1:size(im,3),
   if i==1,
        writemode = 'overwrite';
    else,
        writemode = 'append';
    end;
    imwrite('mycombinedimage.tif',im{i},'tif','WriteMode',writemode);
end;



Comments