Hands-on WorkshopsChinese & English

From STL to Image

From STL to Image is a hands-on project — the inverse of 'From Image to STL: The Basics': it turns a surface-only STL mesh, step by step, back into a solid 3D binary image (voxels). This process is called voxelisation.

Updated 2026-07-26User manual

From STL to Image(从 STL 到图像 · 上手练习)

From STL to Image (Hands-on Workshop) - User Manual

Dragonfly Prototype Apps · From STL to Image...

版本 Version 1.0 · 2026-07-26


第一部分 中文手册

目录

1. 简介

2. 完整流程(六步)

3. 两种包围盒的差别(重点)

4. 两大设计特点

5. 使用步骤

6. 环境需求

1. 简介

From STL to Image(从 STL 到图像) 是一个上手练习项目,是“从图像到 STL:入门”的逆过程:把一个只有表面的 STL 网格,一步步变回一张实心的三维二值图像(体素)。这个过程叫体素化(voxelization)。

本功能由第三方(Prototype Labs / Prototype Apps)提供,非 Dragonfly 官方开发或支持,使用风险自负。证书页生成的完成证书亦非官方认证,仅供个人记录。

2. 完整流程(六步)

步骤

输入 → 输出

一句话

1. 导入 STL

.stl → 网格

读入表面

2. 包围盒

网格 → Box

框住物体、定坐标系

3. 空白 ROI

Box + 间距 → 空 ROI

在盒子里铺空网格

4. Export Mesh to ROI

网格 + 空 ROI → 壳 ROI

把表面标进体素

5. 填充

壳 ROI → 实体 ROI

把空心填实

6. 转图像

实体 ROI → 二值图像

变成 0/1 体数据

3. 两种包围盒的差别(重点)

维度

最小包围盒 AABB

有向包围盒 OBB

朝向

对齐世界 X/Y/Z 轴

旋转到贴合物体主轴

松紧

物体倾斜时较松,浪费空体素

最紧,空体素最少

结果图像

与原坐标轴对齐,直观

沿物体主轴,图像看起来被摆正/旋转

简单度

最简单(默认)

需要 PCA 计算方向

本应用中两者均可用:想要与原摆放一致、轴对齐的图像用 AABB;想要最紧凑、把物体摆正、最省体素的图像用 OBB。

4. 两大设计特点

  • 用真正的原生操作:第 2–6 步调用 Dragonfly 对象模型的原生 API(getBoundingBox / copyShapeFromBox / Export Mesh to ROI = mesh.getAsROI / fillInnerHoles / getAsChannel),并已验证可在进程内运行。
  • 既能一键完成,也教你手工操作:每一步都有“▶ 操作按钮”和“🖱 在 Dragonfly 界面里怎么做”弹窗;并用大量“📖 讲解”弹窗解释基础概念(网格、体素化、包围盒、AABB vs OBB、结构化网格、间距与尺寸、Export Mesh to ROI、填充、二值图像等)。

5. 使用步骤

1. 在“导入 STL”页点“生成示例 STL”(或导入自己的 STL)。

2. 在“包围盒”页选 AABB 或 OBB,点“创建包围盒”。

3. 在“空白 ROI”页设体素间距(建议相同),点“由包围盒创建空白 ROI”,查看报告的维度。

4. 在“Export Mesh to ROI”页点按钮,得到空心壳。

5. 在“填充”页点“填充内部空洞”,得到实体。

6. 在“二值图像”页点“把 ROI 转成二值图像”。

7. 完成后在“证书”页填写姓名生成完成证书。

6. 环境需求

无需安装、无需联网、无需 GPU、无需虚拟环境。核心动手环节用 Dragonfly 自带的 numpy/scipy/trimesh 在进程内运行。STL/OBJ/PLY 导入用 trimesh;若原生填充在斜置网格上填不动,会自动回退到稳健的逐轴 scipy 填充。


Part II English Manual

Contents

1. Introduction

2. The whole pipeline (6 steps)

3. The two bounding boxes (key)

4. Two design features

5. How to use

6. Requirements

1. Introduction

From STL to Image is a hands-on project — the inverse of 'From Image to STL: The Basics': it turns a surface-only STL mesh, step by step, back into a solid 3D binary image (voxels). This process is called voxelisation.

This feature is provided by a third party (Prototype Labs / Apps), not officially developed or supported by Dragonfly. The completion certificate is also unofficial — for personal record only.

2. The whole pipeline (6 steps)

Step

Input → Output

In a nutshell

1. Import STL

.stl → mesh

read the surface in

2. Bounding box

mesh → Box

frame the part, set the frame

3. Empty ROI

box + spacing → empty ROI

lay an empty grid in the box

4. Export Mesh to ROI

mesh + empty ROI → shell ROI

mark the surface into voxels

5. Fill

shell ROI → solid ROI

fill the hollow interior

6. To image

solid ROI → binary image

make a 0/1 volume

3. The two bounding boxes (key)

Dimension

Minimal box (AABB)

Oriented box (OBB)

Orientation

aligned to world X/Y/Z

rotated to hug the part's axes

Tightness

looser for tilted parts, wastes voxels

tightest, fewest empty voxels

Resulting image

aligned to original axes, intuitive

along the part's axes; looks straightened/rotated

Simplicity

simplest (default)

needs a PCA to find the axes

Both work in this app: use AABB for an image aligned to the original placement; use OBB for the tightest, straightened, most voxel-efficient image.

4. Two design features

  • Uses the real native operations: steps 2–6 call Dragonfly's object-model native API (getBoundingBox / copyShapeFromBox / Export Mesh to ROI = mesh.getAsROI / fillInnerHoles / getAsChannel), verified to run in-process.
  • One-click AND learn-by-hand: every step has a '▶ action button' and a '🖱 How to do this in the Dragonfly GUI' pop-up; plus many '📖 Learn' pop-ups explaining the basics (mesh, voxelisation, bounding box, AABB vs OBB, structured grid, spacing vs size, Export Mesh to ROI, fill, binary image).

5. How to use

1. On 'Import STL' click 'Create a sample STL' (or import your own STL).

2. On 'Bounding Box' choose AABB or OBB and click 'Create bounding box'.

3. On 'Empty ROI' set the voxel spacing (equal suggested), click 'Create empty ROI from box', and check the reported dimensions.

4. On 'Export Mesh to ROI' click the button to get a hollow shell.

5. On 'Fill' click 'Fill inner holes' to get a solid.

6. On 'Binary Image' click 'Convert ROI to binary image'.

7. Finish on the 'Certificate' tab by entering your name to generate a completion certificate.

6. Requirements

No install, no internet, no GPU, no venv. The core actions run in-process on Dragonfly's own numpy/scipy/trimesh. STL/OBJ/PLY import uses trimesh; if the native fill can't fill a shell on an oblique grid, it automatically falls back to a robust per-axis scipy fill.

You’ve reached the end of this manual.Explore the library →