# rgonzalezlopez/lisa2025teamupf architecture

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

- Interactive diagram: https://gitdiagram.com/rgonzalezlopez/lisa2025teamupf
- Repository: https://github.com/rgonzalezlopez/lisa2025teamupf

## Overview

This repository is a MICCAI LISA 2025 solution with two user-facing outcomes: MRI quality/artifact assessment and anatomical segmentation. The README describes ordinal, Bayesian, and ensemble QA, plus nnU-Net and LoRA-fine-tuned SAM-Med3D segmentation. The tree supports these major branches, but sampled implementation excerpts are limited; some internal wiring is therefore shown only where the README or excerpts support it.

Main entry points: [`Task01/src`](https://github.com/rgonzalezlopez/lisa2025teamupf/tree/main/Task01/src) (QA workflows), [`run_model.py`](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/run_model.py) (Segmentation workflows), [`SAM-Med3D-lora/segment_anything/modeling/sam3D.py`](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/segment_anything/modeling/sam3D.py) (3D prompt segmentation), [`Task01/src/models/train_ordinal.py`](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/models/train_ordinal.py) (Ordinal QA training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_qa["Quality assessment"]
  node_qa_pipeline["QA workflows"]
  node_qa_ordinal["Ordinal QA training<br/>[train_ordinal.py]"]
  node_qa_bayes["Bayesian QA"]
  node_qa_ensemble["QA ensemble<br/>[ensemble_eval.py]"]
  node_qa_classical["Image quality features<br/>[feat_extraction.py]"]
  node_qa_result["Quality and artifacts<br/>[metrics.py]"]
end

subgraph group_seg["Segmentation"]
  node_seg_pipeline["Segmentation workflows<br/>[run_model.py]"]
end

subgraph group_nnunet["nnU-Net runtime"]
  node_nn_plan["Dataset planning"]
  node_nn_train["nnU-Net training<br/>[nnUNetTrainer.py]"]
  node_nn_infer["Sliding-window inference"]
  node_nn_export["Segmentation export"]
  node_nn_plans["Plans and labels<br/>[plans_handler.py]"]
end

subgraph group_sam["SAM-Med3D"]
  node_sam_train["LoRA fine-tuning<br/>[train_lora.py]"]
  node_sam_model["3D prompt segmentation<br/>[sam3D.py]"]
  node_sam_clicks["Interactive clicks<br/>[click_method.py]"]
  node_sam_result["Structure masks<br/>[infer_utils.py]"]
end

node_clinician(("MRI user"))
node_mri["MRI volumes"]

node_clinician -->|"provides"| node_mri
node_mri -->|"assesses"| node_qa_pipeline
node_qa_pipeline -->|"trains"| node_qa_ordinal
node_qa_pipeline -->|"extracts features"| node_qa_classical
node_qa_ordinal -->|"models co-occurrence"| node_qa_bayes
node_qa_bayes -->|"combines predictions"| node_qa_ensemble
node_qa_pipeline -->|"reports"| node_qa_result
node_clinician -->|"requests masks"| node_seg_pipeline
node_mri -->|"supplies volumes"| node_seg_pipeline
node_seg_pipeline -->|"plans data"| node_nn_plan
node_nn_plan -->|"defines configuration"| node_nn_plans
node_nn_plans -->|"configures"| node_nn_train
node_nn_train -->|"provides model"| node_nn_infer
node_nn_infer -->|"exports predictions"| node_nn_export
node_seg_pipeline -.->|"fine-tunes alternative"| node_sam_train
node_sam_train -->|"adapts model"| node_sam_model
node_sam_model -->|"uses prompts"| node_sam_clicks
node_sam_model -->|"produces masks"| node_sam_result
node_nn_export -.->|"produces masks"| node_sam_result

click node_qa_pipeline "https://github.com/rgonzalezlopez/lisa2025teamupf/tree/main/Task01/src"
click node_qa_ordinal "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/models/train_ordinal.py"
click node_qa_bayes "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/SupCon/validation_bayesian.py"
click node_qa_ensemble "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/SupCon/ensemble_eval.py"
click node_qa_classical "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/classical/feat_extraction.py"
click node_qa_result "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/evaluation/metrics.py"
click node_seg_pipeline "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/run_model.py"
click node_nn_plan "https://github.com/rgonzalezlopez/lisa2025teamupf/tree/main/nnUNet/nnunetv2/experiment_planning"
click node_nn_train "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py"
click node_nn_infer "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/inference/predict_from_raw_data.py"
click node_nn_export "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/inference/export_prediction.py"
click node_nn_plans "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/utilities/plans_handling/plans_handler.py"
click node_sam_train "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/train_lora.py"
click node_sam_model "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/segment_anything/modeling/sam3D.py"
click node_sam_clicks "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/utils/click_method.py"
click node_sam_result "https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/utils/infer_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_qa_pipeline,node_qa_ordinal,node_qa_bayes,node_qa_ensemble,node_qa_classical,node_qa_result,node_clinician toneBlue
class node_seg_pipeline toneAmber
class node_nn_plan,node_nn_train,node_nn_infer,node_nn_export,node_nn_plans toneMint
class node_sam_train,node_sam_model,node_sam_clicks,node_sam_result toneRose
class node_mri toneIndigo
```

## Components

### Quality assessment

- [QA workflows](https://github.com/rgonzalezlopez/lisa2025teamupf/tree/main/Task01/src): `Task01/src`
- [Ordinal QA training](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/models/train_ordinal.py): `Task01/src/models/train_ordinal.py`
- [Bayesian QA](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/SupCon/validation_bayesian.py): `Task01/SupCon/validation_bayesian.py`
- [QA ensemble](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/SupCon/ensemble_eval.py): `Task01/SupCon/ensemble_eval.py`
- [Image quality features](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/classical/feat_extraction.py): `Task01/src/classical/feat_extraction.py`
- [Quality and artifacts](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/Task01/src/evaluation/metrics.py): `Task01/src/evaluation/metrics.py`

### Segmentation

- [Segmentation workflows](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/run_model.py): `run_model.py`

### nnU-Net runtime

- [Dataset planning](https://github.com/rgonzalezlopez/lisa2025teamupf/tree/main/nnUNet/nnunetv2/experiment_planning): `nnUNet/nnunetv2/experiment_planning`
- [nnU-Net training](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py): `nnUNet/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py`
- [Sliding-window inference](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/inference/predict_from_raw_data.py): `nnUNet/nnunetv2/inference/predict_from_raw_data.py`
- [Segmentation export](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/inference/export_prediction.py): `nnUNet/nnunetv2/inference/export_prediction.py`
- [Plans and labels](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/nnUNet/nnunetv2/utilities/plans_handling/plans_handler.py): `nnUNet/nnunetv2/utilities/plans_handling/plans_handler.py`

### SAM-Med3D

- [LoRA fine-tuning](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/train_lora.py): `SAM-Med3D-lora/train_lora.py`
- [3D prompt segmentation](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/segment_anything/modeling/sam3D.py): `SAM-Med3D-lora/segment_anything/modeling/sam3D.py`
- [Interactive clicks](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/utils/click_method.py): `SAM-Med3D-lora/utils/click_method.py`
- [Structure masks](https://github.com/rgonzalezlopez/lisa2025teamupf/blob/main/SAM-Med3D-lora/utils/infer_utils.py): `SAM-Med3D-lora/utils/infer_utils.py`

### Other components

- **MRI user**
- **MRI volumes**

## Connections

- MRI user → MRI volumes: provides
- MRI volumes → QA workflows: assesses
- QA workflows → Ordinal QA training: trains
- QA workflows → Image quality features: extracts features
- Ordinal QA training → Bayesian QA: models co-occurrence
- Bayesian QA → QA ensemble: combines predictions
- QA workflows → Quality and artifacts: reports
- MRI user → Segmentation workflows: requests masks
- MRI volumes → Segmentation workflows: supplies volumes
- Segmentation workflows → Dataset planning: plans data
- Dataset planning → Plans and labels: defines configuration
- Plans and labels → nnU-Net training: configures
- nnU-Net training → Sliding-window inference: provides model
- Sliding-window inference → Segmentation export: exports predictions
- Segmentation workflows → LoRA fine-tuning: fine-tunes alternative
- LoRA fine-tuning → 3D prompt segmentation: adapts model
- 3D prompt segmentation → Interactive clicks: uses prompts
- 3D prompt segmentation → Structure masks: produces masks
- Segmentation export → Structure masks: produces masks
