Read Multiple Images from a Single Graphics File
This example shows how to read multiple images from a single graphics file. Some graphics file formats allow you to store multiple images. You can read these images using format-specific parameters with imread
. By default, imread
imports only the first image in the file.
Preallocate a 4-D array to hold the images to be read from a file.
mri = zeros([128 128 1 27],'uint8');
Read the images from the file, using a loop to read each image sequentially.
for frame=1:27 [mri(:,:,:,frame),map] = imread('mri.tif',frame); end whos
Name Size Bytes Class Attributes frame 1x1 8 double map 256x3 6144 double mri 128x128x1x27 442368 uint8