Skip to content

Commit

Permalink
Bugfix: Surface processing: No reducepatch if Nvertices too low
Browse files Browse the repository at this point in the history
  • Loading branch information
ftadel committed Jan 8, 2022
1 parent bf5e7f4 commit 184e8cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions toolbox/anatomy/tess_fillholes.m
Expand Up @@ -84,8 +84,10 @@
VertConn = tess_vertconn(Vertices, Faces);
Vertices = tess_smooth(Vertices, 1, 10, VertConn, 0);
% Downsampling isosurface
bst_progress('text', 'Fill: Downsampling surface...');
[Faces, Vertices] = reducepatch(Faces, Vertices, nVertices ./ length(Vertices));
if (length(Vertices) > nVertices)
bst_progress('text', 'Fill: Downsampling surface...');
[Faces, Vertices] = reducepatch(Faces, Vertices, nVertices ./ length(Vertices));
end
% Remove small components
bst_progress('text', 'Fill: Removing small components...');
[Vertices, Faces] = tess_remove_small(Vertices, Faces);
Expand Down
8 changes: 5 additions & 3 deletions toolbox/anatomy/tess_isohead.m
Expand Up @@ -134,9 +134,11 @@
bst_progress('inc', 10);

% Downsampling isosurface
bst_progress('text', 'Downsampling surface...');
[sHead.Faces, sHead.Vertices] = reducepatch(sHead.Faces, sHead.Vertices, nVertices./length(sHead.Vertices));
bst_progress('inc', 10);
if (length(sHead.Vertices) > nVertices)
bst_progress('text', 'Downsampling surface...');
[sHead.Faces, sHead.Vertices] = reducepatch(sHead.Faces, sHead.Vertices, nVertices./length(sHead.Vertices));
bst_progress('inc', 10);
end
% Convert to millimeters
sHead.Vertices = sHead.Vertices(:,[2,1,3]);
sHead.Faces = sHead.Faces(:,[2,1,3]);
Expand Down

0 comments on commit 184e8cb

Please sign in to comment.