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

조회 수: 2(최근 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.)
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);
% 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);
p = patch(isosurface(P, Is==1)); %% I STUCK HERE
axis equal
% p = patch(isosurface(smooth3(P),pvmax));
% axis equal
% set(p,'FaceColor','m','EdgeColor','none');
for i=1:180
GG(i) = getframe(gcf);

채택된 답변

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개)

Community Treasure Hunt

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

Start Hunting!

Translated by