HOW TO VIEW 4D FROM BINARY IMAGES
3 views (last 30 days)
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
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);
% 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
I = readimage(imds,i);
% to view as 4D
p = patch(isosurface((P(I==1))));
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