# rfuentes89/flowmri architecture

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

- Interactive diagram: https://gitdiagram.com/rfuentes89/flowmri
- Repository: https://github.com/rfuentes89/flowmri

## Overview

FlowMRI-Net is a research implementation for reconstructing aortic and cerebrovascular 4D-flow MRI from undersampled measurements. The main workflow loads volunteer data, forms reconstruction inputs, runs a selectable learned model, and trains or tests it; a separate post-processing script performs background-phase correction and phase unwrapping. The repository also includes a CS-LLR reconstruction alternative and pretrained checkpoints. Edges reflect shown calls/imports or README statements; unsampled workflow details are not inferred.

Main entry points: [`main.py`](https://github.com/rfuentes89/flowmri/blob/main/main.py) (Train and test), [`utils/postproc.py`](https://github.com/rfuentes89/flowmri/blob/main/utils/postproc.py) (Post-processing), [`utils/dataloader.py`](https://github.com/rfuentes89/flowmri/blob/main/utils/dataloader.py) (MRI dataset), [`utils/CS_LLR_exec.py`](https://github.com/rfuentes89/flowmri/blob/main/utils/CS_LLR_exec.py) (CS-LLR runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Reconstruction workflow"]
  node_main["Train and test<br/>[main.py]"]
  node_dataset["MRI dataset<br/>[dataloader.py]"]
  node_partition["SSDU partitioning<br/>[partitioning.py]"]
  node_mriops["MRI operators<br/>[misc_utils.py]"]
end

subgraph group_models["Learned models"]
  node_flowmri["FlowMRI-Net<br/>[flowmri_net.py]"]
  node_flowvn["FlowVN<br/>[flowvn.py]"]
  node_checkpoints[("Pretrained weights")]
end

subgraph group_alternatives["Alternative reconstruction"]
  node_csrunner["CS-LLR runner<br/>[CS_LLR_exec.py]"]
  node_csutils["CS-LLR solver<br/>[CS_LLR_utils.py]"]
end

subgraph group_processing["Flow post-processing"]
  node_postproc["Post-processing<br/>[postproc.py]"]
  node_msac["Background correction<br/>[execute_MSAC.py]"]
  node_unwrap["Phase unwrapping<br/>[unwrapFlow.py]"]
  node_recon["Reconstruction output"]
  node_corrected["Corrected flow data"]
end

node_user(("Researcher"))

node_user -->|"configures"| node_main
node_main -->|"loads data"| node_dataset
node_main -->|"selects model"| node_flowmri
node_main -->|"selects model"| node_flowvn
node_dataset -->|"partitions k-space"| node_partition
node_dataset -->|"forms input images"| node_mriops
node_main -.->|"computes data consistency"| node_mriops
node_user -->|"configures"| node_csrunner
node_csrunner -->|"uses solver functions"| node_csutils
node_user -.->|"runs processing"| node_postproc
node_postproc -->|"loads reconstruction"| node_recon
node_postproc -->|"fits background phase"| node_msac
node_postproc -->|"unwraps phase"| node_unwrap
node_postproc -->|"produces corrected data"| node_corrected
node_user -->|"selects checkpoint"| node_checkpoints

click node_main "https://github.com/rfuentes89/flowmri/blob/main/main.py"
click node_dataset "https://github.com/rfuentes89/flowmri/blob/main/utils/dataloader.py"
click node_partition "https://github.com/rfuentes89/flowmri/blob/main/utils/partitioning.py"
click node_mriops "https://github.com/rfuentes89/flowmri/blob/main/utils/misc_utils.py"
click node_flowmri "https://github.com/rfuentes89/flowmri/blob/main/networks/flowmri_net.py"
click node_flowvn "https://github.com/rfuentes89/flowmri/blob/main/networks/flowvn.py"
click node_checkpoints "https://github.com/rfuentes89/flowmri/tree/main/weights"
click node_csrunner "https://github.com/rfuentes89/flowmri/blob/main/utils/CS_LLR_exec.py"
click node_csutils "https://github.com/rfuentes89/flowmri/blob/main/utils/CS_LLR_utils.py"
click node_postproc "https://github.com/rfuentes89/flowmri/blob/main/utils/postproc.py"
click node_msac "https://github.com/rfuentes89/flowmri/blob/main/utils/execute_MSAC.py"
click node_unwrap "https://github.com/rfuentes89/flowmri/blob/main/utils/unwrapFlow.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_main,node_dataset,node_partition,node_mriops toneBlue
class node_flowmri,node_flowvn,node_checkpoints toneAmber
class node_csrunner,node_csutils toneMint
class node_postproc,node_msac,node_unwrap,node_recon,node_corrected toneRose
class node_user toneIndigo
```

## Components

### Reconstruction workflow

- [Train and test](https://github.com/rfuentes89/flowmri/blob/main/main.py): `main.py`
- [MRI dataset](https://github.com/rfuentes89/flowmri/blob/main/utils/dataloader.py): `utils/dataloader.py`
- [SSDU partitioning](https://github.com/rfuentes89/flowmri/blob/main/utils/partitioning.py): `utils/partitioning.py`
- [MRI operators](https://github.com/rfuentes89/flowmri/blob/main/utils/misc_utils.py): `utils/misc_utils.py`

### Learned models

- [FlowMRI-Net](https://github.com/rfuentes89/flowmri/blob/main/networks/flowmri_net.py): `networks/flowmri_net.py`
- [FlowVN](https://github.com/rfuentes89/flowmri/blob/main/networks/flowvn.py): `networks/flowvn.py`
- [Pretrained weights](https://github.com/rfuentes89/flowmri/tree/main/weights): `weights`

### Alternative reconstruction

- [CS-LLR runner](https://github.com/rfuentes89/flowmri/blob/main/utils/CS_LLR_exec.py): `utils/CS_LLR_exec.py`
- [CS-LLR solver](https://github.com/rfuentes89/flowmri/blob/main/utils/CS_LLR_utils.py): `utils/CS_LLR_utils.py`

### Flow post-processing

- [Post-processing](https://github.com/rfuentes89/flowmri/blob/main/utils/postproc.py): `utils/postproc.py`
- [Background correction](https://github.com/rfuentes89/flowmri/blob/main/utils/execute_MSAC.py): `utils/execute_MSAC.py`
- [Phase unwrapping](https://github.com/rfuentes89/flowmri/blob/main/utils/unwrapFlow.py): `utils/unwrapFlow.py`
- **Reconstruction output**
- **Corrected flow data**

### Other components

- **Researcher**

## Connections

- Researcher → Train and test: configures (evidence: `README.md`)
- Train and test → MRI dataset: loads data (evidence: `main.py`)
- Train and test → FlowMRI-Net: selects model (evidence: `main.py`)
- Train and test → FlowVN: selects model (evidence: `main.py`)
- MRI dataset → SSDU partitioning: partitions k-space (evidence: `utils/dataloader.py`)
- MRI dataset → MRI operators: forms input images (evidence: `utils/dataloader.py`)
- Train and test → MRI operators: computes data consistency (evidence: `main.py`)
- Researcher → CS-LLR runner: configures (evidence: `utils/CS_LLR_exec.py`)
- CS-LLR runner → CS-LLR solver: uses solver functions (evidence: `utils/CS_LLR_exec.py`)
- Researcher → Post-processing: runs processing
- Post-processing → Reconstruction output: loads reconstruction (evidence: `utils/postproc.py`)
- Post-processing → Background correction: fits background phase (evidence: `utils/postproc.py`)
- Post-processing → Phase unwrapping: unwraps phase (evidence: `utils/postproc.py`)
- Post-processing → Corrected flow data: produces corrected data (evidence: `utils/postproc.py`)
- Researcher → Pretrained weights: selects checkpoint (evidence: `README.md`)
