Hi,
I solved the problem using isosurface and a nice function,"smooth triangulated mesh" https://es.mathworks.com/matlabcentral/fileexchange/26710-smooth-triangulated-mesh:
% dims: image dimensions
axx=1:dims(1); ayy=1:dims(2); azz=1:dims(3); [xgrid,ygrid,zgrid] = meshgrid(axx, ayy, azz);
%statistical_image
%binary_statistical_image: assuming only positive values, put 1s where %statistical_image > 0
[faces,verts,colors] = isosurface(xgrid,ygrid,zgrid,binary_statistical_image,0.99999,statistical_image,'','verbose');
addpath('smoothpatch_version1b') mex smoothpatch_version1b\smoothpatch_curvature_double.c -v
mex smoothpatch_version1b\smoothpatch_inversedistance_double.c -v
mex smoothpatch_version1b\vertex_neighbours_double.c -v
FV.vertices=verts; FV.faces=faces; FV_smoothed=smoothpatch(FV,1,5); hpatch=patch(FV_smoothed, ... 'FaceVertexCData', colors, ... 'FaceColor','interp', ... 'edgecolor', 'interp');
Hope this helps,
All the best, Úrsula