# lhfazry/ncct-seg-notebooks architecture

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

- Interactive diagram: https://gitdiagram.com/lhfazry/ncct-seg-notebooks
- Repository: https://github.com/lhfazry/ncct-seg-notebooks

## Overview

This repository is a collection of NCCT stroke-segmentation notebooks and a V8 training implementation. Its demonstrated workflow loads image/mask pairs, derives distance maps and image tensors, trains a segmentation model with configurable physics-informed losses, then evaluates results and runs loss ablations. The README instead describes a MAGIC perfusion-map GAN and does not match the sampled code, so that workflow is not represented as implemented here. Notebook contents beyond the sampled files are unknown; edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`v8_losses.py`](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py) (Combined loss), [`v8_ablation.py`](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py) (Loss ablation), [`v8_dataset.py`](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py) (NCCT dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["NCCT dataset<br/>[v8_dataset.py]"]
  node_distance["Distance maps<br/>[v8_dataset.py]"]
  node_loaders["Data loaders<br/>[v8_dataset.py]"]
end

subgraph group_runtime["Segmentation runtime"]
  node_model["Segmentation model<br/>[v8_ablation.py]"]
  node_base_loss["Base segmentation loss<br/>[v8_losses.py]"]
  node_physics_losses["Physics losses<br/>[v8_losses.py]"]
  node_combined_loss["Combined loss<br/>[v8_losses.py]"]
  node_train["Training loop<br/>[v8_ablation.py]"]
  node_evaluate["Evaluation<br/>[v8_ablation.py]"]
  node_metrics["Segmentation metrics<br/>[v8_ablation.py]"]
end

subgraph group_research["Experiments"]
  node_ablation["Loss ablation<br/>[v8_ablation.py]"]
  node_ablation_results["Ablation results<br/>[v8_ablation.py]"]
  node_segmentation_notebooks["Segmentation notebooks"]
  node_classification_notebooks["Classification notebooks"]
end

node_researcher(("Researcher"))

node_dataset -->|"computes"| node_distance
node_loaders -->|"wraps"| node_dataset
node_researcher -.->|"runs"| node_train
node_train -->|"calls"| node_model
node_train -->|"computes"| node_combined_loss
node_train -.->|"consumes"| node_loaders
node_combined_loss -->|"combines"| node_base_loss
node_combined_loss -->|"combines"| node_physics_losses
node_evaluate -->|"evaluates"| node_model
node_evaluate -->|"computes"| node_combined_loss
node_evaluate -->|"computes"| node_metrics
node_ablation -->|"trains"| node_model
node_ablation -->|"configures"| node_combined_loss
node_ablation -->|"validates"| node_evaluate
node_ablation -->|"aggregates"| node_ablation_results

click node_dataset "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py"
click node_distance "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py"
click node_loaders "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py"
click node_model "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_base_loss "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py"
click node_physics_losses "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py"
click node_combined_loss "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py"
click node_train "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_evaluate "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_metrics "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_ablation "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_ablation_results "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py"
click node_segmentation_notebooks "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/NCCT_Segmentation_V9.ipynb"
click node_classification_notebooks "https://github.com/lhfazry/ncct-seg-notebooks/blob/main/NCCT_MultiStage_Classification_V3.ipynb"

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_dataset,node_distance,node_loaders toneBlue
class node_model,node_base_loss,node_physics_losses,node_combined_loss,node_train,node_evaluate,node_metrics toneAmber
class node_ablation,node_ablation_results,node_segmentation_notebooks,node_classification_notebooks toneMint
class node_researcher toneIndigo
```

## Components

### Data preparation

- [NCCT dataset](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py): `v8_dataset.py`
- [Distance maps](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py): `v8_dataset.py`
- [Data loaders](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_dataset.py): `v8_dataset.py`

### Segmentation runtime

- [Segmentation model](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`
- [Base segmentation loss](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py): `v8_losses.py`
- [Physics losses](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py): `v8_losses.py`
- [Combined loss](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_losses.py): `v8_losses.py`
- [Training loop](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`
- [Evaluation](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`
- [Segmentation metrics](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`

### Experiments

- [Loss ablation](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`
- [Ablation results](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/v8_ablation.py): `v8_ablation.py`
- [Segmentation notebooks](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/NCCT_Segmentation_V9.ipynb): `NCCT_Segmentation_V9.ipynb`
- [Classification notebooks](https://github.com/lhfazry/ncct-seg-notebooks/blob/main/NCCT_MultiStage_Classification_V3.ipynb): `NCCT_MultiStage_Classification_V3.ipynb`

### Other components

- **Researcher**

## Connections

- NCCT dataset → Distance maps: computes (evidence: `v8_dataset.py`)
- Data loaders → NCCT dataset: wraps (evidence: `v8_dataset.py`)
- Researcher → Training loop: runs
- Training loop → Segmentation model: calls (evidence: `v8_ablation.py`)
- Training loop → Combined loss: computes (evidence: `v8_ablation.py`)
- Training loop → Data loaders: consumes (evidence: `v8_ablation.py`)
- Combined loss → Base segmentation loss: combines (evidence: `v8_losses.py`)
- Combined loss → Physics losses: combines (evidence: `v8_losses.py`)
- Evaluation → Segmentation model: evaluates (evidence: `v8_ablation.py`)
- Evaluation → Combined loss: computes (evidence: `v8_ablation.py`)
- Evaluation → Segmentation metrics: computes (evidence: `v8_ablation.py`)
- Loss ablation → Segmentation model: trains (evidence: `v8_ablation.py`)
- Loss ablation → Combined loss: configures (evidence: `v8_ablation.py`)
- Loss ablation → Evaluation: validates (evidence: `v8_ablation.py`)
- Loss ablation → Ablation results: aggregates (evidence: `v8_ablation.py`)
