I'm trying to do something similar, so here there is how I have done it:
get the boundary voxels and convert it to points:
surface= Volume- imerode(Volume, true(3));
indx=find(surface);
[x,y,z]=ind2sub(size(Volume),indx);
surface=horzcat(x,y,z);
Save it as a ply file
function save_ply(filename,xyz)
fid=fopen(strcat(filename,'.ply'),'wt');
fprintf(fid,'ply\n');
fprintf(fid,'format ascii 1.0\n');
fprintf(fid,'element vertex %u\n',size(xyz,2));
fprintf(fid,'property float x\n');
fprintf(fid,'property float y\n');
fprintf(fid,'property float z\n');
fprintf(fid,'end_header\n');
for ii=1:size(xyz,2)
fprintf(fid,'%4f %4f %4f\n',xyz(1,ii),xyz(2,ii),xyz(3,ii));
end
end
And then you can load the point cloud to Meshlab. You can then create STL files with the tens of algorithms that it has inside, however im in that point now, triyng to choose the best. for non convex surfaces as yours.