python - 什么相当于 Python 3.x 中的“bwlabeln(具有 18 和 26 连接的邻域)”?
问题描述
解决方案
The documentation to skimage.measure.label
states for parameter neighbors
:
neighbors : {4, 8}, int, optional
Whether to use 4- or 8-“connectivity”. In 3D, 4-“connectivity” means connected pixels have to share face, whereas with 8-“connectivity”, they have to share only edge or vertex.
Deprecated, useconnectivity
instead.
And for parameter connectivity
:
connectivity : int, optional
Maximum number of orthogonal hops to consider a pixel/voxel as a neighbor. Accepted values are ranging from 1 toinput.ndim
. IfNone
, a full connectivity ofinput.ndim
is used.
What this means is that, in 3D, the connectivity can be either 1, 2 or 3, indicating 6, 18 or 26 neighbors.
Looking back through the various versions of the documentation, this syntax seems to have been introduced in scikit-image 0.11 (0.10 doesn't have it).
For your case, with 18 connected neighbors:
labeledImage = measure.label(maskImageVolume, connectivity=2)
推荐阅读
- java - 从 Firestore 回收视图中获取文件时遇到问题
- c# - 在 EF Core 5.0 中使用表值函数
- javascript - 让某人加入语音频道 Discord.js
- javascript - 为什么 setImmediate() 在 expressJS 路由器中不起作用?
- haxe - 从类中提取 T
并在课堂建设中使用 T - swift - 当内容太长时,具有 .estimated 宽度的组合布局项目会使应用程序崩溃
- python - 如何在 windows 上让 neovim 识别 python?
- spring - 春天 - tomcat - NoSuchMethodError setContentLengthLong
- python - Python Package Install - 识别依赖包
- go - AWS SDK GO V2 DynamoDB - 迁移到 V2 后 ADD 不再起作用