Reconstruction & ImagingEnglish

Volume Registration (Elastix)

Aligns one 3D Channel (the moving image) onto another (the fixed image) using the open-source elastix toolkit (Apache 2.0, built on ITK). Translation, rigid, affine and B-spline free-form deformation are available alone

Updated 2026-08-01User manual

Volume Registration (Elastix) - User Manual

Dragonfly Prototype Apps · Volume Registration (Elastix)...

Version 1.0 · 2026-08-01


English Manual

Contents

1. Introduction

2. Use cases

3. Installation & enabling

4. Runtime environment & first-run setup

5. Interface

6. How to use

7. Parameters

8. Output

9. FAQ & troubleshooting

10. Notes & known limitations

11. References

1. Introduction

Aligns one 3D Channel (the moving image) onto another (the fixed image) using the open-source elastix toolkit (Apache 2.0, built on ITK). Translation, rigid, affine and B-spline free-form deformation are available alone or chained — "rigid + bspline" does a global alignment first and a local deformation second, which is the standard elastix workflow.

The panel has 6 numbered steps. Changing anything upstream invalidates the result; registration runs on a worker thread in a separate process, and cancelling or failing publishes nothing.

Everything is computed in physical millimetres. Anisotropic voxels need no resampling — passing elastix the true spacing is both correct and lossless. (This differs from the Structure Scale Analyzer, where an erosion step is a voxel operation and resampling genuinely is required.)

A registration that made things worse is not dressed up as success. The results tab reports RMS before and after with an improvement percentage; if the alignment got worse it says so, and publishing the registered Channel is refused.

2. Use cases

  • Aligning two scans of one specimen: in-situ experiments, before/after loading, ageing, corrosion.
  • Multi-modal or multi-energy registration (use the Mattes mutual-information metric).
  • Carrying a finished segmentation from one scan to another, via the ROI / MultiROI warping in step 4.
  • Template or atlas registration.
  • Aligning data acquired at different resolutions or fields of view.

3. Installation & enabling

1. Install the Prototype Apps package (or tick this plugin in the App Store).

2. This plugin is disabled by default — enable it in Prototype Apps ▸ App Store.

3. Restart Dragonfly completely (plugins are discovered at startup only).

4. Open it from: Prototype Apps ▸ Volume Registration (Elastix)… (group: Reconstruction & Imaging).

4. Runtime environment & first-run setup

On Dragonfly 2027.1 (Python 3.14) the bundled Python cannot build this environment: install a python.org Python (3.12, 3.13 or 3.14) and enter it in the panel's Base Python field; Dragonfly 2025.1 needs no separate Python.

On first use press Set up environment (numpy + itk-elastix) in step 1. It builds an isolated virtual environment and downloads about 120 MB of prebuilt wheels (CPython 3.10 / Windows, no compiler needed). After that it works offline.

Why an isolated environment? ITK ships its own copies of several libraries that Dragonfly also carries, and the repo rule is that Dragonfly's bundled Python is never modified. Registration therefore runs as a subprocess, exchanging .npy files through a job folder.

Setup finishes by importing itk once and checking the elastix entry points — better to fail during setup, with the pip log still on screen, than during the user's first registration. Check environment re-verifies at any time and reports the ITK version.

The job root defaults to C:\ElastixJobs and follows the App Store's global job-root setting. Each run creates a timestamped subfolder holding the inputs, elastix.log, runner_log.txt, the transform files and every output.

5. Interface

The header always shows the environment, the current input, the running task, a progress bar and Cancel.

1. Setup

The venv interpreter, an optional base interpreter, the job root, and the setup / check buttons.

2. Input & Masks

Pick the fixed and moving Channels (published objects only), the timestep, and optional fixed / moving mask ROIs. Shapes and spacings are shown, with warnings where they matter: mismatched shapes, anisotropic spacing, or the same object picked twice.

3. Transform & Parameters

The transform chain, number of resolutions, iterations per resolution, metric, B-spline final grid spacing, samples per iteration, whether to compute the deformation field, and a manual voxel size for objects that carry no geometry.

4. Preview & Run

One line spelling out exactly what will run — including the auto-generated grid-spacing schedule and any parameter forced by a mask — plus the optional ROI / MultiROI to warp alongside, then Run.

5. Results

RMS before and after, improvement percentage, the stages actually run, timing, shape, ITK version, the job folder, and (if computed) the maximum and mean deformation magnitude.

6. Apply & Export

