# yuhangliu98/mred-net architecture

> Architecture diagram of the GitHub repository yuhangliu98/mred-net, 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/yuhangliu98/mred-net
- Repository: https://github.com/yuhangliu98/mred-net

## Overview

MRED-Net is a low-dose CT denoising research application. Its principal workflow prepares DICOM scans as normalized NumPy slices, loads paired low-/full-dose data, trains or evaluates a Mamba-based residual encoder–decoder, and reports denoising quality. The README documents the ET2T, Mamba, encoder–decoder, and compound-loss capabilities; source excerpts confirm the entry point, loader, model components, and solver responsibilities. Some architectural links are based on README statements rather than inspected call sites.

Main entry points: [`MRED-net/solver.py`](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/solver.py) (Train and test solver), [`MRED-net/MREDnet.py`](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py) (MRED-Net), [`MRED-net/main.py`](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/main.py) (Run configuration), [`MRED-net/prep.py`](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/prep.py) (DICOM preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["CT Data"]
  node_dicom["DICOM scans"]
  node_prep["DICOM preparation<br/>[prep.py]"]
  node_npy["Normalized NPY pairs"]
  node_loader["CT dataset loader<br/>[loader.py]"]
  node_augment["Patch augmentation<br/>[data_aug.py]"]
end

subgraph group_model["Denoising Model"]
  node_model["MRED-Net<br/>[MREDnet.py]"]
  node_et2t["ET2T blocks<br/>[MREDnet.py]"]
  node_mamba["Mamba state-space blocks<br/>[MREDnet.py]"]
  node_encoder["Residual encoder–decoder<br/>[MREDnet.py]"]
end

subgraph group_learning["Training and Evaluation"]
  node_entry["Run configuration<br/>[main.py]"]
  node_solver["Train and test solver<br/>[solver.py]"]
  node_loss["Compound and feature losses<br/>[loss.py]"]
  node_metrics["Image quality metrics<br/>[measure.py]"]
end

subgraph group_results["Outputs"]
  node_results["Checkpoints and figures"]
end

node_user(("Researcher"))

node_user -->|"prepares scans"| node_prep
node_dicom -->|"reads scans"| node_prep
node_prep -->|"writes normalized slices"| node_npy
node_user -->|"configures run"| node_entry
node_entry -->|"builds data loaders"| node_loader
node_npy -->|"loads paired slices"| node_loader
node_loader -->|"augments patches"| node_augment
node_entry -->|"starts training or testing"| node_solver
node_solver -->|"runs denoising model"| node_model
node_solver -->|"uses training losses"| node_loss
node_solver -->|"measures image quality"| node_metrics
node_solver -->|"saves checkpoints and figures"| node_results
node_model -.->|"uses local token blocks"| node_et2t
node_model -.->|"uses state-space blocks"| node_mamba
node_model -.->|"forms residual architecture"| node_encoder
node_solver -.->|"reports denoising results"| node_user

click node_prep "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/prep.py"
click node_loader "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/loader.py"
click node_augment "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/data_aug.py"
click node_entry "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/main.py"
click node_solver "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/solver.py"
click node_model "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py"
click node_et2t "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py"
click node_mamba "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py"
click node_encoder "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py"
click node_loss "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/loss.py"
click node_metrics "https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/measure.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_dicom,node_prep,node_npy,node_loader,node_augment toneBlue
class node_model,node_et2t,node_mamba,node_encoder toneAmber
class node_entry,node_solver,node_loss,node_metrics toneMint
class node_results toneRose
class node_user toneIndigo
```

## Components

### CT Data

- **DICOM scans**
- [DICOM preparation](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/prep.py): `MRED-net/prep.py`
- **Normalized NPY pairs**
- [CT dataset loader](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/loader.py): `MRED-net/loader.py`
- [Patch augmentation](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/data_aug.py): `MRED-net/data_aug.py`

### Denoising Model

- [MRED-Net](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py): `MRED-net/MREDnet.py`
- [ET2T blocks](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py): `MRED-net/MREDnet.py`
- [Mamba state-space blocks](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py): `MRED-net/MREDnet.py`
- [Residual encoder–decoder](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/MREDnet.py): `MRED-net/MREDnet.py`

### Training and Evaluation

- [Run configuration](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/main.py): `MRED-net/main.py`
- [Train and test solver](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/solver.py): `MRED-net/solver.py`
- [Compound and feature losses](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/loss.py): `MRED-net/loss.py`
- [Image quality metrics](https://github.com/yuhangliu98/mred-net/blob/main/MRED-net/measure.py): `MRED-net/measure.py`

### Outputs

- **Checkpoints and figures**

### Other components

- **Researcher**

## Connections

- Researcher → DICOM preparation: prepares scans (evidence: `README.md`)
- DICOM scans → DICOM preparation: reads scans (evidence: `MRED-net/prep.py`)
- DICOM preparation → Normalized NPY pairs: writes normalized slices (evidence: `MRED-net/prep.py`)
- Researcher → Run configuration: configures run (evidence: `README.md`)
- Run configuration → CT dataset loader: builds data loaders (evidence: `MRED-net/main.py`)
- Normalized NPY pairs → CT dataset loader: loads paired slices (evidence: `MRED-net/loader.py`)
- CT dataset loader → Patch augmentation: augments patches (evidence: `MRED-net/loader.py`)
- Run configuration → Train and test solver: starts training or testing (evidence: `MRED-net/main.py`)
- Train and test solver → MRED-Net: runs denoising model (evidence: `MRED-net/solver.py`)
- Train and test solver → Compound and feature losses: uses training losses (evidence: `MRED-net/solver.py`)
- Train and test solver → Image quality metrics: measures image quality (evidence: `MRED-net/solver.py`)
- Train and test solver → Checkpoints and figures: saves checkpoints and figures (evidence: `MRED-net/solver.py`)
- MRED-Net → ET2T blocks: uses local token blocks (evidence: `README.md`)
- MRED-Net → Mamba state-space blocks: uses state-space blocks (evidence: `README.md`)
- MRED-Net → Residual encoder–decoder: forms residual architecture (evidence: `README.md`)
- Train and test solver → Researcher: reports denoising results (evidence: `README.md`)
