Classify MultiROI Labels - User Manual
Dragonfly Prototype Apps · Classify MultiROI Labels...
Version 1.0 · 2026-07-26
English Manual
Contents
1. Introduction
2. Features
3. Classification modes
4. How to use
5. Requirements
6. Tips & notes
1. Introduction
This plugin automatically classifies every label in a MultiROI (each label is usually one particle / object in the image): using a paired intensity Channel, it extracts many per-label image features (radiomics), assigns each label to a group 1..N, and writes the group id back as a scalar-value slot named "Classification Group" on the MultiROI, coloring the MultiROI by group.
Features are extracted with Dragonfly's bundled pyradiomics: first-order intensity + shape / morphology + GLCM / GLRLM / GLSZM / GLDM / NGTDM texture (~90+ features). They are then standardized and PCA-denoised before clustering / classification.
Use it when an image has hundreds of particles (already segmented into a MultiROI) and the eye can tell N types apart by brightness / texture / shape / size, and you want each particle auto-classified and color-grouped: mineral / rock thin-section phase classification, powder-particle typing, pore / inclusion typing, cell / grain morphology typing, and similar.
Everything runs in-process inside Dragonfly using its bundled scikit-learn / scikit-image / pyradiomics / SimpleITK — no venv, no internet, no GPU.
2. Features
- Per-label feature extraction: pick from three feature families — first-order intensity, shape / morphology, and texture (GLCM/GLRLM/GLSZM/GLDM/NGTDM). Works on 2D or 3D data (2D uses shape2D texture automatically).
- Three ways to classify: unsupervised K-Means (manual N, or Auto to suggest N), semi-supervised RandomForest (tag a few example labels per type, then train + predict), and a 3-feature-scheme comparison (cluster three different radiomics feature subsets at the same N, writing three scalar slots to compare).
- Multiple clustering algorithms: K-Means, Gaussian Mixture, and Agglomerative clustering.
- Feature scheme: cluster on all features / shape only / first-order intensity only / texture only / shape + intensity / intensity + texture. Choosing the subset that matches how your particle types actually differ is the single biggest lever on clustering quality.
- Group numbering: groups 1..N can be numbered by cluster size / mean intensity / volume for interpretability.
- Outlier detection: optionally flag labels far from their cluster center (distance > mean + z·std) as group 0 (unclassified / outlier).
- Scalar-slot manager: lists every scalar slot on the MultiROI so you can switch which classification is displayed (color by it) or delete ones you don't want to keep.
- Exports: save a per-label features + group CSV and a PCA scatter plot (colored by group).
3. Classification modes
1) Unsupervised K-Means (default)
Set the number of groups N manually, or click "Auto — suggest N" to have the plugin suggest an N from a consensus vote of three cluster-validity indices (silhouette / Calinski-Harabasz / Davies-Bouldin), with the per-N curve shown. This is a suggestion — if you know the type count, confirm it yourself before classifying.
2) Compare 3 feature schemes → 3 scalar slots
In "Compare 3 feature schemes", pick three schemes (default: all / shape + intensity / texture). The plugin clusters at the same N with each and writes three slots named "Classification-Radiomics-K-Means-1/2/3". Use the scalar-slot dropdown below to review each, keep the best, and delete the rest.
3) Semi-supervised (tag examples)
Tag a few example labels per group: select them in Dragonfly and click "Add Dragonfly selection → selected group", or type label IDs directly into the table. The plugin trains a RandomForest and predicts all labels (reporting a cross-validation accuracy). Tag at least 2 labels across at least 2 groups.
4. How to use
1. Open it at Prototype Apps ▸ Measurements & Analysis ▸ Classify MultiROI Labels...
2. Tab 1 "Input & Features": click Refresh lists, then pick an Intensity Channel and a MultiROI on the same grid (one label per particle).
3. Tick the Feature families you want — First-order / Shape / Texture — then click Extract features (large MultiROIs are processed label by label; watch the log for progress).
4. Tab 2 "Classify & Write": choose a Mode (unsupervised or semi-supervised); for unsupervised set N (or Auto), the algorithm, feature scheme, group numbering, and optional outlier flagging.
5. Click Classify to get a group per label; the panel reports the per-group label counts, silhouette / CV accuracy, etc.
6. Click Write groups → MultiROI to write the "Classification Group" scalar slot back — the MultiROI is then colored by group.
7. (Optional) click Save features + groups CSV… to export a CSV, or Save PCA plot… for a PCA scatter plot.
8. (Optional) use the scalar-slot manager at the bottom: pick a Slot, Show / color by this to switch the displayed classification, or Delete slot to remove an unwanted one.
5. Requirements
- Input: an intensity Channel + a MultiROI on the same grid (one label per particle). 2D or 3D.
- No environment setup: runs in-process with Dragonfly's bundled numpy / scipy / scikit-learn / scikit-image / pyradiomics / SimpleITK.
- No GPU, no internet, and no administrator rights required.
- Install with
python install_label_classifier_plugin.py(deploys to every Dragonfly version on the machine), then fully restart Dragonfly to see the menu item.
6. Tips & notes
- The feature scheme is the key quality lever: different particle types usually separate best along one of shape / brightness / texture. If the default "all features" clusters poorly, use the 3-feature-scheme comparison to find the best subset.
- Auto's N is only a suggestion: with many correlated radiomics features it tends to favor a coarse k=2 split. When you know the type count, prefer setting N manually (most robust) or use semi-supervised (closest to your own criteria).
- Very small / degenerate labels where texture is undefined are skipped (the extraction result reports how many were skipped) and do not take part in classification.
- Outlier group 0: with "Flag outliers as group 0" on, labels too far from their cluster center become group 0 (unclassified); a smaller z flags more of them.
- Heavy work (feature extraction / clustering) runs on a background thread, so the buttons are temporarily disabled; watch the log at the bottom for progress.