Skip to content

Commit 48330e2

Browse files
committed
[feat] integrate isosurface with binsurface
1 parent cb8a6c8 commit 48330e2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

binsurface.m

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
% nface: nface=3 or ignored - for triangular faces,
1212
% nface=4 - square faces
1313
% nface=0 - return a boundary mask image via node
14+
% nface='iso' - call isosurface() function to return a
15+
% marching-cube based isosurface
1416
%
1517
% output:
1618
% elem: integer array with dimensions of NE x nface, each row represents
@@ -22,6 +24,12 @@
2224
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
2325
%
2426

27+
if (nargin > 1 && ischar(nface) && strcmp(nface, 'iso'))
28+
[elem, node] = isosurface(img);
29+
node = node(:, [2, 1, 3]) - 0.5;
30+
return
31+
end
32+
2533
dim = size(img);
2634
if (length(dim) < 3)
2735
dim(3) = 1;

vol2surf.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@
9191
end
9292
[isoct, octver] = isoctavemesh;
9393
if (~isoct || sscanf(octver, '%d') > 5)
94-
[levelel, levelno] = isosurface(levelmask, 0.5);
95-
levelno = levelno(:, [2 1 3]) - 0.5;
94+
[levelno, levelel] = binsurface(levelmask, 'iso');
9695
else
9796
[levelno, levelel] = binsurface(levelmask);
9897
end

0 commit comments

Comments
 (0)