DetectionChinese & English

Spot / Puncta Detection (spotiflow)

Spot / Puncta Detection (spotiflow) is a Dragonfly Prototype Apps plugin that uses the deep-learning Spotiflow model to detect subpixel 2D/3D spots / puncta (fluorescent dots, particles, seed points) in an image Channel.

Updated 2026-07-09User manual

点/斑点检测 (spotiflow) 插件用户手册

Spot / Puncta Detection (spotiflow) - User Manual

Dragonfly Prototype Apps · Spot / Puncta Detection (spotiflow)...

版本 Version 1.0 · 2026-07-09


第一部分 中文手册

目录

1. 简介

2. 适用场景

3. 安装与启用

4. 运行环境与首次配置

5. 界面说明

6. 使用步骤

7. 参数说明

8. 输出结果

9. 常见问题与故障排除

10. 注意事项与已知限制

11. 参考资料

1. 简介

点/斑点检测 (spotiflow) 是一个 Dragonfly Prototype Apps 插件,使用深度学习模型 Spotiflow 在二维或三维图像 Channel 中检测亚像素级的点状/斑点目标(如荧光点、颗粒、种子点)。您选择一个图像 Channel、一个预训练模型、一个概率阈值以及一个最小间距,插件即在 GPU 上完成检测,并把结果以两种形式返回。

  • 一个 MultiROI 种子点对象:每个检测到的点被绘制成一个小球体,发布回场景(基于源图像的网格),可用于测量与可视化。
  • 一张坐标/计数表格:列出每个点的亚像素坐标(二维为 y/x,三维为 z/y/x)、可选的概率值以及点的总数,可导出为 CSV 文件。

此外,插件还提供一个可选的 Train(训练) 页,允许您用自己标注的点位数据对模型进行微调(fine-tune),以适配预训练模型未覆盖的图像类型。

底层引擎与算法

