# mengjindong/regionaldeepatrophy architecture

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

- Interactive diagram: https://gitdiagram.com/mengjindong/regionaldeepatrophy
- Repository: https://github.com/mengjindong/regionaldeepatrophy

## Overview

RDA uses longitudinal MRI to learn registration-based measures of Alzheimer’s disease progression and attention maps in the medial temporal lobe. The documented workflow starts with scan-pair training data, feeds paired scans through an attention/registration model, and trains against registration and progression-related objectives; testing evaluates warped segmentations with Dice overlap. The graph includes the core model, image preparation, and model persistence layers. Some connections are documented only in the README; unsampled testing and training details are not inferred beyond those statements.

Main entry points: [`vxm_model/torch/networks.py`](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/networks.py) (Attention registration), [`vxm_runs/torch/train.py`](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/train.py) (RDA training), [`vxm_runs/torch/test_attention.py`](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/test_attention.py) (Model testing), [`vxm_model/generators.py`](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/generators.py) (Scan-pair generators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["MRI data"]
  node_generators["Scan-pair generators<br/>[generators.py]"]
  node_image_utils["Image preparation<br/>[utils.py]"]
  node_augmentation["CPU augmentation<br/>[data_aug_cpu.py]"]
end

subgraph group_model["Model and transforms"]
  node_rda_model["Attention registration<br/>[networks.py]"]
  node_spatial_transform["Spatial transforms<br/>[layers.py]"]
  node_losses["Registration losses<br/>[losses.py]"]
end

subgraph group_training["Training and evaluation"]
  node_trainer["RDA training<br/>[train.py]"]
  node_tester["Model testing<br/>[test_attention.py]"]
end

subgraph group_support["Model support"]
  node_model_io["Model persistence<br/>[modelio.py]"]
end

node_researcher(("Researcher"))
node_mri_data[("Longitudinal MRI")]

node_researcher -->|"starts training"| node_trainer
node_mri_data -.->|"provides scans"| node_generators
node_trainer -->|"uses scan pairs"| node_generators
node_generators -.->|"loads volumes"| node_image_utils
node_image_utils -->|"uses augmentation"| node_augmentation
node_trainer -->|"runs model"| node_rda_model
node_rda_model -->|"warps scans"| node_spatial_transform
node_rda_model -->|"inherits persistence"| node_model_io
node_researcher -->|"starts testing"| node_tester
node_tester -.->|"loads model"| node_model_io
node_tester -.->|"evaluates scans"| node_mri_data

click node_generators "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/generators.py"
click node_image_utils "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/py/utils.py"
click node_augmentation "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/py/data_aug_cpu.py"
click node_rda_model "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/networks.py"
click node_spatial_transform "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/layers.py"
click node_losses "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/losses.py"
click node_trainer "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/train.py"
click node_tester "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/test_attention.py"
click node_model_io "https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/modelio.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_generators,node_image_utils,node_augmentation toneBlue
class node_rda_model,node_spatial_transform,node_losses,node_mri_data toneAmber
class node_trainer,node_tester toneMint
class node_model_io toneRose
class node_researcher toneIndigo
```

## Components

### MRI data

- [Scan-pair generators](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/generators.py): `vxm_model/generators.py`
- [Image preparation](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/py/utils.py): `vxm_model/py/utils.py`
- [CPU augmentation](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/py/data_aug_cpu.py): `vxm_model/py/data_aug_cpu.py`

### Model and transforms

- [Attention registration](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/networks.py): `vxm_model/torch/networks.py`
- [Spatial transforms](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/layers.py): `vxm_model/torch/layers.py`
- [Registration losses](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/losses.py): `vxm_model/torch/losses.py`

### Training and evaluation

- [RDA training](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/train.py): `vxm_runs/torch/train.py`
- [Model testing](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_runs/torch/test_attention.py): `vxm_runs/torch/test_attention.py`

### Model support

- [Model persistence](https://github.com/mengjindong/regionaldeepatrophy/blob/master/vxm_model/torch/modelio.py): `vxm_model/torch/modelio.py`

### Other components

- **Researcher**
- **Longitudinal MRI**

## Connections

- Researcher → RDA training: starts training (evidence: `README.md`)
- Longitudinal MRI → Scan-pair generators: provides scans
- RDA training → Scan-pair generators: uses scan pairs (evidence: `README.md`)
- Scan-pair generators → Image preparation: loads volumes
- Image preparation → CPU augmentation: uses augmentation (evidence: `vxm_model/py/utils.py`)
- RDA training → Attention registration: runs model (evidence: `vxm_runs/torch/train.py`)
- Attention registration → Spatial transforms: warps scans (evidence: `vxm_model/torch/networks.py`)
- Attention registration → Model persistence: inherits persistence (evidence: `vxm_model/torch/networks.py`)
- Researcher → Model testing: starts testing (evidence: `README.md`)
- Model testing → Model persistence: loads model
- Model testing → Longitudinal MRI: evaluates scans
