how to stack 3D images from 2D images after semantic function.

조회 수: 3 (최근 30일)
mohd akmal masud
mohd akmal masud 2021년 9월 23일
답변: yanqi liu 2021년 9월 26일
Hi all, I have 2D images. then I used semantic program that have network build from U-Net deep learning.
after I segment the volume, I wrote this coding below to view as 3D stack the binary images. but only first images appear. Anyone can help me?
filePattern = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256\testimages', '*.png');
IMDS = imageDatastore(filePattern);
fileList = dir(filePattern)
numFiles = length(fileList);
image3d = zeros(256, 256, numFiles, 'uint8');
for k = 16 : 35
fullFileName = fullfile(fileList(k).folder, fileList(k).name);
thisImage = imread(fullFileName);
image3d(:, :, k) = thisImage;
end
[C,scores] = semanticseg((image3d(:, :, k)),net1);
outt2=C=="foreground";
st2=strel('disk',0);
outt22=imopen(outt2,st2);
imshow3D( outt22);

채택된 답변

yanqi liu
yanqi liu 2021년 9월 26일
please use size(outt2) to check the dim

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 9월 23일
There is a small err in the code. Here is the corrected part of it:
for k = 1:numFiles % Starts at 1
fullFileName = fullfile(fileList(k).folder, fileList(k).name);
thisImage = imread(fullFileName);
image3d(:, :, k) = thisImage;
end

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by