MATLAB Answers

How to display smooth 3D surface from 3D binary matrix from 2D slices ?

13 views (last 30 days)
Anatole Jimenez
Anatole Jimenez on 7 Jan 2020
Commented: Anatole Jimenez on 8 Jan 2020
Hello,
I extracted a contour of a vessel on successive 2D images acquired along z-axis.
I get a 202x194x1494 binary matrix of the contour of the vessel and would like to display it (see attached).
I tried this based on isosurface function.
[lmax,cmax,nbframe] = size(maskcontour);
xb = linspace(xstart,xend,cmax);yb = linspace(ystart,yend,lmax);
v= smoothdata(maskcontour,3);
fv = isosurface(xb,yb,vz*(1:nbframe),maskcontour,0);
p = patch(fv,'FaceColor','red','Linestyle','none');
view(3);
axis equal
camlight
lighting gouraud
Resulting in this image.
Vesselcontour.jpg
I would like a smooth surface with no holes on it. Can you help me ?

  0 Comments

Sign in to comment.

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 7 Jan 2020
Try with increasing cmax & lmax?
xb = linspace(xstart,xend,cmax);
yb = linspace(ystart,yend,lmax);

  5 Comments

Show 2 older comments
Anatole Jimenez
Anatole Jimenez on 8 Jan 2020
I don't know how to interpolate in cylindrical system of coordinates. Can you elaborate ?
Also my data are not supposed to have exact rotational symmetry.
darova
darova on 8 Jan 2020
Maybe griddata is not the better way
n = 50;
r = rand(1,n)+5;
t = linspace(0,2*pi,n);
[x,y] = pol2cart(t,r);
z = rand(1,n)*20;
zz = linspace(min(z),max(z),20);
tt = linspace(0,2*pi,50);
[Z,T] = meshgrid(zz,tt);
R = griddata(t,z,r,T,Z);
[X,Y] = pol2cart(T,R);
plot3(x,y,z,'.r')
hold on
surf(X,Y,Z)
hold off
axis equal
What about alphaShape?
Anatole Jimenez
Anatole Jimenez on 8 Jan 2020
I didn't get what you mean by interpolate cylindrical.
But I tried alphaShape and it works fine. I eroded along 3 rd dimension to filter some contours. Then I used alphaShape playing with alpha radius (didn't understand what it is exactly but it worked) input argument to get a smooth shape.
Thank you darova.

Sign in to comment.

Sign in to answer this question.


Translated by