bwgraph: Graph of connected pixels in images and volumes

版本 1.0.0 (304.9 KB) 作者: George Abrahams
Use to find the shortest path between 2 pixels or voxels.
33.0 次下载
更新时间 2023/12/16

bwgraph: Create a graph of connected pixels in 2D images or 3D volumes.

View on GitHub View on File Exchange

bwgraph can be used to find the shortest path between 2 pixels or voxels. See Examples.

Syntax

G = bwgraph( bw, Name=Value )

Inputs

Positional Argument Description
bw Binary image, given as a 2D or 3D, numeric or logical array. For numeric input, non-zero pixels are considered to be 1 (true).
Name-Value Argument Description
Connectivity Pixel connectivity, defining whether pixels are connected when they share either a face, edge, or corner. For a 2D bw, valid values are 4 (edge) and 8 (corner), and in 3D, 6 (face), 18 (edge) and 26 (corner). Default is the maximal connectivity, i.e., 8 or 26.
NodeWeights Node weights, given for each element of bw. For example, the node weight could represent the distance between that pixel and the nearest non-zero pixel of bw, as calculated with bwdist. Edge weights for the graph are set as the mean node weight of the two connected pixels. Numeric array with the same size as bw.

Outputs

Argument Description
G graph object with nodes for all pixels of bw and edges between connected non-zero pixels. By default, edge weights are the Euclidean distance between the centers of connected pixels. The indices of the graph's nodes are equivalent to the linear indices of the pixels in bw. Therefore, use sub2ind and ind2sub to convert between pixel subscripts and node indices.

Examples

Please see examples.mlx or examples.pdf.

Compatibility, License and Citation

Created in 2022b. Compatible with MATLAB release 2019b and later. Compatible with all platforms.

Published under MIT License (see LICENSE.txt).

Please cite George Abrahams (https://github.com/WD40andTape/bwgraph, https://www.linkedin.com/in/georgeabrahams).

引用格式

George Abrahams (2023). (https://www.linkedin.com/in/georgeabrahams) bwgraph: Create a graph of connected pixels in images/volume (https://github.com/WD40andTape/bwgraph/releases/tag/1.0.0), GitHub. Retrieved December 16, 2023.

MATLAB 版本兼容性
创建方式 R2022b
与 R2019b 及更高版本兼容
平台兼容性
Windows macOS Linux
致谢

参考作品: findNeighbours

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库