Vectorization to store images in a 3D array?
이전 댓글 표시
I have a multitiff image which I want to store as a 3D array.
Here is the function I am using. However, I wanted to know if there is a way to vectorize the for loop at the end of the code to reduce processing time.
function Images = readMultiTiff(TifImage)
%Get the information in the multitiff image
info = imfinfo(TifImage);
%Get the number of images in the multitiff image
num_images = numel(info);
%Determine height and width
width = info.Width;
height = info.Height;
%Create an empty array the size of each image in the multitiff
BlankImage =zeros(width,height);
%Use that to build a 3D array to store all the tiff images in the multitiff
Images = uint16(zeros(size(BlankImage,2),size(BlankImage,1),num_images));
%Read and assign each image to SEMImages.
mywaitbar_handle = waitbar(0, 'Saving images...');
for k = 1:num_images
A = imread(TifImage, k);
Images(:,:,k) = A;
waitbar(k/num_images);
end
close(mywaitbar_handle)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!