필터 지우기
필터 지우기

how to create stack with multiple images?

조회 수: 16 (최근 30일)
Yunwei
Yunwei 2023년 8월 3일
댓글: Yunwei 2023년 8월 3일
Hi all,
I have a series of images and I want to make stacks of the images. The dimension of the stack should be like 2490*2490*7.
Here is the code I worte.
b=cell(7,9);
I_max=cell(7,9);
I_stack_store=cell(9,1);
I_stack=zeros(2975,2975,7);
for t=1:9
for i=1:7
I=imread(['calibrate2-P01.00' num2str(t) '00' num2str(i) '.tif']);
b{i,t}=I;
I_max{i,t}=max(b{i,t},[],3);
I_stack(:,:,7)=I_max{:,t};
I_stack_store{t}=I_stack;
end
end
I_max is a 7x9 array with each cell one image. (e.g. 2490*2490)
I want to get every column (7 images) of I_max into a stack, resulting 9 stacks which can be stored into a new array.
There must be something wrong with my code because I did not have the image l want.
Can someone help?
Thanks a lot!

채택된 답변

VBBV
VBBV 2023년 8월 3일
편집: VBBV 2023년 8월 3일
b=cell(7,9);
I_max=cell(7,9);
I_stack_store=cell(9,1);
for t=1:9
for i=1:7
I= rand(50,10,3);
b{i,t}=I;
I_max{i,t}=max(b{i,t},[],3);
I_stack(:,:,i)=I_max{i,t}; % I_stack(:,:,7) if you only want the 7th col
end
I_stack_store{t}=I_stack;
end
I_stack_store
I_stack_store = 9×1 cell array
{50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double} {50×10×7 double}
  댓글 수: 6
VBBV
VBBV 2023년 8월 3일
The code I shown will do what you want. Please see the output I shown.
Yunwei
Yunwei 2023년 8월 3일
Thanks!
I overlooked the difference between the code you shown and l attached in the first place.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by