MATLAB Answers

Converting large stack of 2D images into 3D image: how to improve performance?

10 views (last 30 days)
I am working on a large stack of image data from micro CT and im looking to improve the performance of my code. I have around 600-900 500x500px images that im converting into a 3D stack using a for loop
for i=1:size_x
images_2D{i} = imread(file{i});
image_stack = cat(3,image_stack,images_2D{i});
I'm finding that sometimes it can be bit slow when using the desirable amount of images ~700, but works fine with 20-100 images. Could this process be changed so it can run in parallel as I dont think it can at the moment and keep the images in order.


Sign in to comment.

Accepted Answer

Subhadeep Koley
Subhadeep Koley on 4 Nov 2019
Hi, instead of for loop you can use parfor loop for better performance. Refer to the code below.
image_stack = [];
parfor i=1:size_y
tempImage = imread(file{i});
image_stack(:,:,i) = tempImage;
Hope this helps!

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by