Publish the registered Channel, the deformation-magnitude Channel, or the warped ROI / MultiROI; export the results as JSON; open the job folder.

6. How to use

1. Press Set up environment in step 1 (first time only) and wait for "itk-elastix ready".

2. In step 2 pick the fixed and moving Channels, adding masks if useful.

3. In step 3 try the default rigid chain first and confirm the global alignment works.

4. For local deformation switch to rigid+bspline and set the grid spacing to your structure scale.

5. In step 4 optionally choose an ROI / MultiROI to warp too, then Run.

6. Check the improvement percentage in step 5, then publish or export in step 6.

7. Parameters

Parameter

Default

Range

Meaning

Transform chain

rigid

6 chains

each stage is initialised from the previous one, coarse to fine

Resolutions

4

1…8

pyramid levels; changing this automatically regenerates the B-spline grid-spacing schedule

Iterations per resolution

256

1…5000

maximum optimiser iterations at each level

Metric

mattes

mattes / ssd / ncc

mattes across modalities; ssd for identical intensities; ncc for a linear relationship

B-spline final grid spacing

finest voxel × 10

0.1…1000 mm

how soft the deformation is — smaller is softer and easier to overfit

Samples per iteration

2048

64…100000

random samples; more is steadier but slower

Compute the deformation field

off

on / off

per-voxel displacement magnitude in mm, publishable as a Channel

Override voxel size

off

on / off

only for objects that carry no geometry

8. Output

Output

Meaning

RMS before / after

root-mean-square intensity difference between fixed and moving

improvement %

how much misalignment was removed; negative means the registration made it worse

stages

the stages actually run

max / mean deformation (mm)

deformation magnitude statistics, when the field was computed

Registered (elastix)

the aligned moving image, published as a new Channel

Deformation magnitude (mm)

per-voxel displacement, published as a new Channel

Registered ROI / labels

the segmentation warped by the same transform, nearest neighbour

TransformParameters.N.txt

the fitted transform, kept in the job folder and reusable

9. FAQ & troubleshooting

  • The improvement percentage is negative — the optimiser diverged. Try fewer resolutions or the plain rigid chain; for multi-modal data make sure the metric is mattes; a mask that excludes background often helps. The plugin will not publish in this state.
  • A failure mentions elastix.log — the tail of elastix's own log is attached to the error and names the parameter it objected to. The full log is in the job folder.
  • Set up environment fails — usually network or proxy; the error carries the tail of the pip log. You can point step 1 at a specific base interpreter (Python 3.10).
  • The two Channels have different shapes — elastix can still register them, but RMS before/after cannot be computed. The panel says the comparison is unavailable rather than showing 0.
  • Warped labels contain odd values — this should not happen: ROI and MultiROI warping is forced to nearest neighbour. If you see it, please report the job folder.
  • B-spline is slow — expected; it is an order of magnitude slower than rigid. Explore parameters at a low resolution/iteration count first.

10. Notes & known limitations

  • The whole volume is read into memory and written to the job folder as float32. Crop very large volumes first.
  • Inputs must be published Channels; unpublished objects do not appear in the pickers.
  • Publishing is a separate step. Nothing is published automatically when a run finishes — choose it explicitly in step 6.
  • A moving mask automatically turns ErodeMask off, otherwise the mask erodes to nothing at the coarsest resolution and elastix reports that every sample fell outside the image.
  • No registration algorithm is reimplemented here — elastix does the work; the plugin provides the Dragonfly integration and the parameter handling.
  • Reinstalling the plugin refreshes the code and runner but keeps the venv and elastix_config.json.

11. References

S. Klein, M. Staring, K. Murphy, M.A. Viergever, J.P.W. Pluim, "elastix: a toolbox for intensity based medical image registration", IEEE Transactions on Medical Imaging, 29(1), pp. 196–205, 2010. Please cite it if you publish results obtained with this plugin. elastix and ITK are both Apache 2.0 licensed.

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

PROTOTYPE APPS

Manual assistant

Find an app, understand a parameter, or follow a workflow. Answers include links to the manuals.

Questions and answers are saved long-term to your account. You and site administrators can view them; they may be reviewed to improve the product. Do not submit passwords or confidential data.

All models share a daily allowance. Larger models use more. Chat pauses at the daily protection limit; manual search remains available.

Search the manuals

Cloudflare AI receives your question, recent conversation and relevant public manual excerpts. Records are stored privately in Cloudflare R2 without automatic expiry. Check the cited manual before acting on an answer.