Unsupervised classification and phase mapping for 4D-STEM (4DSTEM, four-dimensional STEM) and scanning electron diffraction (SED) — also nanobeam electron diffraction (NBED) and nanodiffraction. It groups your diffraction patterns into distinct structural regions and shows you why — no labels, no coding.
Free · Windows · a one-time ~15-minute setup, then double-click to run.
Point it at a scan. It groups every diffraction pattern into structurally distinct classes — phases, crystallinity, texture — paints them on a map of your sample, and gives you the evidence behind each class.
|
Groups every diffraction pattern into distinct classes with no labels and no hand-tuning. Just load a scan and go. |
See why each region is its own class — its diffraction as a single frame, a grain average, or the whole class — plus attribution maps and an NMF baseline to check the answer. |
A desktop app plus a plain-English assistant. Double-click to launch — or just ask “load this file, then train.” |
Every class is checkable. Look at its diffraction as a single frame, a grain average, or the whole-class average — the noise falls away and the Bragg spots sharpen as you zoom out.
Point it at the files you already have — nothing is uploaded, everything stays on your machine.
| Format | Source / detector | Notes |
|---|---|---|
.prz · .npz · .npy |
py4DSTEM / NumPy cubes | memory-mapped, low RAM |
.h5 · .hdf5 master |
Dectris / Eiger / EMPAD masters | stitches external links; asks scan shape if 3-D |
.dm4 · .dm3 |
Gatan | reads calibration from metadata |
.raw |
EMPAD | metadata rows cropped automatically |
.mib (+ .hdr) |
Quantum Detectors Merlin / Medipix3 | counting mode |
| folder of images | .tif / .png / .jpg / … |
numbered by scan order → cube (greyscale + optional binning) |
Beam-sensitive samples force you below the dose that gives a clean pattern. The Pre-processing tab now has one-click self-supervised denoising — no clean reference, no repeated acquisition. One exposure is enough.
🌀 Denoise (Noise2Noise, binomial). Every pattern is a Poisson draw, so a fair coin flip per electron deals its counts into two independent half-dose exposures of the same signal (Poisson thinning). A small, deliberately low-capacity dose-equivariant network learns to map one half to the other, then runs on the full exposure. Total counts are preserved — and there is no parameter to tune.
📉 Flatten (radial background). Removes the azimuthally-symmetric radial background — the direct-beam skirt and the amorphous halo — so the Bragg and orientation signal stands out. Subtract the azimuthal median, or divide by the azimuthal mean.
Both show a before/after preview, then bake a new cube alongside the original — your raw file is never modified.
The other algorithms are in the notebooks.
n2_methods_demo.ipynbcompares Noise2Void, Noise2Self and scan-to-scan Noise2Noise against the binomial split — with the math behind each, and why the blind-spot methods carry a hyperparameter while the binomial split does not.
The learned class map is the centre of the app, but the everyday 4D-STEM workflow is all there too — on the same loaded scan, no scripting.
| Tab | What you can do |
|---|---|
| Data ▸ Viewing | Virtual BF / HAADF images of the scan; drag an n × m window for a live mean diffraction pattern; exposure + log stretch; distance, radial and azimuthal profile tools; iCOM (DPC) |
| Data ▸ Load + Pre-process | Flyback detection for continuously streamed scans (finds lead-in / flyback frames and the real scan grid); hot / dead pixel removal; NBED centering; ellipticity correction; real-space binning; denoising and radial flattening (above) |
| Clustering ▸ NMF + cluster | Model-free NMF + clustering baseline (k-means, agglomerative, HDBSCAN, fuzzy c-means) on polar or Cartesian patterns; interactive class map with a live pattern under the mouse and class A − class B difference patterns |
| Diffraction ▸ ACOM (orientation & phase mapping) | Load CIFs, calibrate against the CIF rings, match a single pattern, then map class averages, grains or the full scan: phase map, zone-axis map, correlation, optional NNLS phase refinement (phase weights + reliability). Overlay the DINO / NMF classes on the result and click any pixel to see its pattern with the matched phase. A fiber search can be restricted to one viewing direction [u v w]. |
| Diffraction ▸ ACOM ▸ Data reference | No CIF needed: a measured pattern (scan position, grain, ROI box or class average) is the reference — its detected spots are the template. Every pattern gets a match score and its in-plane rotation relative to the reference; several references give a phase / zone-axis map — for near-identical phases (e.g. a structure and its superstructure) the references are compared with each other and only the reflections that differ are measured, giving best / second-best phase, confidence and an uncertain class. Right-drag a box on the result to turn that region into a new reference. A CIF simulated at a zone axis can be added as a reference too. |
| Diffraction ▸ ACOM ▸ Strain | Per-pattern lattice strain (εxx, εyy, εxy) and lattice rotation against any reference: a measured region (relative strain) or a CIF at a zone axis (absolute strain). Sub-pixel spot positions; click a pixel to see the fitted lattice. |
| Diffraction ▸ Crystallinity | 1D peak/halo and spottiness maps (degree of crystallinity, no spot detection needed) |
Orientation and phase mapping is py4DSTEM's. The ACOM tab's CIF mode
is a graphical front end to py4DSTEM's crystal orientation and phase mapping
(Crystal.orientation_plan / match_orientations,
CrystalPhase.quantify_phase) — the matching and the NNLS phase fit are
py4DSTEM's work, not ours (the Data reference and Strain modes are
DINO-4DSTEM's own spot matching and lattice fitting; a CIF reference there
uses py4DSTEM only to simulate the spot positions). If you use it, please cite
py4DSTEM (Savitzky et al.,
Microscopy and Microanalysis 2021) and its orientation-mapping paper
(Ophus et al., Microscopy and Microanalysis 2022).
Where results go. Every analysis tab saves into one folder next to your
data — <data name>_DINO4DSTEM/ with a sub-folder per tool (nmf/,
acom/maps, acom/dataref, acom/strain, …) and a README inside. The Open outputs folder button in the top
bar takes you there.
Each bundle is the whole app with the right launchers for your OS. All three need free Miniconda / Miniforge installed first.
| 🪟 Windows | 🐧 Linux | 🍎 macOS |
|---|---|---|
|
Double-click |
|
|
Prefer git?
git clone https://github.com/DanielKhaykelson/dino-4dstem, then run the installer for your OS. The Windows bundle also includesGETTING_STARTED.docx, a picture-by-picture walkthrough.
Comfortable with Python? Install into a fresh Python 3.10 environment:
pip install dino4dstem dino4dstem shortcuts # optional: GUI / Assistant / Notebooks icons on your Desktop dino4dstem setup-gpu # optional: CUDA build of PyTorch for an NVIDIA GPU pip install -U dino4dstem # later: update to the newest release
Then just run dino4dstem to open the app. Other commands:
dino4dstem assistant, dino4dstem notebooks, dino4dstem --help.
The app keeps its working files in ~/DINO4DSTEM (set DINO4DSTEM_HOME to
move it).
⚠️ Windows is the primary, fully tested platform. The Linux and macOS builds share the same code and their installers have been checked, but they have not yet been fully tested end-to-end on those systems. If you hit a problem on Linux or macOS, please get in touch — reports are very welcome.
If DINO-4DSTEM contributes to work you publish, please cite the paper:
DINO4DSTEM: A self-supervised framework for structural discovery in 4D-STEM
Daniel Khaykelson, Lothar Houben, Boris Rybtchinski
arXiv:2608.15098 (2026) — read it →
@article{khaykelson2026dino4dstem, title = {DINO4DSTEM: A self-supervised framework for structural discovery in 4D-STEM}, author = {Khaykelson, Daniel and Houben, Lothar and Rybtchinski, Boris}, journal = {arXiv preprint arXiv:2608.15098}, year = {2026}, url = {https://arxiv.org/abs/2608.15098} }
GitHub also builds this for you: use “Cite this repository” on the repo sidebar (it reads
CITATION.cff) to copy BibTeX or APA.
- 📄 The paper — arXiv:2608.15098
- 🧭 What it does & results —
PROJECT_SUMMARY.md - 📓 Tutorial notebooks —
notebooks/— phantom → train → analyse → baselines, plus the denoising methods comparison (N2N binomial, Noise2Void, Noise2Self) - 🧠 The methods explained (DINO, NMF, clustering, PCA) —
docs/assistant/CONCEPTS.md - 📕 Full manual —
docs/USER_MANUAL.pdf - 🛠️ Install guide —
INSTALL.md
Questions, bug reports, feature requests, or help getting it running on your data — including Linux/macOS issues — are all welcome. Two ways to reach us:
- 🐛 Bug reports & feature requests: open a GitHub issue (click New issue). Best for anything reproducible — it's searchable and others can follow along.
- 📧 Direct questions / inquiries: email Daniel Khaykelson at [email protected].
When reporting a problem, it helps to include your operating system, what you did, and the full error message (copy the text from the console window).
🦕 Windows · Linux · macOS · companion code for ongoing 4D-STEM / electron-diffraction research.