本插件封装开源项目 Spotiflow(作者 Weigert 实验室,项目地址 https://github.com/weigertlab/spotiflow)。Spotiflow 基于 PyTorch(CUDA) 深度学习框架,通过 Spotiflow.from_pretrained(名称) 加载预训练模型(或通过 Spotiflow.from_folder(文件夹) 加载您微调后的模型),再调用 model.predict(图像, prob_thresh=..., min_distance=...) 输出亚像素坐标。检测得到的坐标由插件在源网格上光栅化成小球体标签,并通过 Dragonfly 的发布通道生成 MultiROI。

运行隔离(重要设计)

所有繁重计算(PyTorch CUDA + Spotiflow)都在插件专属的 CUDA 虚拟环境(venv)中,以子进程方式运行,通过 JSON 文件进行进程间通信(IPC),绝不进入 Dragonfly 自带的 Python 解释器。这样即使 ML 依赖体积巨大、版本敏感,也不会污染或拖慢 Dragonfly 本体。

许可证要点

本插件是对 Spotiflow 的封装,Spotiflow 及其依赖(PyTorch、scikit-image、tifffile、lightning、numpy 等)各自遵循其上游许可证,请以对应项目发布的许可为准。预训练模型权重不随插件打包,首次检测时从网络自动下载;若您需要缓存或再分发这些权重,请自行确认其许可与再分发条款。

2. 适用场景

本插件适用于任何需要自动检测与计数点状目标的场景。典型用途包括:

  • 荧光显微镜中的信号点/斑点检测,例如 FISH、smFISH 等技术产生的荧光点。
  • 细胞核或颗粒的中心点定位:把每个目标定位为一个亚像素坐标点。
  • 材料学中的析出相、气泡等点状特征的计数与定位。
  • 任何“检测一批小圆点/亮斑并统计数量”的通用任务。

预训练模型面向荧光图像训练。若您处理的是 CT 或其他成像模态,直接套用预训练模型效果可能不佳,建议在 Train(训练)页用少量标注点对模型进行微调。

3. 安装与启用

本插件随 Prototype Apps 完整安装包(Full Package) 分发。安装步骤如下:

1. 将安装包 zip 解压到任意较短的目录(建议如 C:\PL\,不要放在很深的下载目录或 OneDrive 重定向的桌面下)。

2. 双击运行 Install_FullPackage.bat。

3. 在弹出的对话框中选择核心安装模式(Fresh 全新 / Compatible 兼容),并在应用列表中勾选 “Spot / Puncta Detection (spotiflow)...”。

4. 点击 Install,等待控制台完成。

5. 完全退出并重启 Dragonfly(菜单只在启动时扫描)。

本插件在安装器中默认未勾选(属于重型插件,默认关闭),必须手动勾选后才会部署。安装时插件不会下载任何内容;运行环境在首次使用时才搭建。

重启后,插件出现在菜单:Prototype Apps ▸ Spot / Puncta Detection (spotiflow)...(位于 Detection 分组)。点击后弹出一个可浮动的面板窗口。

以后修改勾选

启用或停用本插件最方便的方式是在 Dragonfly 内操作:打开 Developer ▸ Prototype Labs... ▸ Menu Item Manager,在底部 “Prototype Apps (Full Package)” 列表中勾选/取消 “Spot / Puncta Detection (spotiflow)...”,重启 Dragonfly 生效。停用从不删除插件已搭好的环境(venv),重新启用立即可用。也可随时重跑安装器,它会记住上次的勾选作为默认值。

安装位置均在当前用户目录(%LOCALAPPDATA%)下,无需管理员权限。启用后的插件代码位于 ...\pythonUserExtensions\GenericMenuItems\Spotiflow\ 与 ...\pythonUserExtensions\Plugins\OrsSpotiflow_<uuid>\。

4. 运行环境与首次配置

首次使用本插件前,必须先在 Setup(设置) 页搭建插件专属的运行环境。点击 Setup Environment 按钮后,插件会:

1. 在插件代码目录下的 venv\ 中创建一个全新的虚拟环境(默认使用 Dragonfly 自带的 Python_env\python.exe 作为基础解释器,无需另装 Python)。

2. 在该 venv 中升级 pip / setuptools / wheel。

3. 从 CUDA wheel 索引(默认 https://download.pytorch.org/whl/cu124)安装 torch + torchvision。

4. 安装 Spotiflow 运行所需的其余依赖(spotiflow、numpy 等)。

5. 运行一次冒烟测试,导入 torch/spotiflow 并报告 CUDA 是否可用与 GPU 名称。

环境要求

项目

是否需要

说明

联网

需要

搭建 venv 需下载 torch + spotiflow(约数 GB);预训练权重在首次检测时下载。

NVIDIA GPU

需要

检测与训练依赖 CUDA;无 GPU 时运行会很慢甚至失败。

WSL

不需要

本插件仅发行 Windows 运行模式。

外部软件

不需要

环境完全由插件在本地搭建,无需另装第三方软件。

环境安装到哪里

虚拟环境构建在已安装的插件代码目录下,即 %LOCALAPPDATA%\comet\<Dragonfly版本>\pythonUserExtensions\GenericMenuItems\Spotiflow\venv。作业(job)的输出、导出的图像 .npy、status.json、results.json 等中间文件写入您在 Apply(应用) 页指定的 Output folder(默认 ~\SpotiflowWorkspace)。停用或卸载插件时,该 venv 与工作目录不会被自动删除,可手动清理以腾出磁盘空间。

下载体积与耗时

首次 Setup 通常需要数分钟,并占用数 GB磁盘(torch CUDA + spotiflow)。之后再次点击 Setup Environment 会复用已有的可用 venv(仅当其 pip 正常时);若某次构建中断留下了没有可用 pip 的半成品 venv,插件会自动删除并重建。

失败时的替代方案

  • torch 安装失败:检查 Torch CUDA wheel index 是否与您的显卡驱动匹配(如 cu121 / cu124 等),必要时修改该字段后重试。
  • venv 创建失败:在 Base Python (build) 字段填入另一个带标准库 venv + pip 的 CPython 3.9+ 路径(例如 C:\Python312\python.exe),或写 py -3.12 之类的启动器命令。
  • 基础 Python 没有 venv 模块:同上,指向 Dragonfly 自带 Python_env\python.exe 或系统 CPython。

5. 界面说明

面板顶部有一段蓝色说明文字,概述插件功能。主体是一个含三个分页的选项卡:Setup、Apply、Train。窗口下方有一个绿色的结果状态行和一个只读的运行日志文本框。以下逐页说明。

5.1 Setup 页(搭建环境)

控件

类型

说明

Spotiflow venv python

文本框

venv 中的 python 路径。由 Setup Environment 自动填入,一般无需手改。

Base Python (build)

文本框

构建 venv 用的基础解释器。留空 = 使用本 Dragonfly 自带 python(推荐);也可填路径或 py -3.12。

Run mode

下拉框

运行模式,可选 windows(默认)或 wsl;当前仅发行 windows 模式。

Torch CUDA wheel index

文本框

torch CUDA wheel 的 pip 索引 URL,默认 https://download.pytorch.org/whl/cu124。

Setup Environment

按钮

点击后构建 venv 并安装 torch + spotiflow。

5.2 Apply 页(检测)

此页分为四组:Workspace(工作/输出目录)、Input(输入)、Detection parameters(检测参数)、Detected spots(检测结果)。

控件

类型 / 默认值

说明

Output folder

文本框(默认 ~\SpotiflowWorkspace)

作业与中间文件的输出目录,可用 “...” 浏览选择。

Image Channel (2D or 3D)

下拉框 + Refresh

选择要检测的图像 Channel;点 Refresh 从当前场景刷新可选列表。

Pretrained model

可编辑下拉框(默认 general)

选择预训练模型;下拉可选内置模型,也可直接输入任意模型名。

Probability threshold

数值框(默认 0.5,范围 0~1)

检测置信度阈值,越高越严格,检出点越少。

Min distance (voxels)

数值框(默认 1.0,范围 0~1000)

两个被接受的点之间的最小体素间距,越大越能抑制重复点。

Seed sphere radius (voxels)

数值框(默认 2.0,范围 0.5~100)

每个检测点绘制成的小球体半径(体素),仅影响可视化,不影响检测。

Custom model folder

文本框(可留空)

可选:指向一个微调后的模型文件夹;留空则使用上面的预训练模型。可用 “...” 浏览。

Result title

文本框(可留空)

发布的 MultiROI 标题;留空则默认 Spotiflow_spots。

Detect spots -> publish MultiROI + table

按钮(绿色)

点击开始检测,完成后发布 MultiROI 并填充结果表。

结果组内含一行计数标签(初始为 “No detection yet.”)、一个等宽字体的坐标表文本框,以及一个 Save coordinates as CSV... 按钮。

5.3 Train 页(可选:微调)

此页用于用您自己的数据微调模型,分两步:

控件

类型 / 默认值

说明

Image Channel

下拉框

训练用例的图像 Channel。

Points (MultiROI)

下拉框

标注了点位置的 MultiROI(其非零体素即为点坐标)。

Add case

按钮

把当前“图像 + 点”组合加入训练用例列表。

Clear cases

按钮

清空所有已添加的训练用例。

Training cases

计数标签

显示当前已累积的用例数,初始为 0。

Base model

可编辑下拉框(默认 general)

微调所基于的基础预训练模型。

Epochs (0 = default)

数值框(默认 0,范围 0~5000)

训练轮数;0 表示使用 Spotiflow 默认训练计划。

Model output folder

文本框

保存微调后模型的文件夹,可用 “...” 浏览。

Train

按钮(蓝色)

点击开始微调;完成后自动把该模型文件夹回填到 Apply 页的 Custom model folder。

6. 使用步骤

6.1 检测斑点(端到端)

输入要求:场景中已加载一个二维(单层)或三维图像 Channel。

1. 打开 Prototype Apps ▸ Spot / Puncta Detection (spotiflow)...。

2. 首次使用先到 Setup 页点 Setup Environment,等待环境搭建完成(日志显示 venv python 路径即成功)。

3. 切到 Apply 页,必要时设置 Output folder。

4. 在 Image Channel 下拉框选择目标 Channel;若列表为空或不全,点 Refresh。

5. 选择 Pretrained model(默认 general),按需调整 Probability threshold(默认 0.5)与 Min distance(默认 1.0)。

6. 如需更大/更小的可视化种子球,调整 Seed sphere radius(默认 2.0)。

7. 点击绿色的 Detect spots -> publish MultiROI + table。

8. 等待完成:结果状态行显示 “Done.”,计数标签显示检出点数与维度,坐标表被填充,场景中出现名为(默认)Spotiflow_spots 的 MultiROI。

9. 如需导出坐标,点 Save coordinates as CSV... 选择保存路径。

得到什么:一个 MultiROI 种子点对象(每个点一个小球体)+ 一张坐标/计数表(可导出 CSV)。

6.2 微调模型(可选)

输入要求:已搭建环境;场景中有图像 Channel 以及一个标注了点位置的 MultiROI(其非零体素表示点)。

1. 切到 Train 页。

2. 在 Image Channel 与 Points (MultiROI) 中分别选择图像与点标注,点 Add case 加入用例;可重复添加多个用例。

3. 选择 Base model(默认 general),设置 Epochs(0 = 默认计划)。

4. 在 Model output folder 指定保存文件夹。

5. 点击蓝色的 Train 开始微调。

6. 完成后模型保存到指定文件夹,并自动回填到 Apply 页的 Custom model folder;之后可在 Apply 页用它检测。

n 点为 0 的用例会被自动跳过;若全部用例都没有点,训练会报错。请先在 MultiROI 中标注点位。

7. 参数说明

参数

默认值

说明

Pretrained model

general

预训练模型名称;内置可选 general、hybiss、synth_complex、synth_3d、smfish_3d,也可自行输入其他模型名。

Probability threshold

0.5

检测概率阈值,取值 0~1;调高则更严格、检出更少,调低则更宽松、检出更多。

Min distance (voxels)

1.0

两个被接受点的最小体素间距,取值 0~1000;增大可抑制过近的重复检出。

Seed sphere radius (voxels)

2.0

每个检测点绘制的小球体半径(体素),取值 0.5~100;仅影响 MultiROI 显示,不影响坐标。

Custom model folder

(空)

可选,指向微调后的模型文件夹;非空且存在时优先于预训练模型。

Result title

(空 → Spotiflow_spots)

发布的 MultiROI 标题。

Base model (Train)

general

微调所基于的基础预训练模型名称。

Epochs (Train)

0

训练轮数,取值 0~5000;0 表示使用 Spotiflow 默认训练计划。

Base Python (build)

(空 → Dragonfly 自带 python)

构建 venv 的基础解释器路径或启动命令。

Run mode

windows

运行模式;当前仅发行 windows。

Torch CUDA wheel index

https://download.pytorch.org/whl/cu124

torch CUDA wheel 的 pip 索引 URL。

8. 输出结果

一次成功的检测会在 Dragonfly 中生成以下结果:

  • MultiROI 种子点对象:名称默认为 Spotiflow_spots(或您在 Result title 填写的名称),发布回场景并挂在源图像 Channel 的网格上;每个检测到的点被光栅化成一个半径由 Seed sphere radius 决定的小球体。可在 Dragonfly 的对象列表(如 Data Properties)中查看、着色、测量。
  • 坐标/计数表:在 Apply 页的结果框中以等宽表格显示。二维数据列为 # / y / x / prob,三维数据列为 # / z / y / x / prob;probability 列若上游模型未返回概率则显示为 “-”。表格最多显示前 200 行,超出部分以 “... (N more)” 提示。
  • 计数标签:显示 “Detected N spot(s) (2D/3D).”。
  • CSV 文件:点 Save coordinates as CSV... 可导出全部坐标(不受 200 行显示上限限制),二维表头为 index,y,x,prob,三维为 index,z,y,x,prob。

训练模式的输出是保存到指定文件夹的微调后的 Spotiflow 模型,可在 Apply 页作为 Custom model folder 重新加载。检测的中间文件(导出的图像 .npy、status.json、results.json)保留在作业目录中,便于排查。

9. 常见问题与故障排除

Q1:点击检测后提示 “venv not set”(未设置环境)?

说明尚未搭建运行环境。请先到 Setup 页点击 Setup Environment,等待其成功填入 venv python 路径后再检测。

Q2:Setup Environment 失败,提示 torch 安装错误?

多为 CUDA wheel 索引与显卡驱动不匹配,或网络中断。请确认已联网,并检查 Torch CUDA wheel index 是否与驱动匹配(如 cu121 / cu124),修改后重试。若 venv 本身创建失败,可在 Base Python (build) 指向另一个 CPython 3.9+。

Q3:检测报错提示 CUDA 不可用或显存不足?

本插件需要 NVIDIA GPU。若日志中的错误类别为 no_cuda,请确认机器有可用的 NVIDIA GPU 且驱动正常;若为 cuda_oom(显存不足),请改用较小的图像/区域,或释放其他占用显存的程序后重试。

Q4:检出的点太多/太少怎么办?

调整 Probability threshold:检出太多、含噪点时调高(更严格);漏检时调低(更宽松)。若出现许多互相很近的重复点,增大 Min distance。若图像模态与荧光差别大(如 CT),预训练模型可能不适用,建议在 Train 页微调。

Q5:首次检测卡在 “loading model” 很久?

首次加载预训练模型需要从网络下载权重(不随插件打包)。请保持联网并耐心等待;完成一次后权重会被缓存。若错误类别为 network,请检查网络连接或代理设置。

Q6:菜单里找不到该插件?

确认在安装器中已勾选该插件(默认未勾选),并且安装后完整重启了 Dragonfly(菜单只在启动时扫描)。也可在 Developer ▸ Prototype Labs... ▸ Menu Item Manager 中勾选后重启。

10. 注意事项与已知限制

  • 需要 NVIDIA GPU 与联网:环境搭建下载数 GB;预训练权重首次检测时下载。
  • 预训练模型面向荧光图像:CT 或其他模态可能需要在 Train 页微调后才有良好效果。
  • 二维 / 三维判定:单层 Channel(形状 (1, y, x))按二维处理(坐标 y/x),多层体数据按三维处理(坐标 z/y/x)。
  • Seed sphere radius 仅影响显示:改变它只改变可视化球体大小,不改变检测到的坐标或数量。
  • 坐标表最多显示 200 行;完整坐标请用 Save as CSV 导出。
  • 概率列可能为空:是否返回逐点概率取决于所用 Spotiflow 版本的返回结构;为空时不影响坐标与计数。
  • 当前仅发行 Windows 运行模式(Run mode 的 wsl 选项预留但未发行)。
  • 停用/卸载不删除环境:venv 与工作目录需要时手动清理。

11. 参考资料

  • Spotiflow 上游项目:https://github.com/weigertlab/spotiflow
  • PyTorch CUDA wheel 索引:https://download.pytorch.org/whl/cu124
  • Prototype Apps 完整安装包安装 / 启用 / 卸载说明:随包 UserManual_用户手册.docx 与安装器内的 README。


Part II English Manual

Contents

1. Overview

2. Use Cases

3. Installation & Enabling

4. Environment & First-Run Setup

5. User Interface

6. Step-by-Step Usage

7. Parameter Reference

8. Outputs

9. FAQ & Troubleshooting

10. Notes & Known Limitations

11. References

1. Overview

Spot / Puncta Detection (spotiflow) is a Dragonfly Prototype Apps plugin that uses the deep-learning Spotiflow model to detect subpixel 2D/3D spots / puncta (fluorescent dots, particles, seed points) in an image Channel. You pick an image Channel, a pretrained model, a probability threshold and a minimum distance; the plugin runs detection on your GPU and returns the result two ways.

  • A MultiROI of seed points: each detected spot is painted as a small sphere and published back into the scene (on the source image grid), ready for measurement and visualization.
  • A coordinate / count table: every spot's subpixel coordinates (y/x for 2D, z/y/x for 3D), an optional probability, and the total count - exportable as CSV.

An optional Train tab lets you fine-tune the model on your own labeled points, adapting it to image types the pretrained models do not cover.

Underlying engine & algorithm

This plugin wraps the open-source Spotiflow project (from the Weigert lab, https://github.com/weigertlab/spotiflow). Spotiflow is built on the PyTorch (CUDA) deep-learning framework: it loads a model via Spotiflow.from_pretrained(name) (or Spotiflow.from_folder(dir) for a fine-tuned model), then calls model.predict(img, prob_thresh=..., min_distance=...) to return subpixel coordinates. The plugin rasterizes those coordinates into small spheres on the source grid and publishes a MultiROI via Dragonfly's publish path.

Isolation (key design)

All heavy work (PyTorch CUDA + Spotiflow) runs in the plugin's dedicated CUDA virtual environment (venv) as a subprocess, communicating over JSON file IPC, and never enters Dragonfly's own Python interpreter. So the large, version-sensitive ML stack never pollutes or slows Dragonfly itself.

License notes

This plugin is a wrapper around Spotiflow. Spotiflow and its dependencies (PyTorch, scikit-image, tifffile, lightning, numpy, etc.) each carry their own upstream licenses - refer to each project's published terms. Pretrained model weights are not bundled with the plugin; they download from the internet on first detection. If you cache or redistribute those weights, confirm their licensing/redistribution terms yourself.

2. Use Cases

The plugin fits any task that needs automated detection and counting of point-like targets. Typical uses include:

  • Fluorescence microscopy signals / puncta, e.g. dots produced by FISH, smFISH.
  • Nuclei or particle centroid localization: locate each target as a subpixel point.
  • Materials science counting/localization of precipitates, bubbles and similar point-like features.
  • Any generic "detect a batch of small dots/bright spots and count them" task.

The pretrained models are trained for fluorescence images. For CT or other modalities, applying a pretrained model directly may work poorly - use the Train tab to fine-tune on a few labeled points.

3. Installation & Enabling

This plugin ships in the Prototype Apps Full Package. To install:

1. Unzip the package to a short folder (e.g. C:\PL\; avoid deep download paths or a OneDrive-redirected Desktop).

2. Double-click Install_FullPackage.bat.

3. In the dialog, choose the core install mode (Fresh / Compatible) and tick "Spot / Puncta Detection (spotiflow)..." in the app list.

4. Click Install and wait for the console to finish.

5. Fully quit and restart Dragonfly (menus are scanned only at startup).

This plugin is unticked by default in the installer (it is a heavy plugin, off by default), so you must tick it to deploy it. Installation downloads nothing; the runtime environment is built later, on first use.

After the restart the plugin appears at Prototype Apps ▸ Spot / Puncta Detection (spotiflow)... (in the Detection group). Clicking it opens a floating panel window.

Change your choice later

The easiest way to enable/disable it is inside Dragonfly: open Developer ▸ Prototype Labs... ▸ Menu Item Manager and tick/untick "Spot / Puncta Detection (spotiflow)..." in the bottom "Prototype Apps (Full Package)" list, then restart Dragonfly. Disabling never deletes the plugin's built environment (venv), so re-enabling is instant. You can also re-run the installer anytime; it remembers your last selection as the new default.

Everything installs under your user profile (%LOCALAPPDATA%), no admin rights needed. Once enabled, the plugin code lives at ...\pythonUserExtensions\GenericMenuItems\Spotiflow\ and ...\pythonUserExtensions\Plugins\OrsSpotiflow_<uuid>\.

4. Environment & First-Run Setup

Before first use you must build the plugin's dedicated environment on the Setup tab. Clicking Setup Environment makes the plugin:

1. Create a fresh virtual environment in venv\ inside the plugin's code directory (by default using Dragonfly's own Python_env\python.exe as the base interpreter - no separate Python needed).

2. Upgrade pip / setuptools / wheel inside that venv.

3. Install torch + torchvision from the CUDA wheel index (default https://download.pytorch.org/whl/cu124).

4. Install the remaining Spotiflow dependencies (spotiflow, numpy, etc.).

5. Run a smoke test importing torch/spotiflow and reporting whether CUDA is available and the GPU name.

Requirements

Item

Required?

Notes

Internet

Yes

Building the venv downloads torch + spotiflow (~ several GB); weights download at first detection.

NVIDIA GPU

Yes

Detection and training use CUDA; without a GPU runs are very slow or may fail.

WSL

No

Only the Windows run mode is shipped.

External software

No

The environment is built locally by the plugin; no third-party app to install.

Where the environment lives

The venv is built inside the installed plugin code directory, i.e. %LOCALAPPDATA%\comet\<DragonflyVersion>\pythonUserExtensions\GenericMenuItems\Spotiflow\venv. Job outputs, exported image .npy, status.json, results.json and other intermediates are written to the Output folder you set on the Apply tab (default ~\SpotiflowWorkspace). Disabling or uninstalling the plugin does not auto-delete the venv or the workspace; clean them manually to reclaim disk space.

Download size & time

The first Setup typically takes several minutes and a few GB of disk (torch CUDA + spotiflow). Later, Setup Environment reuses an existing venv if its pip works; if a previous run left a half-built venv without a working pip, the plugin deletes and rebuilds it automatically.

Fallbacks on failure

  • torch install fails: check that the Torch CUDA wheel index matches your GPU driver (e.g. cu121 / cu124); change it and retry.
  • venv creation fails: point Base Python (build) at another CPython 3.9+ with the stdlib venv + pip (e.g. C:\Python312\python.exe), or a launcher command like py -3.12.
  • base Python has no venv module: as above, point it at Dragonfly's own Python_env\python.exe or a system CPython.

5. User Interface

The panel has a blue description note at the top, then a tab widget with three tabs - Setup, Apply, Train - plus a green result status line and a read-only run log below. Each tab is described below.

5.1 Setup tab

Control

Type

Notes

Spotiflow venv python

Text field

Path to the venv python. Filled automatically by Setup Environment; normally no need to edit.

Base Python (build)

Text field

Base interpreter used to build the venv. Blank = this Dragonfly's own python (recommended); or a path / py -3.12.

Run mode

Dropdown

Run mode: windows (default) or wsl; only windows is shipped.

Torch CUDA wheel index

Text field

pip index URL for the CUDA torch wheels, default https://download.pytorch.org/whl/cu124.

Setup Environment

Button

Builds the venv and installs torch + spotiflow.

5.2 Apply tab

This tab has four groups: Workspace (job/output folder), Input, Detection parameters, and Detected spots (results).

Control

Type / Default

Notes

Output folder

Text field (default ~\SpotiflowWorkspace)

Output directory for jobs and intermediates; browse with "...".

Image Channel (2D or 3D)

Dropdown + Refresh

Pick the image Channel to detect on; click Refresh to reload the list from the scene.

Pretrained model

Editable dropdown (default general)

Pick a pretrained model; choose a built-in one or type any model name.

Probability threshold

Spin box (default 0.5, range 0-1)

Detection confidence threshold; higher = stricter, fewer spots.

Min distance (voxels)

Spin box (default 1.0, range 0-1000)

Minimum voxel distance between two accepted spots; larger suppresses duplicates.

Seed sphere radius (voxels)

Spin box (default 2.0, range 0.5-100)

Radius of the sphere drawn at each spot (voxels); affects visualization only, not detection.

Custom model folder

Text field (optional)

Optional: a fine-tuned model folder; blank uses the pretrained model above. Browse with "...".

Result title

Text field (optional)

Title of the published MultiROI; blank defaults to Spotiflow_spots.

Detect spots -> publish MultiROI + table

Button (green)

Runs detection; on finish publishes the MultiROI and fills the result table.

The results group has a count label (initially "No detection yet."), a monospaced coordinate-table box, and a Save coordinates as CSV... button.

5.3 Train tab (optional: fine-tune)

This tab fine-tunes a model on your own data in two steps:

Control

Type / Default

Notes

Image Channel

Dropdown

Image Channel for a training case.

Points (MultiROI)

Dropdown

A MultiROI whose non-zero voxels mark the spot locations.

Add case

Button

Add the current (image + points) pair to the training-case list.

Clear cases

Button

Clear all added training cases.

Training cases

Count label

Shows the number of accumulated cases; starts at 0.

Base model

Editable dropdown (default general)

The base pretrained model to fine-tune from.

Epochs (0 = default)

Spin box (default 0, range 0-5000)

Training epochs; 0 uses the Spotiflow default schedule.

Model output folder

Text field

Folder to save the fine-tuned model; browse with "...".

Train

Button (blue)

Starts fine-tuning; on finish the model folder is pre-filled into the Apply tab's Custom model folder.

6. Step-by-Step Usage

6.1 Detect spots (end to end)

Input required: a 2D (single-slice) or 3D image Channel loaded in the scene.

1. Open Prototype Apps ▸ Spot / Puncta Detection (spotiflow)....

2. On first use go to the Setup tab and click Setup Environment; wait for the environment to build (the log printing a venv python path means success).

3. Switch to the Apply tab and set the Output folder if needed.

4. Pick the target Channel in Image Channel; if the list is empty or incomplete, click Refresh.

5. Choose a Pretrained model (default general) and adjust Probability threshold (default 0.5) and Min distance (default 1.0) as needed.

6. For larger/smaller visualization spheres, adjust Seed sphere radius (default 2.0).

7. Click the green Detect spots -> publish MultiROI + table.

8. Wait: the status line shows "Done.", the count label shows spots and dimensionality, the coordinate table fills, and a MultiROI named (default) Spotiflow_spots appears in the scene.

9. To export coordinates, click Save coordinates as CSV... and choose a path.

What you get: a MultiROI seed-point object (one sphere per spot) plus a coordinate/count table (exportable as CSV).

6.2 Fine-tune a model (optional)

Input required: environment built; an image Channel plus a MultiROI whose non-zero voxels mark spot locations.

1. Switch to the Train tab.

2. Pick an image in Image Channel and its labels in Points (MultiROI), then click Add case; repeat to add multiple cases.

3. Choose a Base model (default general) and set Epochs (0 = default schedule).

4. Set a Model output folder.

5. Click the blue Train to start fine-tuning.

6. On finish, the model is saved to the folder and auto-filled into the Apply tab's Custom model folder; you can then detect with it on the Apply tab.

Cases with 0 points are skipped automatically; if all cases have no points, training errors out. Label your spots in a MultiROI first.

7. Parameter Reference

Parameter

Default

Description

Pretrained model

general

Pretrained model name; built-in choices are general, hybiss, synth_complex, synth_3d, smfish_3d, or type any other name.

Probability threshold

0.5

Detection probability threshold, 0-1; higher = stricter/fewer, lower = looser/more.

Min distance (voxels)

1.0

Minimum voxel distance between accepted spots, 0-1000; increase to suppress near-duplicate detections.

Seed sphere radius (voxels)

2.0

Radius of the sphere drawn per spot (voxels), 0.5-100; affects MultiROI display only, not the coordinates.

Custom model folder

(empty)

Optional path to a fine-tuned model folder; used instead of the pretrained model when set and present.

Result title

(empty → Spotiflow_spots)

Title of the published MultiROI.

Base model (Train)

general

The base pretrained model name to fine-tune from.

Epochs (Train)

0

Training epochs, 0-5000; 0 uses the Spotiflow default schedule.

Base Python (build)

(empty → Dragonfly's own python)

Base interpreter path or launcher command to build the venv.

Run mode

windows

Run mode; only windows is shipped.

Torch CUDA wheel index

https://download.pytorch.org/whl/cu124

pip index URL for the CUDA torch wheels.

8. Outputs

A successful detection produces the following in Dragonfly:

  • A MultiROI seed-point object: named Spotiflow_spots by default (or your Result title), published into the scene on the source Channel's grid; each detected spot is rasterized as a small sphere whose radius is set by Seed sphere radius. View, color and measure it from Dragonfly's object list (e.g. Data Properties).
  • A coordinate/count table: shown as a monospaced table in the Apply results box. 2D data has columns # / y / x / prob; 3D data has # / z / y / x / prob; the probability column shows "-" if the model returned no per-spot probability. The table shows up to the first 200 rows, with "... (N more)" for the rest.
  • A count label reading "Detected N spot(s) (2D/3D).".
  • A CSV file: Save coordinates as CSV... exports all coordinates (not limited to the 200-row display cap); the 2D header is index,y,x,prob, the 3D header is index,z,y,x,prob.

Training produces a fine-tuned Spotiflow model saved to the chosen folder, which can be reloaded on the Apply tab as the Custom model folder. Detection intermediates (exported image .npy, status.json, results.json) remain in the job directory for troubleshooting.

9. FAQ & Troubleshooting

Q1: Detect says "venv not set"?

The runtime environment is not built yet. Go to the Setup tab and click Setup Environment; once it fills the venv python path, detection will work.

Q2: Setup Environment fails with a torch install error?

Usually a CUDA wheel index that mismatches your driver, or a dropped network. Confirm you are online and check the Torch CUDA wheel index against your driver (e.g. cu121 / cu124), then retry. If the venv itself fails to create, point Base Python (build) at another CPython 3.9+.

Q3: Detection reports CUDA unavailable or out of memory?

The plugin needs an NVIDIA GPU. If the log's error category is no_cuda, confirm a working NVIDIA GPU and driver; if cuda_oom (out of memory), use a smaller image/region or free other GPU memory and retry.

Q4: Too many / too few spots detected?

Adjust Probability threshold: raise it (stricter) when there are too many/noisy spots; lower it when spots are missed. If many near-duplicate spots appear, increase Min distance. If your modality differs greatly from fluorescence (e.g. CT), the pretrained model may not fit - fine-tune on the Train tab.

Q5: The first detection hangs on "loading model"?

The first load must download the pretrained weights (not bundled). Stay online and be patient; once done, the weights are cached. If the error category is network, check your connection or proxy.

Q6: The plugin is missing from the menu?

Make sure you ticked the plugin in the installer (it is unticked by default) and fully restarted Dragonfly (menus are scanned only at startup). You can also tick it in Developer ▸ Prototype Labs... ▸ Menu Item Manager and restart.

10. Notes & Known Limitations

  • Needs an NVIDIA GPU and internet: the environment build downloads several GB; pretrained weights download at first detection.
  • Pretrained models are fluorescence-oriented: CT or other modalities may need fine-tuning on the Train tab for good results.
  • 2D / 3D handling: a single-slice Channel (shape (1, y, x)) is treated as 2D (y/x coordinates); a multi-slice volume is 3D (z/y/x coordinates).
  • Seed sphere radius affects display only: changing it changes only the sphere size, not the detected coordinates or counts.
  • The coordinate table shows at most 200 rows; export the full set with Save as CSV.
  • The probability column may be empty: whether per-spot probabilities come back depends on the Spotiflow version's return structure; an empty column does not affect coordinates or counts.
  • Only the Windows run mode is shipped (the wsl Run mode option is reserved but not shipped).
  • Disabling/uninstalling does not delete the environment: clean the venv and workspace manually when needed.

11. References

  • Spotiflow upstream project: https://github.com/weigertlab/spotiflow
  • PyTorch CUDA wheel index: https://download.pytorch.org/whl/cu124
  • Prototype Apps Full Package install / enable / uninstall: the bundled UserManual_用户手册.docx and the installer's README.
You’ve reached the end of this manual.Explore the library →