stack up 3D images into a 4D matrix
이전 댓글 표시
Hello,
I have multiple 3D images and I should stack up these images into a 4D matrix and use it as an input for another code for feature extraction. I have tested this method : cat(4,im1,im2,im3) but it doesn't work well as input. How can I convert these images into 4D matrix ?
댓글 수: 9
Rik
2020년 7월 3일
What sizes images are you trying to concatenate? If the first 3 dimensions don't match between all images, what should the end result be?
SaHaR
2020년 7월 3일
Rik
2020년 7월 3일
Then the cat function should work as expected. What error did you get?
Rik
2020년 7월 3일
Since you haven't told us anything about the origin of your data, its meaning, or what assumptions your later code makes, we can't help you.
Image Analyst
2020년 7월 3일
Your other code has to index it properly of course. Like if you have a 4-D image called image4d, then to extract image #8 from it you should do
this3DImage = image4d(:,:,:,8); % Extract a 3-D image
whos this3DImage % Show dimensions
Image Analyst
2020년 7월 3일
Looks like it should work as long as vol1, vol2, vol3, and ROI are all 3-D arrays whose lengths match in every dimension.
Note that arrays are not indexed (x,y,z) they are indexed (rows, columns, slices) so the convention is that y, which is rows, comes first, not x as you have it.
(rows, columns, slices) is (y, x, z).
So if you're getting an error, or the images look transposed, check that the order of your dimensions is correct.
SaHaR
2020년 7월 4일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!