isosurfaceCC
Version 1.0.0 (3.35 KB) by
Sven
Extract isosurface patches from individual connected components.
ISOSURFACECC Extract isosurface patches from individual connected components.
PATCHES = ISOSURFACECC(inputVol, X, Y, Z) generates a struct array of
faces and vertices for each discrete object in inputVol.
DESCRIPTION: Optimized for memory efficiency by extracting local
sub-volumes for each object. This avoids the overhead of meshing empty
global space, significantly speeding up processing for sparse volumes.
INPUTS:
inputVol - Topology source. Can be a 3D numeric/logical volume,
a BWCONNCOMP struct, a regionprops3 Table, or a
VoxelIdxList cell array.
X, Y, Z - [Optional] Coordinate vectors or 3D coordinate matrices.
NAME-VALUE OPTIONS:
IntensityVol - [Optional] 3D numeric array for surface values.
IsoValue - Surface threshold (Default: 0.5).
ImageSize - [1x3] array. Required if inputVol is Table/Cell and X,Y,Z empty.
SmoothValue - Smoothing kernel size (scalar or [R,C,P] vector).
Note: Values are forced to the nearest odd integer.
SmoothType - 'gaussian' (default) or 'box'.
ReduceRatio - Polygon reduction ratio (0.0 to 1.0).
EXAMPLES:
% 1. Speed Comparison (Sparse Objects)
[x, y, z] = meshgrid(1:500);
vol = ((x-15).^2 + (y-15).^2 + (z-15).^2 < 10^2) | ...
((x-485).^2 + (y-485).^2 + (z-485).^2 < 8^2);
% isosurface(vol) -> ~3.3 seconds
% isosurfaceCC(vol) -> ~0.2 seconds
% 2. Visualization Loop (Distinct Colors)
p = isosurfaceCC(vol);
figure; hold on;
cmap = lines(numel(p));
for i = 1:numel(p)
patch(p(i), 'FaceColor', cmap(i,:), 'EdgeColor', 'none');
end
view(3); camlight; lighting gouraud; axis tight equal;
Cite As
Sven (2026). isosurfaceCC (https://uk.mathworks.com/matlabcentral/fileexchange/183014-isosurfacecc), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2025b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
