how to paste the coordinate value 1 binary images into 3D images.

조회 수: 1 (최근 30일)
mohd akmal masud
mohd akmal masud 2021년 10월 10일
답변: yanqi liu 2021년 10월 10일
hi all, I have code below. Anyone know how to insert the 3D arrays of binary images which have value 1 into my 3D images dicom?
so that only pixel on 3D images that have same coordinate with value 1 binary images appear
Anyone please help me?
% For binary images (png format, each pixel just have value 1 and 0.)
clc
clear all
dataSetDir = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
imageDir = fullfile(dataSetDir,'bnwaftersegmentation');
imds = imageDatastore(imageDir);
for i = 1:41
% subplot(6,7,i)
I = readimage(imds,i);
% binary
Is{i} = logical(I);
end
% For 3D images spect
myFolder = ('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang\dcmoriextract');
filePattern = fullfile(myFolder, '*.dcm'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for K = 1 : length(theFiles)
baseFileName = theFiles(K).name;
fullFileName = fullfile(theFiles(K).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
P(:,:,K) = dicomread(fullFileName);
end
p = patch(isosurface(P, Is==1)); %% I STUCK HERE
axis equal
set(p,'FaceColor','c','EdgeColor','none');
alpha(p,1)
hold
% p = patch(isosurface(smooth3(P),pvmax));
% axis equal
% set(p,'FaceColor','m','EdgeColor','none');
for i=1:180
view(i-90,-15)
GG(i) = getframe(gcf);
end
mplay(GG)
movie2avi(GG,'spect01.avi')

채택된 답변

yanqi liu
yanqi liu 2021년 10월 10일
sir, i think may be use logical matrix as mask,such as
im = im .* uint8(mask);
to get target

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by