HOW TO VIEW 4D FROM BINARY IMAGES

4 views (last 30 days)
mohd akmal masud
mohd akmal masud on 7 Oct 2021
Hi all, I have set data of 3D images dicom (41 slices). I also have 41 images binary images from it after segmentation.
So anyone can help me how to develop the 4D images, so I want to set the value 1 in binary images is foreground, and value 0 in binary images is background. so only the foreground is appear (as you can see green blob in picture below).
% For 3D images
clc
clear all
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
% For binary images
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);
end
% to view as 4D
p = patch(isosurface((P(I==1))));
axis equal
set(p,'FaceColor','c','EdgeColor','none');
alpha(p,1)
hold
THEN THIS IS MY ERROR
Error using smooth3 (line 51) V must be a 3D array.
ANYONE CAN HELP ME?
THIS IS IMAGE THAT SUPPOSELY I WANT like below

Answers (0)

Community Treasure Hunt

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

Start Hunting!