필터 지우기
필터 지우기

stacking rgb images into 3d or 4d variable

조회 수: 15 (최근 30일)
Raheema Al Karim Damani
Raheema Al Karim Damani 2019년 9월 26일
댓글: Raheema Al Karim Damani 2019년 11월 6일
I have mri frames that are in rgb and I want stack them in a 4d variable ( height x width x 3 channels x number of frames) so that I can view them as a montage.
How can i do this?

채택된 답변

Adam Danz
Adam Danz 2019년 9월 26일
편집: Adam Danz 2019년 9월 26일
If the height and width are the same for all images, use cat().
a = ones(5,6,3)+0;
b = ones(5,6,3)+1;
c = ones(5,6,3)+2;
stacked = cat(4,a,b,c);
% ^ concatenate along 4th dim
If the image sizes are not identical, you can pad them smaller ones to match the size of the larged one by using paddarray() and then use cat().
  댓글 수: 10
Adam Danz
Adam Danz 2019년 11월 6일
I see you've asked similar questions since adding the question above. If you still need help, please create a new question in the forum and send me the link to your new question or add the link as a comment below.
Raheema Al Karim Damani
Raheema Al Karim Damani 2019년 11월 6일
Thank you for your response. Yes here is the link to the question I put previously on the forum https://www.mathworks.com/matlabcentral/answers/489011-fuzzy-clustering-only-on-pixels-zero
I've re put my question on the forum, showing my thought process of trying to work through this problem, but Im still getting the same reshaping error

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

추가 답변 (1개)

Raheema Al Karim Damani
Raheema Al Karim Damani 2019년 9월 27일
the array was in double so I thought to turn it in to uint8 class which was the original format of the frames so that i could visualize it.
the size of array is 1 x 10 x 1 x 33 which is strange.
and array is stored as a 4-d uint8.
where as the dimensions of each frame is 128 x 128 x 3, so i'm guessing that when it is concatenating it is cutting down the image dimensions.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by