convert 3d image to 2d images
조회 수: 16 (최근 30일)
이전 댓글 표시
i have image with size of 1024*512*128 where 128 is the number of slices in the volume how can i get the 2d images and save it into .png and how to get them back thanks for your kind help
댓글 수: 0
채택된 답변
Image Analyst
2017년 12월 17일
Try something like this
[rows, columns, numberOfSlices] = size(image3d);
for slice = 1 : numberOfSlices
thisSlice = image3d(:,:, slice);
baseFileName = sprintf('Slice %d.png', slice);
fullFileName = fullfile(folder, baseFileName);
imwrite(thisSlice, fullFileName);
end
To get them back, use imread(). To tack onto a 3D image, use cat(3, image3d, thisSlice).
댓글 수: 4
Image Analyst
2018년 10월 30일
permute() does not do that. It basically just rotates the 3D volume so that rows are now columns, etc.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!