bwmorph3
Morphological operations on binary volume
Description
Examples
Compare the Clean and Majority Operations
Load 3-D MRI volumetric data and create a binary volume. Use volshow
to view the volumetric data with a gray color.
load mristack;
BW1 = mristack > 127;
cmap = [0.6 0.6 0.6];
volshow(BW1,Colormap=cmap);
To remove voxels that are set to 1 and that are also surrounded by voxels set to 0, perform the "clean"
operation on the volumetric data. When determining which voxels to remove, the "clean"
operation considers 26 neighboring voxels. Use volshow
to view the results.
BW2 = bwmorph3(BW1,"clean");
volshow(BW2,Colormap=cmap);
For comparison, perform the "majority"
operation on the volumetric data. The "majority"
operation performs a similar task to the "clean"
operation but only retains voxels if more than half (the majority) of the voxels in the neighborhood of the target voxel are set to 1. When determining which voxels to retain, the "majority"
operation also considers 26 neighboring voxels. Use volshow
to view the results.
BW3 = bwmorph3(BW1,"majority");
volshow(BW3,Colormap=cmap);
Input Arguments
V
— Input volume
numeric array | logical array
Input volume, specified as a numeric or logical array. For numeric input,
any nonzero pixels are considered to be 1
(true
).
bwmorph3
accepts 1-D, 2-D, or 3-D arrays. If you
specify 1-D or 2-D input arrays, then bwmorph3
performs
the morphological operation as defined for a 3-D volume. If you want 2-D
behavior, use bwmorph
instead.
operation
— Morphological operation to perform
character vector | string scalar
Morphological operation to perform, specified as one of the following character vectors or string scalar.
Operation | Description | Illustration Before and After Processing |
---|---|---|
| Find branch points of skeleton. Branch points are the voxels at the junction where multiple branches meet. To find branch points, the image must
be skeletonized. To create a skeletonized image, use
|
|
| Remove isolated voxels, setting them to
|
|
| Find end points of skeleton. End points are voxels at the ends of branches. Note: To find end
points, the image must be skeletonized. To create a
skeletonized image, use |
|
| Fill isolated interior voxels (holes), setting them
to |
|
| Keep a voxel set to |
|
| Remove interior voxels, setting it to
|
|
Data Types: char
| string
Output Arguments
J
— Volume after morphological operations
logical array
Volume after morphological operations, returned as a logical array of the
same size as input volume V
.
Tips
To perform the morphological operations erosion or dilation on 3-D volumes, use the
imerode
orimdilate
functions, specifying the structuring elementones(3,3,3)
.To perform morphological closing, opening, top-hat filtering, or bottom-hat filtering on 3-D volumes, use the
imclose
,imopen
,imtophat
, orimbothat
functions, specifying the structuring elementones(3,3,3)
.
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced in R2018aR2022b: Support for thread-based environments
bwmorph3
now supports thread-based
environments.
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)