# chemai-lab/vir-olo architecture

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

- Interactive diagram: https://gitdiagram.com/chemai-lab/vir-olo
- Repository: https://github.com/chemai-lab/vir-olo
- Video tour (about a minute): https://gitdiagram.com/chemai-lab/vir-olo/video

## Overview

vIR-OLO is a PyQt5 desktop application for annotating infrared-spectrum images and running YOLO peak detection. The user launches the GUI, creates or opens an image project, annotates spectra manually or with model predictions, reviews and edits boxes and labels, and saves annotations in YOLO format. The App controller coordinates the GUI, image handling, annotation canvas, inference, and model downloads. The README documents several capabilities whose detailed implementations are not fully excerpted; links for those are limited to documented relationships.

Main entry points: [`src/virolo/spectrai.py`](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/spectrai.py) (App controller), [`src/virolo/cli.py`](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/cli.py) (CLI launcher), [`src/virolo/ui/canvas_widget.py`](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/canvas_widget.py) (Annotation canvas), [`src/virolo/ui/box_manager.py`](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/box_manager.py) (Box manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_cli["CLI launcher<br/>[cli.py]"]
  node_controller["App controller<br/>[spectrai.py]"]
  node_mainui["Main window UI<br/>[main_ui.py]"]
end

subgraph group_annotation["Annotation"]
  node_canvas["Annotation canvas<br/>[canvas_widget.py]"]
  node_box_manager["Box manager<br/>[box_manager.py]"]
  node_bounding_box["Bounding box<br/>[bounding_box.py]"]
  node_label_editor["Label editor dialog"]
  node_label_edit_ui["Label edit form<br/>[label_edit.py]"]
  node_label_new_dialog["New label dialog"]
  node_label_new_ui["New label form<br/>[label_new.py]"]
end

subgraph group_models["Models and inference"]
  node_predictor["YOLO predictor<br/>[predict.py]"]
  node_model_manager["Default model downloader"]
  node_huggingface{{"Hugging Face"}}
end

subgraph group_images["Image and project data"]
  node_image_manager["Image manager<br/>[image_loader.py]"]
  node_project_files[("Project images and annotations<br/>[spectrai.py]")]
end

node_user(("Researcher"))

node_user -->|"launches"| node_cli
node_cli -->|"creates App"| node_controller
node_controller -->|"configures UI"| node_mainui
node_controller -->|"loads images"| node_image_manager
node_controller -->|"coordinates annotation"| node_canvas
node_controller -->|"runs prediction"| node_predictor
node_controller -->|"downloads models"| node_model_manager
node_controller -->|"saves annotations"| node_project_files
node_image_manager -->|"reads images"| node_project_files
node_canvas -->|"adds or removes boxes"| node_box_manager
node_box_manager -->|"manages instances"| node_bounding_box
node_label_editor -->|"uses form"| node_label_edit_ui
node_label_new_dialog -->|"uses form"| node_label_new_ui
node_model_manager -->|"downloads from"| node_huggingface

click node_cli "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/cli.py"
click node_controller "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/spectrai.py"
click node_mainui "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/main_ui.py"
click node_image_manager "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/tools/image_loader.py"
click node_project_files "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/spectrai.py"
click node_canvas "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/canvas_widget.py"
click node_box_manager "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/box_manager.py"
click node_bounding_box "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/bounding_box.py"
click node_label_editor "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_editor_dialog.py"
click node_label_edit_ui "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_edit.py"
click node_label_new_dialog "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_new_dialog.py"
click node_label_new_ui "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_new.py"
click node_predictor "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/models/predict.py"
click node_model_manager "https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/tools/donwload_default_models.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_cli,node_controller,node_mainui toneBlue
class node_canvas,node_box_manager,node_bounding_box,node_label_editor,node_label_edit_ui,node_label_new_dialog,node_label_new_ui toneAmber
class node_predictor,node_model_manager,node_huggingface toneMint
class node_image_manager,node_project_files toneRose
class node_user toneIndigo
```

## Components

### Application

- [CLI launcher](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/cli.py): `src/virolo/cli.py`
- [App controller](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/spectrai.py): `src/virolo/spectrai.py`
- [Main window UI](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/main_ui.py): `src/virolo/ui/main_ui.py`

### Annotation

- [Annotation canvas](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/canvas_widget.py): `src/virolo/ui/canvas_widget.py`
- [Box manager](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/box_manager.py): `src/virolo/ui/box_manager.py`
- [Bounding box](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/bounding_box.py): `src/virolo/ui/bounding_box.py`
- [Label editor dialog](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_editor_dialog.py): `src/virolo/ui/label_editor_dialog.py`
- [Label edit form](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_edit.py): `src/virolo/ui/label_edit.py`
- [New label dialog](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_new_dialog.py): `src/virolo/ui/label_new_dialog.py`
- [New label form](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/ui/label_new.py): `src/virolo/ui/label_new.py`

### Models and inference

- [YOLO predictor](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/models/predict.py): `src/virolo/models/predict.py`
- [Default model downloader](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/tools/donwload_default_models.py): `src/virolo/tools/donwload_default_models.py`
- **Hugging Face**

### Image and project data

- [Image manager](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/tools/image_loader.py): `src/virolo/tools/image_loader.py`
- [Project images and annotations](https://github.com/chemai-lab/vir-olo/blob/main/src/virolo/spectrai.py): `src/virolo/spectrai.py`

### Other components

- **Researcher**

## Connections

- Researcher → CLI launcher: launches (evidence: `README.md`)
- CLI launcher → App controller: creates App (evidence: `src/virolo/cli.py`)
- App controller → Main window UI: configures UI (evidence: `src/virolo/spectrai.py`)
- App controller → Image manager: loads images (evidence: `src/virolo/spectrai.py`)
- App controller → Annotation canvas: coordinates annotation (evidence: `src/virolo/spectrai.py`)
- App controller → YOLO predictor: runs prediction (evidence: `README.md`)
- App controller → Default model downloader: downloads models (evidence: `README.md`)
- App controller → Project images and annotations: saves annotations (evidence: `src/virolo/spectrai.py`)
- Image manager → Project images and annotations: reads images (evidence: `src/virolo/tools/image_loader.py`)
- Annotation canvas → Box manager: adds or removes boxes (evidence: `src/virolo/ui/canvas_widget.py`)
- Box manager → Bounding box: manages instances (evidence: `src/virolo/ui/box_manager.py`)
- Label editor dialog → Label edit form: uses form (evidence: `src/virolo/ui/label_editor_dialog.py`)
- New label dialog → New label form: uses form (evidence: `src/virolo/ui/label_new_dialog.py`)
- Default model downloader → Hugging Face: downloads from (evidence: `src/virolo/tools/donwload_default_models.py`)
