ROI 转 MultiROI(OpenPNM/SNOW) 插件用户手册
ROI to MultiROI via OpenPNM/SNOW - User Manual
Dragonfly Prototype Apps · ROI to MultiROI via OpenPNM/SNOW...
版本 Version 1.0 · 2026-07-05
第一部分 中文手册
目录
1. 简介
2. 适用场景
3. 安装与启用
4. 运行环境与首次配置
5. 界面说明
5.1 “1 Dependencies”分页(依赖检查)
5.2 “2 Input ROI”分页(输入与命名)
5.3 “3 SNOW”分页(分割参数)
5.4 “4 Output”分页(输出与运行)
6. 使用步骤
7. 参数说明
8. 输出结果
9. 常见问题与故障排除
10. 注意事项与已知限制
11. 参考资料
1. 简介
ROI 转 MultiROI(OpenPNM/SNOW) 是一个 Dragonfly 插件,它把 Dragonfly 现有的 OpenPNM/PoreSpy 孔隙网络流程中的 SNOW 孔体分割(pore-body partitioning) 这一步单独抽出来,做成一个聚焦的图形化工具。
简单来说:你选择一个已经分割好的 ROI(代表孔隙/颗粒相的二值掩膜),插件调用 Dragonfly 内置的 PoreSpy snow_partitioning,把相连的孔隙空间切分成一个个独立的孔体(pore body),再把这些区域标签转换成一个 Dragonfly MultiROI(每个孔体是一个 label)。同时它会运行 OpenPNM 的 regions_to_network,把得到的孔隙数值属性(如孔体尺寸等)逐一写入 MultiROI 的 scalar slot(标量槽),方便你按属性给孔体上色、筛选与统计。
此外,面板提供一个 Generate graph(生成网络图) 选项;勾选后插件会额外发布一个 OpenPNM 孔隙网络 Graph(顶点=孔体、边=喉道),并把顶点/边的数值属性写入对应 scalar slot,还会尽力添加一个顶点 Connectivity(连通度) 标量。
底层引擎与算法
- PoreSpy
porespy.filters.snow_partitioning:SNOW(Sub-Network of an Over-segmented Watershed)分水岭分割,把连通孔隙空间切成单个孔体区域标签; - OpenPNM
porespy.networks.regions_to_network+ OpenPNMNetwork:由区域标签抽取孔隙网络及其数值属性(供 scalar slot 使用); - ORS Helper(Dragonfly 对象模型):把区域标签体数据转换为 MultiROI、写入标量槽,并可选地创建 Graph。
计算部分(snow_logic.py)不依赖 ORS,PoreSpy/OpenPNM 采用惰性导入;繁重的 SNOW 计算在面板的工作线程中运行,对 Dragonfly 对象模型的读写则被编排回 Qt 主线程,避免界面卡顿或线程冲突。
许可证要点
本插件本身不捆绑、不下载第三方库,而是直接复用 Dragonfly 自带 Python 环境中已有的 PoreSpy、OpenPNM、NumPy。PoreSpy 与 OpenPNM 均为 MIT 许可证的开源项目。因此本插件不引入额外的许可证义务;请遵循 Dragonfly 自身及其内置 PoreSpy/OpenPNM 组件的许可条款。
2. 适用场景
本插件适用于已经分割成单个 ROI 的相连孔隙/孔体结构,你希望把它快速拆分成一个个独立孔体并做后续分析的场景:
- 多孔材料(岩心、泡沫、陶瓷、电极、滤材等)的孔隙空间分析;
- 颗粒/孔隙结构,需要把连通区域切分成单个 body 并逐一测量;
- 任意二值 ROI,想要得到 pore/body 级别的 MultiROI 标签,并按孔体属性着色、筛选或统计;
- 需要一个 OpenPNM 孔隙网络 Graph(孔体—喉道拓扑)用于后续 OpenPNM 或 Dragonfly 网络分析。
它特别适合那些原本就用 Dragonfly Script Builder 中 OpenPNM/PoreSpy SNOW 流程的用户:本插件把其中的 SNOW 步骤单独封装成一键式面板,省去手工搭建 recipe 的过程,参数与行为与原流程保持一致。
SNOW 假设 ROI 掩膜表示的是孔隙/孔体相(由所选 phase value 指定)。如果你的目标相在 ROI 中用其他值表示,请在“ROI phase value”里对应设置。
3. 安装与启用
本插件作为 Prototype Apps 的一部分发布,推荐通过 Full Package(完整安装包) 安装器安装:
1. 把完整安装包解压到任意(较短)目录,双击运行 Install_FullPackage.bat。
2. 在弹出的安装对话框中,选择核心安装模式(Fresh 全新 / Compatible 兼容),并在应用列表里勾选 “ROI to MultiROI via OpenPNM/SNOW”。默认情况下所有插件均未勾选,本插件需要手动启用。
3. 点击 Install,等待控制台提示完成。
4. 完全退出并重启 Dragonfly(菜单只在 Dragonfly 启动时扫描)。
重启后,在 Dragonfly 菜单栏打开 Prototype Apps ▸ ROI to MultiROI via OpenPNM/SNOW...(归于 Measurements & Analysis(测量与分析) 分组)即可打开面板。面板是一个可停靠的浮动窗口。
以后想启用/停用本插件,最方便的方式是在 Dragonfly 内部操作:打开 Developer ▸ Prototype Labs... ▸ Menu Item Manager,在底部 “Prototype Apps (Full Package)” 列表中勾选/取消本插件,重启 Dragonfly 生效。停用插件不会影响 Dragonfly 自身的 OpenPNM/PoreSpy 组件。
开发者或高级用户也可以直接运行安装脚本(在插件目录下):
python install_roi_to_multiroi_snow_plugin.py
# 卸载:
python install_roi_to_multiroi_snow_plugin.py --uninstall
4. 运行环境与首次配置
本插件是 in-process(进程内) 类型:它不创建独立的 venv、不下载任何东西、无需 Setup Environment 步骤,而是直接在 Dragonfly 自身的 Python 解释器中运行。
依赖要求
运行本插件需要 Dragonfly 自带的 Python 环境中已包含 PoreSpy、OpenPNM、NumPy 以及 Dragonfly OpenPNM 集成所用的 ORS helper 模块。这与 Dragonfly Script Builder 中现有的 SNOW block 要求一致——如果你能在 Dragonfly 里正常运行那个 OpenPNM/PoreSpy 流程,本插件就能直接使用。
- 联网:不需要(不下载任何组件)。
- GPU:不需要(SNOW/OpenPNM 在 CPU 上运行)。
- 外部软件:不需要 Fiji / ImageJ / Java / WSL。
首次使用前的检查
打开面板后,先看 “1 Dependencies” 分页:它会自动检测并显示 PoreSpy 与 OpenPNM 是否可用及其版本。若显示 MISSING(缺失),说明当前 Dragonfly 的 Python 里没有这些库,需要先安装或启用 Dragonfly 的 OpenPNM/PoreSpy 组件,然后重启 Dragonfly,再点 Check Dependencies 重新检测。
配置会保存在插件代码目录下的 snow_roi_config.json(记住上次的参数与勾选状态),下次打开面板自动恢复。
5. 界面说明
面板顶部是一句功能说明,中间是四个向导式分页(1 Dependencies、2 Input ROI、3 SNOW、4 Output),底部是一个绿色状态行和一个只读日志框(显示运行过程与报错)。
5.1 “1 Dependencies”分页(依赖检查)
- Status:显示 PoreSpy / OpenPNM 的可用性与版本,或缺失原因;
- Check Dependencies 按钮:重新检测依赖(安装/启用组件并重启 Dragonfly 后点此刷新)。
5.2 “2 Input ROI”分页(输入与命名)
- Input ROI 下拉框 + Refresh 按钮:选择作为输入的 ROI(列表显示标题与形状);点 Refresh 重新枚举 Dragonfly 中的所有 ROI;
- Time step:时间步(多时间点数据用),范围 0–1000000,默认 0;
- ROI phase value:ROI 中代表孔隙/孔体相的标签值,范围 0–255,默认 1;
- Output MultiROI:输出 MultiROI 的标题;留空则自动命名为
<ROI>_PoreSpy_SNOW_PoreBodies。
5.3 “3 SNOW”分页(分割参数)
- SNOW r_max:SNOW 峰值检测的最大半径(整数),范围 1–1000,默认 4;
- Gaussian sigma:距离图高斯平滑的 sigma(浮点,3 位小数,步进 0.1),范围 0–100,默认 0.4;
- Trim isolated / disconnected pores from the OpenPNM network:从 OpenPNM 网络中剔除孤立/不连通的孔体(复选框),默认不勾选。
MultiROI 由 SNOW 区域标签生成;即使你只关心 MultiROI,插件也仍会运行 regions_to_network,因为孔体的数值测量(scalar slot)来自 OpenPNM 网络。
5.4 “4 Output”分页(输出与运行)
- Generate graph:是否额外发布 OpenPNM 孔隙网络 Graph(复选框),默认勾选;
- Graph title:Graph 标题;留空则自动命名为
Graph of <ROI>_PoreSpy_SNOW; - Publish results into Dragonfly:是否把结果对象发布进 Dragonfly(复选框),默认勾选;
- Show only newly created object(s):运行后只显示新建对象(复选框),默认勾选;
- Run SNOW + Create MultiROI(蓝色按钮):开始运行;
- 结果汇总表(Metric / Value):运行结束后显示孔体数量等关键指标。
6. 使用步骤
1. 确保 Dragonfly 中已存在一个分割好的 ROI(孔隙/孔体相)。
2. 打开 Prototype Apps ▸ ROI to MultiROI via OpenPNM/SNOW...。
3. 在 1 Dependencies 分页确认 PoreSpy 与 OpenPNM 均为 OK。
4. 切到 2 Input ROI:从下拉框选择输入 ROI(必要时先点 Refresh);如为多时间点数据设置 Time step;把 ROI phase value 设为孔隙相的标签值;可选地填写输出 MultiROI 名称。
5. 切到 3 SNOW:设置 r_max 与 Gaussian sigma;如需去除孤立孔体则勾选 Trim。
6. 切到 4 Output:决定是否 Generate graph、是否 Publish、是否只显示新对象,并可填写 Graph 标题。
7. 点击 Run SNOW + Create MultiROI。运行期间可在底部日志框查看进度;按钮会临时禁用。
8. 运行结束后,在结果汇总表查看孔体数量等指标;状态行会提示生成的 MultiROI(及 Graph)标题。到 Dragonfly 对象树中查看新对象。
7. 参数说明
参数 | 默认值 | 范围 / 类型 | 说明 |
Input ROI | (无) | 下拉选择 | 作为输入的 ROI;必须选择一个 |
Time step | 0 | 0–1000000 整数 | 多时间点数据的时间步索引 |
ROI phase value | 1 | 0–255 整数 | ROI 中孔隙/孔体相的标签值 |
Output MultiROI | (空) | 文本 | 输出名;留空 = |
SNOW r_max | 4 | 1–1000 整数 | SNOW 峰值检测最大半径 |
Gaussian sigma | 0.4 | 0–100 浮点 | 距离图高斯平滑 sigma |
Trim isolated pores | 否 | 复选框 | 剔除孤立/不连通孔体 |
Generate graph | 是 | 复选框 | 额外发布 OpenPNM 孔隙网络 Graph |
Graph title | (空) | 文本 | Graph 名;留空 = |
Publish results into Dragonfly | 是 | 复选框 | 把结果对象发布进 Dragonfly |
Show only newly created object(s) | 是 | 复选框 | 运行后只显示新建对象 |
各向异性体素:regions_to_network 的 voxel_size 取 X 方向间距,与 Dragonfly 现有 OpenPNM block 的行为一致;若检测到各向异性间距,日志会给出提示。
8. 输出结果
运行成功后,插件在 Dragonfly 中生成以下对象:
- MultiROI:由 SNOW 区域图得到的孔体标签——每个孔体是一个 label,可在 Dragonfly 中按 label 查看、着色和统计;
- MultiROI 的 scalar slot(标量槽):
regions_to_network得到的每个数值型孔隙属性都会写入一个独立的标量槽(按属性名描述、并尽量带上量纲单位),按 SNOW 区域标签映射到对应孔体。你可以在 MultiROI 的属性中切换标量槽,按孔体尺寸等属性给孔体上色; - Graph(可选,勾选 Generate graph 时):OpenPNM 孔隙网络——顶点代表孔体、边代表喉道,顶点/边的数值属性写入各自 scalar slot;当 Dragonfly 提供相应 helper/菜单或回退 API 时,还会额外添加一个顶点 Connectivity(连通度) 标量。
若勾选了 Publish results into Dragonfly,这些对象会出现在对象树中;若同时勾选 Show only newly created object(s),视图会只显示本次新建的对象,便于立即查看。
9. 常见问题与故障排除
问:Dependencies 分页显示 PoreSpy/OpenPNM MISSING(缺失)怎么办?
答:说明当前 Dragonfly 的 Python 里没有这两个库。请先安装或启用 Dragonfly 的 OpenPNM/PoreSpy 组件(与运行 Script Builder 中 SNOW block 的前提一致),然后重启 Dragonfly,再回到面板点 Check Dependencies 重新检测。
问:点了 Run 之后提示“Select a ROI first”。
答:还没有选择输入 ROI。到 2 Input ROI 分页点 Refresh,再从下拉框选择一个 ROI。若列表为空,请确认 Dragonfly 中确实存在 ROI 对象。
问:得到的孔体过多/过碎,或太少/粘连成一团。
答:这由 SNOW 参数决定。孔体过碎(过分割)时,适当增大 Gaussian sigma 或 r_max 以合并邻近峰值;孔体粘连(欠分割)时,适当减小它们。建议小步调整并观察结果汇总表里的孔体数量。
问:日志出现“anisotropic spacing detected(检测到各向异性间距)”的警告。
答:这是提示,不是错误。当体素三个方向间距不一致时,OpenPNM 的 voxel_size 会取 X 方向间距(与 Dragonfly 现有 OpenPNM block 一致)。若你的数据各向异性明显,请知悉网络的绝对尺寸度量会受此影响。
问:MultiROI 生成成功,但没有 Graph。
答:请确认 4 Output 分页勾选了 Generate graph。此外,Graph 生成需要 Dragonfly 提供 Graph、ArrayUnsignedLong 及标量 helper 等 API;若当前 Dragonfly 版本缺少相应能力,插件仍会生成 MultiROI,但会跳过 Graph。
问:分割相不对,结果几乎是空的。
答:多半是 ROI phase value 设置与实际孔隙相标签不符。确认 ROI 中孔隙/孔体相的标签值,并在 2 Input ROI 分页对应填写。
10. 注意事项与已知限制
- 插件总是创建 MultiROI,并总是运行
regions_to_network(因为孔体的标量测量来自 OpenPNM 网络);取消 Generate graph 只会跳过 Dragonfly Graph 的创建与发布; - SNOW 假设 ROI 掩膜表示的是由所选 phase value 指定的孔隙/孔体相;
- 对各向异性体素,
regions_to_network的 voxel_size 取 X 方向间距(与现有 Script Builder block 行为一致); - Graph 生成依赖 Dragonfly 的
Graph、ArrayUnsignedLong及标量 helper API;缺失时自动跳过 Graph; - 本插件不含独立环境,其可用性完全取决于 Dragonfly 自带 Python 中的 PoreSpy/OpenPNM 是否就绪。
11. 参考资料
- PoreSpy 文档(snow_partitioning / regions_to_network):https://porespy.org
- OpenPNM 文档(Network / regions_to_network):https://openpnm.org
- Gostick 等,SNOW 算法原始论文:Physical Review E 96, 023307 (2017)
- Dragonfly Script Builder 中的 OpenPNM/PoreSpy SNOW 流程(本插件即由其 SNOW 步骤封装而来)
Part II English Manual
Contents
1. Overview
2. Typical scenarios
3. Installation & enabling
4. Environment & first-time setup
5. Interface reference
5.1 '1 Dependencies' tab
5.2 '2 Input ROI' tab
5.3 '3 SNOW' tab
5.4 '4 Output' tab
6. Step-by-step usage
7. Parameter reference
8. Outputs
9. FAQ & troubleshooting
10. Notes & known limitations
11. References
1. Overview
ROI to MultiROI via OpenPNM/SNOW is a Dragonfly plugin that exposes the SNOW pore-body partitioning step of Dragonfly's existing OpenPNM/PoreSpy pore-network workflow as a single, focused GUI tool.
In short: you select one segmented ROI (a binary mask of the pore/body phase), the plugin runs Dragonfly's bundled PoreSpy snow_partitioning to split the connected pore space into individual pore bodies, and converts those region labels into a Dragonfly MultiROI (one label per pore body). It also runs OpenPNM's regions_to_network and writes each numeric pore property into a MultiROI scalar slot, so you can colour, filter, and measure the bodies by property.
A Generate graph option additionally publishes an OpenPNM pore-network Graph (vertices = pore bodies, edges = throats) with vertex/edge scalar slots, and best-effort adds a vertex Connectivity scalar.
Engine & algorithm
- PoreSpy
porespy.filters.snow_partitioning: the SNOW (Sub-Network of an Over-segmented Watershed) partitioning that splits the connected pore space into individual pore-body region labels; - OpenPNM
porespy.networks.regions_to_network+ an OpenPNMNetwork: extracts the pore network and its numeric properties (used for the scalar slots); - ORS helpers (Dragonfly object model): convert the region labels to a MultiROI, write the scalar slots, and optionally create the Graph.
The compute layer (snow_logic.py) is ORS-free and imports PoreSpy/OpenPNM lazily; the heavy SNOW computation runs on a panel worker thread while ORSModel object access is marshalled back to the Qt thread to keep the UI responsive.
Licensing
The plugin bundles and downloads nothing; it reuses PoreSpy, OpenPNM, and NumPy already present in Dragonfly's own Python. PoreSpy and OpenPNM are both MIT-licensed open-source projects, so the plugin adds no extra licensing obligation — follow the terms of Dragonfly and its bundled OpenPNM/PoreSpy components.
2. Typical scenarios
Use this plugin whenever you have a connected pore/body structure already segmented into a single ROI and want to split it into individual bodies for further analysis:
- Pore-space analysis of porous materials (rock cores, foams, ceramics, electrodes, filters, etc.);
- Grain/pore structures where a connected region must be split into individual bodies and measured one by one;
- Any binary ROI where you want pore/body-level MultiROI labels to colour, filter, or measure by pore property;
- Cases needing an OpenPNM pore-network Graph (body-throat topology) for later OpenPNM or Dragonfly network analysis.
It is especially handy for users of Dragonfly Script Builder's OpenPNM/PoreSpy SNOW workflow: this plugin packages the SNOW step into a one-click panel with the same parameters and behaviour, sparing you the manual recipe assembly.
SNOW assumes the ROI mask represents the pore/body phase (selected via the phase value). If your target phase uses a different label value in the ROI, set 'ROI phase value' accordingly.
3. Installation & enabling
The plugin ships as part of Prototype Apps and is best installed with the Full Package installer:
1. Unzip the Full Package to any (short) folder and double-click Install_FullPackage.bat.
2. In the installer dialog, pick the core install mode (Fresh / Compatible) and tick 'ROI to MultiROI via OpenPNM/SNOW' in the app list. All plugins are unticked by default, so this one must be enabled manually.
3. Click Install and wait for the console to finish.
4. Quit Dragonfly completely and restart it (menus are scanned only at startup).
After the restart, open Prototype Apps ▸ ROI to MultiROI via OpenPNM/SNOW... (under the Measurements & Analysis group) to show the dockable panel.
To enable/disable it later, the easiest way is inside Dragonfly: open Developer ▸ Prototype Labs... ▸ Menu Item Manager and tick/untick the plugin in the 'Prototype Apps (Full Package)' list, then restart Dragonfly. Disabling it does not touch Dragonfly's own OpenPNM/PoreSpy components.
Developers / advanced users can also run the install script directly (from the plugin folder):
python install_roi_to_multiroi_snow_plugin.py
# to remove:
python install_roi_to_multiroi_snow_plugin.py --uninstall
4. Environment & first-time setup
This is an in-process plugin: it creates no venv, downloads nothing, and has no Setup Environment step. It runs directly inside Dragonfly's own Python interpreter.
Dependencies
It requires Dragonfly's bundled Python to already include PoreSpy, OpenPNM, NumPy, and the ORS helper modules used by Dragonfly's OpenPNM integration — the same requirement as the existing Script Builder SNOW block. If you can run that OpenPNM/PoreSpy workflow inside Dragonfly, this plugin will work.
- Internet: not needed (nothing is downloaded).
- GPU: not needed (SNOW/OpenPNM run on the CPU).
- External software: no Fiji / ImageJ / Java / WSL.
Check before first use
Open the panel and look at the '1 Dependencies' tab: it auto-detects and reports whether PoreSpy and OpenPNM are available, with versions. If it shows MISSING, install or enable Dragonfly's OpenPNM/PoreSpy components, restart Dragonfly, then click Check Dependencies to re-verify.
Settings are saved to snow_roi_config.json in the plugin code folder (remembering your last parameters and checkbox states) and restored the next time you open the panel.
5. Interface reference
The panel has a one-line description at the top, four wizard-style tabs in the middle (1 Dependencies, 2 Input ROI, 3 SNOW, 4 Output), and at the bottom a green status line plus a read-only log box (progress and errors).
5.1 '1 Dependencies' tab
- Status: shows PoreSpy / OpenPNM availability and version, or the reason they are missing;
- Check Dependencies button: re-runs the check (click it after installing/enabling components and restarting Dragonfly).
5.2 '2 Input ROI' tab
- Input ROI dropdown + Refresh button: pick the input ROI (each entry shows title and shape); Refresh re-enumerates all ROIs in Dragonfly;
- Time step: time index for multi-timepoint data, range 0-1000000, default 0;
- ROI phase value: the label value of the pore/body phase in the ROI, range 0-255, default 1;
- Output MultiROI: title for the output MultiROI; blank =
<ROI>_PoreSpy_SNOW_PoreBodies.
5.3 '3 SNOW' tab
- SNOW r_max: maximum radius for SNOW peak detection (integer), range 1-1000, default 4;
- Gaussian sigma: sigma of the Gaussian smoothing of the distance map (float, 3 decimals, step 0.1), range 0-100, default 0.4;
- Trim isolated / disconnected pores from the OpenPNM network checkbox, default off.
The MultiROI is generated from SNOW region labels; even if you only want the MultiROI, regions_to_network still runs because the per-pore scalar measurements come from the OpenPNM network.
5.4 '4 Output' tab
- Generate graph: also publish the OpenPNM pore-network Graph (checkbox), default on;
- Graph title: title for the Graph; blank =
Graph of <ROI>_PoreSpy_SNOW; - Publish results into Dragonfly: publish the result objects into Dragonfly (checkbox), default on;
- Show only newly created object(s): after the run, show only the new objects (checkbox), default on;
- Run SNOW + Create MultiROI (blue button): start the run;
- Summary table (Metric / Value): shows key metrics such as the number of pore bodies once the run finishes.
6. Step-by-step usage
1. Make sure a segmented ROI (the pore/body phase) already exists in Dragonfly.
2. Open Prototype Apps ▸ ROI to MultiROI via OpenPNM/SNOW....
3. On the 1 Dependencies tab, confirm PoreSpy and OpenPNM are both OK.
4. Go to 2 Input ROI: select the input ROI from the dropdown (click Refresh if needed); set Time step for multi-timepoint data; set ROI phase value to the pore-phase label; optionally type an output MultiROI name.
5. Go to 3 SNOW: set r_max and Gaussian sigma; tick Trim to drop isolated bodies if desired.
6. Go to 4 Output: choose whether to Generate graph, Publish, and Show only new objects, and optionally set a Graph title.
7. Click Run SNOW + Create MultiROI. Watch progress in the log box at the bottom; the buttons are disabled while running.
8. When it finishes, read the summary table for the pore-body count; the status line reports the MultiROI (and Graph) titles. Inspect the new objects in Dragonfly's object tree.
7. Parameter reference
Parameter | Default | Range / type | Description |
Input ROI | (none) | dropdown | The input ROI; one must be selected |
Time step | 0 | 0-1000000 int | Time index for multi-timepoint data |
ROI phase value | 1 | 0-255 int | Label value of the pore/body phase in the ROI |
Output MultiROI | (blank) | text | Output name; blank = |
SNOW r_max | 4 | 1-1000 int | Maximum radius for SNOW peak detection |
Gaussian sigma | 0.4 | 0-100 float | Sigma of the distance-map Gaussian smoothing |
Trim isolated pores | off | checkbox | Drop isolated/disconnected bodies |
Generate graph | on | checkbox | Also publish the OpenPNM pore-network Graph |
Graph title | (blank) | text | Graph name; blank = |
Publish results into Dragonfly | on | checkbox | Publish the result objects into Dragonfly |
Show only newly created object(s) | on | checkbox | After the run, show only the new objects |
Anisotropic voxels: regions_to_network uses the X spacing as voxel_size, matching Dragonfly's existing OpenPNM block; a warning is logged when anisotropic spacing is detected.
8. Outputs
On success, the plugin creates the following objects in Dragonfly:
- MultiROI: pore-body labels from the SNOW region map — one label per body, ready to view, colour, and measure by label in Dragonfly;
- MultiROI scalar slots: each numeric pore property from
regions_to_networkis written to its own scalar slot (described by the property name, with a dimension unit where available), mapped onto the bodies by SNOW region label. Switch slots in the MultiROI to colour bodies by, e.g., their size; - Graph (optional, when Generate graph is ticked): the OpenPNM pore network — vertices = pore bodies, edges = throats, with vertex/edge numeric properties in their own scalar slots; a vertex Connectivity scalar is added when Dragonfly exposes the matching helper/menu item or fallback API.
With Publish results into Dragonfly ticked, these objects appear in the object tree; with Show only newly created object(s) also ticked, the view shows only what this run created, for immediate inspection.
9. FAQ & troubleshooting
Q: The Dependencies tab reports PoreSpy/OpenPNM MISSING. What now?
A: The current Dragonfly Python lacks those libraries. Install or enable Dragonfly's OpenPNM/PoreSpy components (the same prerequisite as the Script Builder SNOW block), restart Dragonfly, then click Check Dependencies to re-verify.
Q: Clicking Run says 'Select a ROI first'.
A: No input ROI is selected. On the 2 Input ROI tab click Refresh, then pick an ROI from the dropdown. If the list is empty, confirm that ROI objects actually exist in Dragonfly.
Q: I get too many tiny bodies (over-segmentation) or too few merged blobs (under-segmentation).
A: This is controlled by the SNOW parameters. For over-segmentation, increase Gaussian sigma or r_max to merge nearby peaks; for under-segmentation, decrease them. Adjust in small steps and watch the pore-body count in the summary table.
Q: The log warns 'anisotropic spacing detected'.
A: This is informational, not an error. When the voxel spacing differs across axes, OpenPNM's voxel_size uses the X spacing (matching Dragonfly's existing OpenPNM block). If your data is strongly anisotropic, be aware the absolute network size metrics are affected.
Q: The MultiROI is created but there is no Graph.
A: Confirm Generate graph is ticked on the 4 Output tab. Graph creation also needs Dragonfly APIs such as Graph, ArrayUnsignedLong, and the scalar helpers; if the current Dragonfly version lacks them, the plugin still creates the MultiROI but skips the Graph.
Q: The wrong phase is segmented and the result is almost empty.
A: Usually the ROI phase value does not match the actual pore-phase label. Check the label value of the pore/body phase in the ROI and set it on the 2 Input ROI tab.
10. Notes & known limitations
- The plugin always creates a MultiROI and always runs
regions_to_network(because the per-body scalar measurements come from the OpenPNM network); unticking Generate graph only skips the Dragonfly Graph creation/publication; - SNOW assumes the ROI mask represents the pore/body phase indicated by the selected phase value;
- For anisotropic voxels,
regions_to_networkreceives the X spacing as voxel_size (matching the existing Script Builder block); - Graph generation depends on Dragonfly's
Graph,ArrayUnsignedLong, and scalar helper APIs; it is skipped when those are unavailable; - The plugin has no bundled environment; its availability depends entirely on PoreSpy/OpenPNM being ready in Dragonfly's own Python.
11. References
- PoreSpy docs (snow_partitioning / regions_to_network): https://porespy.org
- OpenPNM docs (Network / regions_to_network): https://openpnm.org
- Gostick et al., original SNOW algorithm paper: Physical Review E 96, 023307 (2017)
- Dragonfly Script Builder's OpenPNM/PoreSpy SNOW workflow (the source this plugin's SNOW step is packaged from)