HOW TO CHANGE BINARY IMAGES TO 3D ARRAY (CONVERT TO 3D DIMENSION)

조회 수: 36(최근 30일)
mohd akmal masud
mohd akmal masud 2021년 10월 7일
댓글: Image Analyst 2021년 10월 8일
Hi all, I have 41 binary images.
Anyone know how convert it into 3D?
I means now my binary images just have dimension(let say 256 x 256). Then how to add thickness (as example thickness: 2.332) into that binary images?
So that my binary images now in 3D, (example 256x256x2.332)
Anyone can help me?
  댓글 수: 6
mohd akmal masud
mohd akmal masud 2021년 10월 8일
Hi sir Image Analyst, can you help me, maybe you can write the code?
Please help me sir?

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2021년 10월 8일
As per Rik's suggestion:
% ...
% assuming that your dicom images and binary images have same page geometry
numframes = 41;
s = [size(P,1) size(P,2)];
maskstack = zeros(s(1),s(2),numframes);
for f = 1:numframes
if f == 1
cast(maskstack,class(readimage(imds,f)));
end
maskstack(:,:,f) = readimage(imds,f);
end
% build location arrays
[X Y Z] = ndgrid(1:s(1),1:s(2),0:2.332:(numframes-1)*2.332);
Or something like that.
  댓글 수: 1
mohd akmal masud
mohd akmal masud 2021년 10월 8일
yah, dicom images and binary images have same page geometry.
but after that, how to develop it into 4D?
is it like this?
% to view as 4D
p = patch(isosurface(X, Y, Z));
axis equal
set(p,'FaceColor','c','EdgeColor','none');
alpha(p,1)
hold

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Image Analyst
Image Analyst 2021년 10월 8일
If you want, just consider your 256x256 image as having a thickness of 2.332 millimeters or centimeters or whatever. There is nothing to do to the image. However if you compute something like area of some region and want the volume in 3-D you have to multiply the area by the square of the lateral pixelsPerMm and then by the z-direction slice spacing of 2.332 to get the volume in mm.
  댓글 수: 2
Image Analyst
Image Analyst 2021년 10월 8일
Again, you're overwriting I on each iteration so it will only have the last image in it. I don't see where you're calling smooth3 but if you're passing it I, and if I is only a 2-D array, you'll get that error.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by