GraPHFormer: A Multimodal Graph Persistent Homology Transformer for the Analysis of Neuroscience Morphologies
Authors: Uzair Shah, Marco Agus, Mahmoud Gamal, Mahmood Alzubaidi, Corrado Cali, Pierre J. Magistretti, Abdesselam Bouzerdoum, Mowafa Househ
Organizations: Hamad Bin Khalifa University, Qatar · University of Turin, Italy · Neuroscience Institute Cavalieri Ottolenghi, Italy · Université Grenoble-Alpes, France · BESE, King Abdullah University of Science and Technology, Saudi Arabia · University of Wollongong, Australia
Neuronal morphology encodes critical information about circuit function, development, and disease, yet current methods analyze topology or graph structure in isolation. We introduce GraPHFormer, a multimodal architecture that unifies these complementary views through CLIP-style contrastive learning. Our vision branch processes a novel three-channel persistence image encoding unweighted, persistence-weighted, and radius-weighted topological densities via DINOv2-ViT-S. In parallel, a TreeLSTM encoder captures geometric and radial attributes from skeleton graphs. Both project to a shared embedding space trained with symmetric InfoNCE loss, augmented by persistence-space transformations that preserve topological semantics. Evaluated on six benchmarks (BIL-6, ACT-4, JML-4, N7, M1-Cell, M1-REG) spanning self-supervised and supervised settings, GraPHFormer achieves state-of-the-art performance on five benchmarks, significantly outperforming topology-only, graph-only, and morphometrics baselines. We demonstrate practical utility by discriminating glial morphologies across cortical regions and species, and detecting signatures of developmental and degenerative processes. Code: https://github.com/Uzshah/GraPHFormer
Figures & tables
Figure 1: Representative examples showing tree graphs overlaid on their persistence images across different morphological classes.
Figure 2: Overview of the proposed dual-modality framework. (A) Neuronal morphologies are converted into multi-channel RGB persistence images via radial distance filtration, TMD-based persistence pair extraction, feature enrichment, and Gaussian kernel density estimation. (B) A self-supervised architecture jointly trains a tree encoder and an image encoder, projecting both modalities into a shared embedding space. Alignment between graph and image features is optimized via contrastive (InfoNCE) loss following the CLIP paradigm.
Method
BIL-6
ACT-4
JML-4
N7
M1-Cell
M1-REG
SL
MorphVAE
66.80
41.05
40.00
73.73
60
64
TRNN
76.56
46.32
51.43
-
-
-
Morphometrics
81.27
52.08
52.58
82.45
-
-
MorphoGNN
76.57
54.16
65.83
85.58
-
-
TreeMoCo
85.55
62.11
64.29
-
-
-
MorphRep
88.0
77.0
-
-
72.0
76.0
Table 1: Performance comparison of GraPHFormer against state-of-the-art methods across six neuronal morphology datasets (classification accuracy in %). SL : Supervised Learning with full labels. SS : Self-Supervised Learning with frozen kNN evaluation following TreeMoCo [ 5 ] . Bold: best performance; underline: second-best. SS methods show mean ± std over five seeds. Missing entries (-) indicate unreported results. Datasets: BIL-6, ACT-4, JML-4 (4 cell types), Neuron7 (N7), M1-Cell (cell types), M1-REG (regions). Baselines from MorphRep [ 9 ] (M1-) and SGTMorph [ 29 ] (others). TreeMoCo denotes our fine-tuned tree encoder.
Dataset
Joint
Neuron7
M1-EXC
All-dataset
BIL-6
-
84.42
76.62
85.71
JML-4
-
72.57
56.64
76.99
ACT-4
-
52.08
50.00
54.86
N7
80.86
-
72.01
84.45
M1-Cell
71.08
69.88
-
73.49
M1-Reg
62.96
74.07
-
75.31
Table 2: Cross-dataset generalizability evaluation. Models trained on datasets shown in columns (top row) are evaluated on datasets shown in rows (first column). Joint combines ACT, BIL, and JML; All-dataset includes all five datasets. All models trained for 100 epochs.
Category
Metric
Neuron7
JML-4
Dataset Info
Samples
418
113
Classes
7
4
Correlation
Pearson
0.040
0.083
RSA
0.080 ***
0.060 ***
Acc (%)
Tree
81.8
64.6
Image
55.3
49.6
Table 3: Complementarity analysis comparing Neuron7 and JML-4 datasets on test sets.
Channel
ACT-4
BIL-6
JML-4
AVG
B only
39.4
73.2
62.5
58.4
G only
45.6
73.6
62.2
60.5
R only
46.1
72.3
63.7
60.7
GB
44.7
74.5
62.5
60.6
RB
45.4
74.5
65.2
61.7
RG
46.1
71.9
62.5
60.2
Table 4: Ablation study on multi-channel persistence image encoding. R encodes unweighted density, G encodes persistence-weighted density, and B encodes radius-weighted density.
No Aug
BD jitter
P-Scale
R-Pert
ACT-4 (Acc %)
✓
40.97
✓
45.14
✓
42.36
✓
46.53
✓
✓
41.67
✓
✓
43.06
Table 5: Augmentation Methods and Their Accuracy
Model
ACT-4
BIL-6
JML-4
Average
R18-ViT
49.7 ± 1.4
85.7 ± 0.0
72.6 ± 4.0
69.3 ± 1.8
R50-ViT
51.0 ± 1.4
84.9 ± 0.7
71.5 ± 0.7
69.1 ± 0.9
ResNet50
52.9 ± 3.3
84.5 ± 1.8
71.5 ± 2.1
69.7 ± 2.4
SmallViT
49.6 ± 1.5
86.0 ± 1.1
70.3 ± 2.5
68.6 ± 1.7
ResNet18
54.2 ± 1.0
84.9 ± 1.2
71.7 ± 1.7
70.3 ± 1.3
DinoV2-S
50.6 ± 0.9
87.0 ± 2.1
74.3 ± 1.9
70.6 ± 1.6
Table 6: Ablation study for image encoder selection across different architectures. Models are trained for 50 epochs using self-supervised learning and evaluated every 5 epochs with frozen k-NN classification on three benchmark datasets. Hybrid variants (R18-ViT, R50-ViT) replace the last two ResNet layers with ViT blocks. Results are averaged over 5 random seeds with best performance in bold .
Channel Pair
Correlation
Interpretation
R – G
0.433
Moderate
R – B
0.447
Moderate
G – B
0.354
Lower (more orthogonal)
Average
0.411
Moderate independence
Table 7: Pairwise correlation between RGB channel features (BIL-6 dataset). Moderate correlations indicate related but distinct morphological aspects. The G–B pair (0.354) is most orthogonal, showing that persistence and radius capture complementary information.
Figure 3: Visualization of RGB persistence image encoding and channel ablations. Each channel encodes distinct topological features. The R channel exhibits high intensity in the upper region while the G channel shows high intensity in the middle area. Channel combinations (RG, RB, GB) demonstrate how different pairings capture complementary information, with the full RGB representation providing comprehensive encoding of topological features.
Figure 4: Ablation study on Image size (left) and Gaussian Kernel (right) using Image Encoder Only.
Data
EM-32
EM-64
EM-128
EM-256
ACT-4
53.47
56.25
56.25
51.39
BIL-6
84.42
85.71
86.20
85.71
JML-4
65.49
65.49
67.26
69.03
Table 8: Ablation on embedding size during self-supervised training.
Data
BS-64
BS-128
BS-256
ACT-4
53.47
56.25
54.17
BIL-6
83.12
86.20
83.12
JML-4
64.60
67.26
68.33
Table 9: Ablation on batch size during self-supervised training.
Data
MLP
One Layer
ACT-4
56.25
52.08
BIL-6
86.20
84.42
JML-4
67.26
63.72
Table 10: Ablation on projection head architecture: MLP vs. single linear layer.
Test Dataset
Train: Neuron
Train: Glia
Glia (species)
78.87
86.94
BIL-4
-
81.82
JML-4
-
68.14
ACT-4
-
46.52
N7
-
82.78
M1-REG
-
71.08
Table 11: Cross-domain transfer performance between neuronal and glial morphologies. Left column : Model trained on neuron data, tested on glia (species classification). Right columns : Model trained on glia, tested on neuron datasets (cell-type classification). Results demonstrate transfer capability despite morphological differences between cell classes.
Fusion Strategy
ACT-4
BIL-6
JML-4
Bi-Attention
54.39 ± 3.6
87.04 ± 0.7
73.59 ± 4.5
Addition
57.54 ± 4.2
84.5 ± 1.1
72.73 ± 1.3
CAMME [ 19 ]
52.28 ± 1.6
84.57 ± 2.1
71.86 ± 1.9
Concatenation
57.89 ± 1.1
83.33 ± 1.8
71.86 ± 1.9
Gated
58.25 ± 4.26
85.19 ± 0.7
72.30 ± 1.9
MHCA
58.90 ± 1.82
84.57 ± 1.07
67.10 ± 0.7
Table 12: Ablation study of fusion strategies within the TreeMoCo framework for neuron morphological analysis. All variants employ ResNet-18 as the image encoder and TreeLSTM as the tree-structured encoder, jointly trained on the ACT-4, JML-4, and BIL-6 datasets using contrastive learning. Performance is evaluated on held-out test sets via frozen k-NN classification. We report average classification accuracy (in %) ± standard deviation across three independent random seeds for each fusion method.
Figure 5: t-SNE visualization of GraPHFormer embedding spaces across four datasets. Top left : ACT-4 (cortical layers 2/3, 4, 5, 6) shows partial overlap reflecting morphological gradients between adjacent layers. Top right : JML-4 displays separation between thalamic VPM neurons (left cluster) and cortical projection neurons (center-right). Bottom left : Neuron7 exhibits distinct clusters for seven morphologically diverse cell types (bipolar, amacrine, basket, pyramidal, spiny, stellate), demonstrating discrimination of fundamental neuronal classes. Bottom right : Glia species classification (mouse, rat, semipalmated sandpiper/plover) shows overlapping distributions reflecting conserved morphological features across species. Embeddings are obtained by concatenating tree encoder and image encoder outputs after self-supervised contrastive pretraining. Clustering quality correlates with biological distinctiveness and classification accuracy.
Figure 6: Bidirectional cross-modal retrieval demonstrating alignment between tree graphs and persistence images. Top row : Tree-to-image retrieval for ACT, BIL, and JML-4 datasets showing query tree graphs (left) and top-5 retrieved persistence images with cosine similarity scores. Bottom row : Image-to-tree retrieval showing query persistence images (left) and top-5 retrieved tree graphs. Note the asymmetry in similarity scores: image-to-tree retrieval achieves higher similarities (0.80-0.87) compared to tree-to-image retrieval (0.10-0.46), reflecting differences in information density between the graph and compressed topological representations.
Figure 7: Representative examples showing tree graphs overlaid on their persistence images across different morphological classes. Left : ACT dataset (4 cortical layers). Center : JML-4 dataset (cortical layers and thalamic VPM neurons). Right : Glia dataset (4 species). Each row represents a distinct class, with 4 samples per class. The green tree structures illustrate how branching topology and spatial extent map onto the RGB persistence image encoding, where red captures unweighted density, green encodes persistence-weighted features, and blue represents radius-weighted information.
Department of Mathematical Science The University of Texas at Dallas Richardson, TX 75080, USA · Department of Mathematics Florida State University Tallahassee, FL 32306, USA · AI Initiative University of Central Florida Orlando, FL 32816, USA