SPAM DVC (Panel) - User Manual
Dragonfly Prototype Apps · SPAM DVC (Panel)...
Version 1.0 · 2026-07-04
English Manual
Contents
1. Overview
2. Use Cases
3. Installation and Enablement
4. Runtime Environment and First-Time Setup
5. User Interface
6. Workflow
7. Parameter Reference
8. Outputs
9. FAQ and Troubleshooting
10. Notes and Known Limitations
11. References
1. Overview
SPAM DVC (menu entry SPAM DVC (Panel)...) is a Digital Volume Correlation (DVC) analysis plugin integrated inside Dragonfly. It computes displacement and strain fields between two spatially aligned 3D images (a reference state and a deformed state), non-destructively quantifying internal 3D deformation and strain inside a sample. Results are written back into the Dragonfly scene as new DVC_* Channels, ready for 2D/3D visualization and quantitative measurement.
The plugin runs as a dockable panel (OrsPlugin) directly inside the Dragonfly process: data is read and written in-process (no TCP, no server to start in the Python Console), and image display is left entirely to Dragonfly's own 2D/3D views. Optionally, each run also produces a Word (.docx) analysis report with parameters, slice images, statistics, and interpretation.
Underlying engine / algorithm. The compute kernel is the open-source package SPAM (Software for the Practical Analysis of Materials), a Python + C++ materials-image analysis package developed and maintained by the spam-project team (Grenoble, France; E. Andò, O. Stamati, et al.), widely used for DIC/DVC full-field deformation measurement on X-ray CT images. The plugin uses its spam.DIC (correlation), spam.deformation (deformation/strain) and spam.mesh (mesh) modules and offers two DVC algorithms: Local Subset and Global FEM, both run in WSL2.
The SPAM kernel runs under Linux (WSL2), avoiding the difficulty of compiling SPAM on Windows. The whole DVC job runs on a background worker thread, so the Dragonfly UI stays responsive during computation.
License note: SPAM is open-source software under the GPL license. Official docs: https://www.spam-project.dev/ ; source on GitLab: https://gitlab.com/spam-project/spam . Please honor the corresponding open-source license and citation requirements when using its computed results.
2. Use Cases
This plugin is ideal for in-situ CT experiments, where the same sample is imaged before and after loading (or across several deformation stages) to quantify internal displacement and strain. Typical applications include:
- Mechanics of materials: internal deformation and strain measurement during compression/tension tests on rocks, soils, foams, composites, and additive-manufactured (AM) parts.
- Biomechanics: strain-distribution studies of bone or tissue under loading.
- Industrial CT quality studies: quantifying internal deformation and strain, assessing defects, crack evolution and interface slip.
- Time-series studies: evolution of the deformation field across multiple loading stages (creep, fatigue).
Reliable DVC results require sufficiently rich and stable 3D grayscale texture — from the material's natural microstructure (pores, trabeculae, grains) or from artificially added tracer particles. The reference and deformed volumes should be the same sample at the same resolution, imaged at two stages, and already spatially registered/aligned in Dragonfly (see Chapter 6).
3. Installation and Enablement
1. Download the Prototype Apps online package from ImageFly and extract it. Close Dragonfly, run install_prototype_apps.exe and select the Dragonfly version to install into.
2. Start Dragonfly, open Prototype Apps ▸ App Store and search for SPAM DVC (Panel). If an Enable button is shown, click it and follow the sign-in, download or installation prompts.
3. Restart Dragonfly when prompted, then open SPAM DVC (Panel) from the Prototype Apps menu. Return to App Store to enable or disable it later.
To uninstall all Prototype Apps, close Dragonfly and run uninstall_prototype_apps.exe from the online package.
The WSL2 compute environment is a separate setup step. See Chapter 4 for the import procedure.
4. Runtime Environment and First-Time Setup
Unlike many Prototype Apps plugins, SPAM DVC does not compute inside Dragonfly's own Python and has no "Setup Environment" button; its heavy compute kernel (SPAM) runs inside WSL2 (Windows Subsystem for Linux 2). The plugin side needs no downloads (python-docx for the report is vendored as a pure-Python copy inside the plugin), but the compute side must have a WSL2 + SPAM environment prepared once.
4.1 Prerequisites
- WSL2: required. If not installed, run
wsl --install --no-distributionin an admin PowerShell and reboot; on PCs that already have WSL runwsl --update. - Internet: not required for downloads when using the shipped prebuilt WSL environment (rootfs ~1.5 GB, provided offline in the distribution package).
- GPU: not required. DVC computation is CPU-based.
- External software: Global FEM with an unstructured mesh additionally requires Gmsh inside WSL (not needed for normal analysis).
4.2 Option A: use the shipped one-click WSL installer (recommended)
Copy the SpamDVC-WSL-Package folder from the distribution to the target PC and double-click install_spam_dvc_wsl.bat. The installer will:
1. import a compute distro named SpamDVC (a modified SPAM 0.8.1.4 + spambind + venv + worker);
2. run a smoke self-check (verifying the default user, import spam.DIC/deformation/mesh, and that the worker starts);
3. create the Windows↔WSL job-exchange folder C:\DVCJobs;
4. write the plugin config file %LOCALAPPDATA%\SpamDvc\wsl_config.json.
Afterwards, the four "Backend Engine (WSL2)" fields in the panel are auto-filled from that config file, with no manual setup needed.
4.3 Option B: build your own WSL environment (without the package)
Create a Python virtual environment in any WSL2 distro and install spam (pip package or compiled from source, see the official SPAM docs), copy the plugin's spam_dvc_worker.py into WSL (e.g. /home/<user>/spam_dvc_worker.py), then fill in the four "Backend Engine (WSL2)" fields manually (meanings in §5.4).
If the panel WSL fields still show the old hard-coded defaults (e.g. Distro = Ubuntu), it means %LOCALAPPDATA%\SpamDvc\wsl_config.json was not read: run the WSL package installer, or fill the four fields manually. Panel settings are not saved and revert to defaults / prefill each time it opens.
4.4 Install locations
- Config file:
%LOCALAPPDATA%\SpamDvc\wsl_config.json(source of the panel WSL prefill). - Job-exchange folder:
C:\DVCJobs(Windows and WSL exchange data via/mnt/c/..., created by the WSL installer). - WSL distro: named
SpamDVCby default (contains the/home/dragonfly/spam_envPython andspam_dvc_worker.py).
5. User Interface
A red note is always shown at the top of the panel, reminding you to align the two volumes in Dragonfly with rigid registration first (if their geometry differs, the plugin resamples the deformed volume onto the reference grid before measuring the residual local deformation). Below it is a scrollable form arranged into the following groups.
5.1 Input (from Dragonfly)
The Channel and ROI lists refresh automatically from the live session (polled about every 2.5 s, following the current project — no manual Refresh button needed). Three dropdowns:
- Reference Channel: the reference (undeformed) volume.
- Deformed Channel: the deformed (post-load) volume.
- Processing ROI (optional): an optional ROI, default
(none / full volume). When selected, the analysis is cropped to its bounding box, which can significantly speed things up and save memory.
Each entry is shown as Title [Z×Y×X] for easy identification by size.
5.2 DVC Parameters (common)
- DVC Mode: dropdown,
Local Subset (WSL2)(default) orGlobal FEM (WSL2). - Subset size (Local): text field, default
40. Edge length of the local correlation window (voxels). - Node step: text field, default
15. Spacing between compute nodes (voxels). - Margin (Local): text field, default
1. How far nodes shrink from the boundary (voxels). - Compute strain fields: checkbox, checked by default. Whether to compute the strain field after displacement.
- Resample deformed → reference geometry (if mismatched): checkbox, checked by default. Resamples the deformed volume onto the reference grid when geometries differ.
- Auto-align mismatched volumes (crop to common size): checkbox, checked by default. Crops to a common voxel size when the two volumes differ (crop only, not registration).
- Align anchor: dropdown,
Center(default) orOrigin, controlling that crop's anchor. - Grayscale preprocess: dropdown, default
None; alsoHistogram match (def→ref),Min-max [0,1],Standardize (ZNCC).
5.3 Global FEM Parameters (used in Global mode)
- Mesh type: dropdown, currently only
structured(regular hexahedral structured mesh). - Element size: text field, default blank (placeholder "blank = auto from node step"), i.e. auto = Node step.
- Use Gmsh (optional): checkbox, unchecked by default. Enable when an unstructured mesh is needed (Gmsh must be installed in WSL).
- Global Gaussian pre-blur: checkbox, checked by default. Gaussian smoothing before computation.
- Max iterations: text field, default
20. Global iteration cap. - Convergence criterion: text field, default
0.01. Convergence threshold. - Enable elasticity regularisation: checkbox, checked by default. Elastic-mechanics regularization.
- Young's modulus: text field, default
0.0001. Regularization strength (empirical, no physical unit).
5.4 Backend Engine (WSL2)
Four text fields, with defaults from wsl_config.json (falling back to hard-coded defaults if absent):
- WSL Python Path: absolute path of the Python interpreter inside WSL (default
/home/dragonfly/spam_env/bin/python). - WSL Worker Path: absolute path of the worker script inside WSL (default
/home/dragonfly/spam_dvc_worker.py). - Win Job Root: the Windows job folder (default
C:\DVCJobs). - WSL Distro: distro name (default
Ubuntu; usuallySpamDVCafter using the package).
5.5 Output
- Output dir (.npz/.json): text field, results collection directory (default
C:\DVCJobs\output). - Generate .docx report after each run: checkbox, checked by default. Generates a graphical report in the Output dir after each successful run.
- Report in Chinese (中文报告): checkbox, unchecked by default (i.e. English report); tick to produce a Chinese report.
5.6 Run / Stop and log
- Run DVC (blue button): starts a DVC computation (runs on a background thread).
- Stop (red button, enabled only while running): requests an abort; an in-progress WSL subprocess may still run to completion.
- The read-only log area at the bottom shows job-folder creation, WSL worker startup, progress percentage, result write-back, etc., and is the first place to look when troubleshooting.
6. Workflow
6.1 Data prep: register first, then DVC
This is the most important prerequisite. DVC only measures "small strains in an already-aligned state." Any overall translation/rotation between the two volumes must first be removed in Dragonfly by rigid registration / manual alignment, otherwise the result will be noise or false displacement. Note:
- the reference and deformed volumes should be the same sample at the same resolution, scanned at two stages;
- the voxel size (spacing) of the two Channels should match;
- use rigid registration upstream — deformable registration would remove the very deformation DVC measures;
- Dragonfly registration only changes geometry (origin / orientation / spacing), not the voxel grid, so the plugin resamples the deformed volume onto the reference grid when geometries differ (see the "Resample" checkbox).
6.2 End-to-end steps
1. In Dragonfly, spatially register/align the reference and deformed volumes.
2. Open the panel: Prototype Apps ▸ SPAM DVC (Panel)...; it docks on the right of Dragonfly.
3. Under "Input (from Dragonfly)", select the Reference Channel and Deformed Channel (the lists refresh automatically, no button needed); optionally select a Processing ROI to shrink the analysis region.
4. Choose the DVC Mode (Local Subset is fine the first time) and set parameters per Chapter 7 (you can keep all defaults the first time).
5. Confirm the four "Backend Engine (WSL2)" fields are correct (auto-filled when using the package), and set the "Output dir" and report options as needed.
6. Click Run DVC. The log shows job-folder creation, WSL worker startup, progress percentage, etc.; you can keep working in Dragonfly during computation, or click Stop to abort.
7. When finished, the log reports success and DVC_* result Channels appear in the Dragonfly data list (meanings in Chapter 8); if the report option is checked, a <dataname>_<timestamp>.docx report is also generated in the Output dir.
Inputs → action → outputs: inputs are two aligned 3D Channels with sufficient grayscale texture; the action is select data, set parameters, Run DVC; the outputs are the DVC_* displacement/strain Channels written back to the scene (ready for visualization and measurement), plus .npz/.json result files in the job folder and an optional .docx report.
7. Parameter Reference
The table below lists every DVC parameter in the panel with its default and meaning. Unless noted, all lengths are in voxels.
Parameter | Default | Description & advice |
DVC Mode | Local Subset | Algorithm. Local suits normal, high-contrast data and is sensitive to localized deformation (cracks, slip); Global suits low-contrast data, smooth continuous results, or time-series analysis. |
Subset size (Local) | 40 | Edge length of the local correlation window. Must contain enough texture: fine texture 20–30, coarse/high-noise 40–60; too large smooths out strain gradients. |
Node step | 15 | Spacing between compute nodes; sets result resolution and run time. Small data (≈100³) 5–10, large data (≥200³) 15–30; do a coarse pass first, then densify. |
Margin (Local) | 1 | How far nodes shrink from the boundary to keep subsets in bounds; usually keep the default. |
Compute strain fields | checked | Whether to compute the strain field (principal strains, volumetric, von Mises, etc.) after displacement. Adds a little time; keep it checked. |
Resample deformed → reference geometry | checked | Resamples the deformed volume onto the reference grid when geometries differ, so DVC compares the same world points. Use with rigid registration upstream. |
Auto-align mismatched volumes | checked | Crops both volumes to a common voxel size when they differ (crop only, no registration). |
Align anchor | Center | Anchor of that crop: Center (crop about the center, common) or Origin (crop about the origin/corner). |
Grayscale preprocess | None | Preprocessing for grayscale drift: Histogram match (try first, def→ref), Min-max [0,1], Standardize (ZNCC) zero-mean unit-variance; keep None when grayscale is consistent. |
Mesh type (Global) | structured | Currently a regular hexahedral structured mesh only. |
Element size (Global) | blank (=Step) | Finite-element size; blank = auto = Node step; 1–2× the step balances accuracy and time. |
Use Gmsh (Global) | off | Enable when an unstructured mesh is needed (Gmsh must be installed in WSL); not needed for normal analysis. |
Global Gaussian pre-blur | checked | Gaussian smoothing before computation to suppress noise and improve convergence; can be off for high-quality data. |
Max iterations (Global) | 20 | Global iteration cap; 10–20 is enough for simple deformation, raise it for complex deformation or strong regularization. |
Convergence criterion (Global) | 0.01 | Converges when the displacement change between iterations is below this; lower it for higher accuracy (iterations increase). |
Enable elasticity regularisation (Global) | checked | Elastic-mechanics regularization to suppress noise-induced fluctuation; recommended for low-quality data. |
Young's modulus (Global) | 0.0001 | Regularization strength (empirical, no physical unit): lower it if results are too smooth, raise it if noise is obvious. |
Output dir | C:\DVCJobs\output | Collection directory for result files (.npz/.json) and the .docx report. |
Generate .docx report after each run | checked | Generates a graphical report in the Output dir after a successful run (background thread; a failure only logs and does not affect results). |
Report in Chinese (中文报告) | unchecked | Unchecked = English report; checked = Chinese report. |
7.1 Tuning advice by data type
Data type | Suggested strategy |
High-quality CT (metals, ceramics — high contrast) | Local mode, Step 10–15, Subset 30–40; reduce Step for higher resolution when needed. |
Low contrast (resin-cast cores, etc.) | Global mode, Element size ≈ 20–30, enable regularization and Gaussian smoothing; tweak Young's modulus from the default. |
Cracks / localized deformation | Local mode captures discontinuities better; increase Subset (40–50) and reduce Step. |
Time series (creep, fatigue) | Use exactly the same parameters at every stage; prefer Global mode for temporally more stable fields. |
Two scans with grayscale drift | Set Grayscale preprocess to Histogram match; if still odd, try Standardize (ZNCC). |
8. Outputs
8.1 Result Channels written back to Dragonfly
After computation the following DVC_* Channels are created automatically (same geometry as the reference data, so they can be overlaid, sliced, and measured quantitatively). Which ones appear depends on the algorithm and whether "Compute strain fields" is checked:
Channel name | Meaning |
DVC_Disp_Mag | Displacement-vector magnitude |u| (voxels), the most common displacement visualization. |
DVC_Principal_E1 | Largest principal-strain field E1. |
DVC_VonMises_Strain | von Mises equivalent strain EvM: a scalar of overall distortion, often used to identify deformation localization. |
DVC_<other strain name> | Other strain fields returned by the backend (e.g. principal E2/E3, volumetric, max shear) are written back with a DVC_ prefix on their name. |
Suggested viewing: apply a pseudo-color LUT to a result Channel and overlay it on the reference grayscale volume; use Dragonfly's slice/histogram tools for quantitative analysis; 3D-render to see the spatial form of the deformation distribution.
8.2 Output files
Each job creates its own directory under the Job Root (C:\DVCJobs), containing this job's input data and full parameters (ref.npy/def.npy/params.json, for reproducing the analysis), the run state and progress status.json (with a full traceback on error — first stop for troubleshooting), and the displacement/strain result files.
The Output dir (default C:\DVCJobs\output) also stores a summary array .npz and its _meta.json (for later Python / MATLAB processing).
8.3 The optional .docx analysis report
If "Generate .docx report after each run" is checked, a graphical report named <dataname>_<timestamp>.docx is created in the Output dir, with 8 sections: 1) Summary and key findings; 2) About DVC; 3) About the SPAM software; 4) Methodology and parameters; 5) Input data overview (with slice images / histograms); 6) Analysis results (displacement field, strain statistics, per-field strain maps); 7) Interpretation guide; 8) Output files and compute environment. The report language is set by the "Report in Chinese" checkbox (English by default).
The report is generated on a background worker thread and is best-effort: even if it fails, it only logs a message and does not affect the DVC results or Channel write-back.
9. FAQ and Troubleshooting
Problem | Fix |
No "SPAM DVC (Panel)" in the menu | Confirm that SPAM DVC (Panel) is enabled in Prototype Apps ▸ App Store, then restart Dragonfly. |
WSL job fails to start | Run |
Panel WSL fields show old defaults (Ubuntu) | It means |
Unreasonable / all-noise results | Most common cause is that the two Channels are not registered/aligned — do rigid registration in Dragonfly first; then try a larger Subset size, Global mode with regularization; check grayscale drift and enable Grayscale preprocess = Histogram match. |
Error during computation | The log prints the worker's full traceback (from status.json); common causes: out of memory, an ROI too small to place nodes, or an invalid parameter combination. |
Out of memory / PC sluggish | Set a memory cap in |
Job is very slow | Do a quick pre-analysis with a large Step (e.g. 30) and an ROI; make sure the job folder is on a local SSD, not a network drive; Global mode being slower than Local is normal. |
Geometry mismatch, DVC cannot run directly | Tick "Resample deformed → reference geometry" and retry, or first align the two volumes with rigid registration / resampling in Dragonfly. |
10. Notes and Known Limitations
- Register first: DVC only measures small strains; any overall translation/rotation between the two volumes must be removed by rigid registration first — deformable registration would erase the deformation to be measured.
- Input only from Dragonfly: the plugin currently only selects the reference/deformed Channels from the live Dragonfly session; there is no direct file-input or synthetic-data input mode.
- Panel settings are not saved: each open reverts to defaults / prefill; using the package lets
wsl_config.jsonavoid re-entering the WSL fields. - Global FEM supports structured meshes only: currently Mesh type is
structured; an unstructured mesh requires Gmsh in WSL plus ticking Use Gmsh. - Displacement/strain units are voxels:
DVC_Disp_Magetc. are in voxels; convert to physical units using the voxel size if needed. - Stop is a soft cancel: after clicking Stop, an in-progress WSL subprocess may keep running until it completes.
- Typical strain magnitudes: elastic stage ~0.1%–1%, plastic stage 10%–50%; if measured strains are far beyond expectation, suspect registration/parameter problems first.
11. References
- SPAM official docs: https://www.spam-project.dev/
- SPAM source (GitLab): https://gitlab.com/spam-project/spam
- Compute kernel version: SPAM 0.8.1.4 (locally modified) + spambind 0.8.2, running on WSL2 Ubuntu; license GPL.
- Supported versions are Dragonfly 2025.1 (Python 3.10) and 2027.1 (Python 3.14). SPAM and its dependencies run separately in the imported WSL2 environment.
- For online installation and plugin activation, see Chapter 3.