# ding1119/neurotree architecture

> Architecture diagram of the GitHub repository ding1119/neurotree, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ding1119/neurotree
- Repository: https://github.com/ding1119/neurotree

## Overview

NeuroTree is a research pipeline for decoding fMRI brain networks, classifying disorders or estimating brain age, and interpreting predictions through hierarchical brain-tree visualizations. The main workflow loads and transforms dataset time series, trains a Neural ODE graph model, evaluates predictions, extracts trunk paths, and optionally plots them. The README also describes convergence analysis and age-related network interpretation, but the sampled source does not establish their runtime wiring. Edges reflect shown calls or documented usage; dataset placement is documented, while unsampled subsystem details are not inferred.

Main entry points: [`training_eval_utils.py`](https://github.com/ding1119/neurotree/blob/main/training_eval_utils.py) (Training and evaluation), [`main.py`](https://github.com/ding1119/neurotree/blob/main/main.py) (Training entry), [`data_handler/load_dataset.py`](https://github.com/ding1119/neurotree/blob/main/data_handler/load_dataset.py) (Dataset loading), [`visualization/tree_plot.py`](https://github.com/ding1119/neurotree/blob/main/visualization/tree_plot.py) (Brain-tree plots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_loader["Dataset loading<br/>[load_dataset.py]"]
  node_preprocess["Connectivity preprocessing<br/>[load_dataset.py]"]
  node_treeconstruct["Input tree construction<br/>[utils.py]"]
end

subgraph group_modeling["Modeling and evaluation"]
  node_entry["Training entry<br/>[main.py]"]
  node_trainer["Training and evaluation"]
  node_neuroode["Neural ODE model<br/>[ode_model.py]"]
end

subgraph group_interpretation["Interpretation"]
  node_trunks["Trunk extraction"]
  node_treeplots["Brain-tree plots<br/>[tree_plot.py]"]
  node_plotutils["Network plotting<br/>[plot_utils.py]"]
end

node_researcher(("Researcher"))
node_datasets[("Processed fMRI data")]

node_researcher -->|"runs"| node_entry
node_datasets -.->|"loads"| node_loader
node_entry -->|"loads data"| node_loader
node_loader -->|"constructs trees"| node_treeconstruct
node_entry -->|"trains and evaluates"| node_trainer
node_trainer -->|"calls model"| node_neuroode
node_trainer -->|"extracts trunks"| node_trunks
node_trainer -->|"plots brain trees"| node_treeplots
node_treeplots -->|"renders comparisons"| node_plotutils
node_trainer -->|"plots distributions"| node_plotutils

click node_entry "https://github.com/ding1119/neurotree/blob/main/main.py"
click node_loader "https://github.com/ding1119/neurotree/blob/main/data_handler/load_dataset.py"
click node_preprocess "https://github.com/ding1119/neurotree/blob/main/data_handler/load_dataset.py"
click node_treeconstruct "https://github.com/ding1119/neurotree/blob/main/utils.py"
click node_trainer "https://github.com/ding1119/neurotree/blob/main/training_eval_utils.py"
click node_neuroode "https://github.com/ding1119/neurotree/blob/main/models/ode_model.py"
click node_trunks "https://github.com/ding1119/neurotree/blob/main/tree_trunk_utils.py"
click node_treeplots "https://github.com/ding1119/neurotree/blob/main/visualization/tree_plot.py"
click node_plotutils "https://github.com/ding1119/neurotree/blob/main/visualization/plot_utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loader,node_preprocess,node_treeconstruct toneBlue
class node_entry,node_trainer,node_neuroode,node_datasets toneAmber
class node_trunks,node_treeplots,node_plotutils toneMint
class node_researcher toneIndigo
```

## Components

### Data preparation

- [Dataset loading](https://github.com/ding1119/neurotree/blob/main/data_handler/load_dataset.py): `data_handler/load_dataset.py`
- [Connectivity preprocessing](https://github.com/ding1119/neurotree/blob/main/data_handler/load_dataset.py): `data_handler/load_dataset.py`
- [Input tree construction](https://github.com/ding1119/neurotree/blob/main/utils.py): `utils.py`

### Modeling and evaluation

- [Training entry](https://github.com/ding1119/neurotree/blob/main/main.py): `main.py`
- [Training and evaluation](https://github.com/ding1119/neurotree/blob/main/training_eval_utils.py): `training_eval_utils.py`
- [Neural ODE model](https://github.com/ding1119/neurotree/blob/main/models/ode_model.py): `models/ode_model.py`

### Interpretation

- [Trunk extraction](https://github.com/ding1119/neurotree/blob/main/tree_trunk_utils.py): `tree_trunk_utils.py`
- [Brain-tree plots](https://github.com/ding1119/neurotree/blob/main/visualization/tree_plot.py): `visualization/tree_plot.py`
- [Network plotting](https://github.com/ding1119/neurotree/blob/main/visualization/plot_utils.py): `visualization/plot_utils.py`

### Other components

- **Researcher**
- **Processed fMRI data**

## Connections

- Researcher → Training entry: runs (evidence: `README.md`)
- Processed fMRI data → Dataset loading: loads (evidence: `README.md`)
- Training entry → Dataset loading: loads data (evidence: `main.py`)
- Dataset loading → Input tree construction: constructs trees (evidence: `data_handler/load_dataset.py`)
- Training entry → Training and evaluation: trains and evaluates (evidence: `main.py`)
- Training and evaluation → Neural ODE model: calls model (evidence: `training_eval_utils.py`)
- Training and evaluation → Trunk extraction: extracts trunks (evidence: `training_eval_utils.py`)
- Training and evaluation → Brain-tree plots: plots brain trees (evidence: `training_eval_utils.py`)
- Brain-tree plots → Network plotting: renders comparisons (evidence: `visualization/tree_plot.py`)
- Training and evaluation → Network plotting: plots distributions (evidence: `training_eval_utils.py`)
