# areatu/sonoforge architecture

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

- Interactive diagram: https://gitdiagram.com/areatu/sonoforge
- Repository: https://github.com/areatu/sonoforge

## Overview

SonoForge is an offline-capable desktop echocardiography workstation for DICOM review, cardiac and Doppler measurements, AI-assisted analysis, and clinical reporting. The main user workflow is to open or retrieve an echo study, review cine frames, annotate and measure, then inspect or export results. Separate capabilities include strain analysis, synchronized multi-view review, reference-data construction, and portable presentation. The graph uses sampled orchestration and infrastructure references where available; README-described feature links without inspected implementation evidence are omitted or marked unverified.

Main entry points: [`src/echo_personal_tool/application/app_controller.py`](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/app_controller.py) (Use-case controller), [`src/echo_personal_tool/presentation/main_window.py`](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/presentation/main_window.py) (Echo workstation), [`src/echo_personal_tool/application/services/dicom_retrieve_service.py`](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/services/dicom_retrieve_service.py) (PACS services), [`src/echo_personal_tool/domain/models`](https://github.com/areatu/sonoforge/tree/main/src/echo_personal_tool/domain/models) (Clinical data models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Desktop workflow"]
  node_application["Application startup<br/>[main.py]"]
  node_workstation["Echo workstation<br/>[main_window.py]"]
  node_controller["Use-case controller<br/>[app_controller.py]"]
  node_frame_loading["Frame loading"]
  node_viewer_state["Viewer state<br/>[state_manager.py]"]
  node_dicom_reading["DICOM reading<br/>[dicom_reader.py]"]
  node_multiview["Multi-view review"]
end

subgraph group_clinical["Clinical analysis"]
  node_domain_models["Clinical data models"]
  node_domain_ports["Domain interfaces<br/>[ports.py]"]
  node_measurements["Cardiac measurements"]
  node_doppler["Doppler analysis"]
  node_segmentation["AI segmentation"]
  node_inference["ONNX inference<br/>[onnx_engine.py]"]
  node_strain["Strain tracking<br/>[speckle_worker.py]"]
  node_study_session["Study measurements"]
end

subgraph group_connectivity["DICOM connectivity"]
  node_pacs["PACS services"]
  node_download_worker["Study retrieval"]
  node_dimse["DIMSE client<br/>[dimse_client.py]"]
  node_storage_scp["C-MOVE receiver"]
end

subgraph group_extensions["Reporting and extensions"]
  node_reporting["Clinical reporting<br/>[report_builder.py]"]
  node_reference_constructor["Reference constructor"]
  node_reference_storage["Reference storage<br/>[yaml_storage.py]"]
  node_presenter["Presenter mode"]
end

node_clinician(("Clinician"))
node_pacs_server(("PACS server"))

node_clinician -->|"launches"| node_application
node_application -->|"starts"| node_workstation
node_workstation -.->|"delegates"| node_controller
node_controller -->|"loads frames"| node_frame_loading
node_controller -->|"reads state"| node_viewer_state
node_frame_loading -.->|"decodes media"| node_dicom_reading
node_controller -->|"computes results"| node_measurements
node_controller -.->|"updates session"| node_study_session
node_controller -->|"uses clinical data"| node_domain_models
node_domain_ports -->|"defines contracts"| node_domain_models
node_inference -->|"implements inference"| node_segmentation
node_controller -.->|"requests analysis"| node_segmentation
node_controller -.->|"starts analysis"| node_strain
node_strain -->|"produces results"| node_domain_models
node_controller -.->|"calibrates Doppler"| node_doppler
node_workstation -->|"offers synchronized review"| node_multiview
node_download_worker -->|"retrieves instances"| node_pacs
node_pacs -->|"uses DIMSE"| node_dimse
node_pacs -.->|"requests studies"| node_pacs_server
node_dimse -.->|"delivers C-MOVE data"| node_storage_scp
node_pacs_server -.->|"sends instances"| node_storage_scp
node_workstation -->|"supports reporting"| node_reporting
node_reference_constructor -.->|"stores references"| node_reference_storage
node_clinician -->|"presents studies"| node_presenter

click node_application "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/main.py"
click node_workstation "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/presentation/main_window.py"
click node_controller "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/app_controller.py"
click node_frame_loading "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/frame_loader_worker.py"
click node_viewer_state "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/state_manager.py"
click node_dicom_reading "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/dicom_reader.py"
click node_domain_models "https://github.com/areatu/sonoforge/tree/main/src/echo_personal_tool/domain/models"
click node_domain_ports "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/ports.py"
click node_measurements "https://github.com/areatu/sonoforge/tree/main/src/echo_personal_tool/domain/calculations"
click node_doppler "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/doppler_calibration.py"
click node_segmentation "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/segmentation_service.py"
click node_inference "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/onnx_engine.py"
click node_strain "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/speckle_worker.py"
click node_multiview "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/presentation/multiview_controller.py"
click node_study_session "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/study_measurement_session.py"
click node_pacs "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/services/dicom_retrieve_service.py"
click node_download_worker "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/orthanc_download_worker.py"
click node_dimse "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/dimse_client.py"
click node_storage_scp "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/embedded_storage_scp.py"
click node_reporting "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/report_builder.py"
click node_reference_constructor "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/constructor/constructor_widget.py"
click node_reference_storage "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/constructor/storage/yaml_storage.py"
click node_presenter "https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/__main_presenter__.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_application,node_workstation,node_controller,node_frame_loading,node_viewer_state,node_dicom_reading,node_multiview toneBlue
class node_domain_models,node_domain_ports,node_measurements,node_doppler,node_segmentation,node_inference,node_strain,node_study_session toneAmber
class node_pacs,node_download_worker,node_dimse,node_storage_scp,node_pacs_server toneMint
class node_reporting,node_reference_constructor,node_reference_storage,node_presenter toneRose
class node_clinician toneIndigo
```

## Components

### Desktop workflow

- [Application startup](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/main.py): `src/echo_personal_tool/main.py`
- [Echo workstation](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/presentation/main_window.py): `src/echo_personal_tool/presentation/main_window.py`
- [Use-case controller](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/app_controller.py): `src/echo_personal_tool/application/app_controller.py`
- [Frame loading](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/frame_loader_worker.py): `src/echo_personal_tool/application/workers/frame_loader_worker.py`
- [Viewer state](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/state_manager.py): `src/echo_personal_tool/application/state_manager.py`
- [DICOM reading](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/dicom_reader.py): `src/echo_personal_tool/infrastructure/dicom_reader.py`
- [Multi-view review](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/presentation/multiview_controller.py): `src/echo_personal_tool/presentation/multiview_controller.py`

### Clinical analysis

- [Clinical data models](https://github.com/areatu/sonoforge/tree/main/src/echo_personal_tool/domain/models): `src/echo_personal_tool/domain/models`
- [Domain interfaces](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/ports.py): `src/echo_personal_tool/domain/ports.py`
- [Cardiac measurements](https://github.com/areatu/sonoforge/tree/main/src/echo_personal_tool/domain/calculations): `src/echo_personal_tool/domain/calculations`
- [Doppler analysis](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/doppler_calibration.py): `src/echo_personal_tool/domain/services/doppler_calibration.py`
- [AI segmentation](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/segmentation_service.py): `src/echo_personal_tool/domain/services/segmentation_service.py`
- [ONNX inference](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/onnx_engine.py): `src/echo_personal_tool/infrastructure/onnx_engine.py`
- [Strain tracking](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/speckle_worker.py): `src/echo_personal_tool/application/workers/speckle_worker.py`
- [Study measurements](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/study_measurement_session.py): `src/echo_personal_tool/application/study_measurement_session.py`

### DICOM connectivity

- [PACS services](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/services/dicom_retrieve_service.py): `src/echo_personal_tool/application/services/dicom_retrieve_service.py`
- [Study retrieval](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/application/workers/orthanc_download_worker.py): `src/echo_personal_tool/application/workers/orthanc_download_worker.py`
- [DIMSE client](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/dimse_client.py): `src/echo_personal_tool/infrastructure/dimse_client.py`
- [C-MOVE receiver](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/infrastructure/embedded_storage_scp.py): `src/echo_personal_tool/infrastructure/embedded_storage_scp.py`

### Reporting and extensions

- [Clinical reporting](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/domain/services/report_builder.py): `src/echo_personal_tool/domain/services/report_builder.py`
- [Reference constructor](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/constructor/constructor_widget.py): `src/echo_personal_tool/constructor/constructor_widget.py`
- [Reference storage](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/constructor/storage/yaml_storage.py): `src/echo_personal_tool/constructor/storage/yaml_storage.py`
- [Presenter mode](https://github.com/areatu/sonoforge/blob/main/src/echo_personal_tool/__main_presenter__.py): `src/echo_personal_tool/__main_presenter__.py`

### Other components

- **Clinician**
- **PACS server**

## Connections

- Clinician → Application startup: launches
- Application startup → Echo workstation: starts (evidence: `src/echo_personal_tool/main.py`)
- Echo workstation → Use-case controller: delegates
- Use-case controller → Frame loading: loads frames (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Use-case controller → Viewer state: reads state (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Frame loading → DICOM reading: decodes media
- Use-case controller → Cardiac measurements: computes results (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Use-case controller → Study measurements: updates session (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Use-case controller → Clinical data models: uses clinical data (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Domain interfaces → Clinical data models: defines contracts (evidence: `src/echo_personal_tool/domain/ports.py`)
- ONNX inference → AI segmentation: implements inference (evidence: `src/echo_personal_tool/infrastructure/onnx_engine.py`)
- Use-case controller → AI segmentation: requests analysis (evidence: `src/echo_personal_tool/application/app_controller.py`)
- Use-case controller → Strain tracking: starts analysis
- Strain tracking → Clinical data models: produces results (evidence: `src/echo_personal_tool/application/workers/speckle_worker.py`)
- Use-case controller → Doppler analysis: calibrates Doppler
- Echo workstation → Multi-view review: offers synchronized review
- Study retrieval → PACS services: retrieves instances (evidence: `src/echo_personal_tool/application/workers/orthanc_download_worker.py`)
- PACS services → DIMSE client: uses DIMSE (evidence: `src/echo_personal_tool/application/services/dicom_retrieve_service.py`)
- PACS services → PACS server: requests studies
- DIMSE client → C-MOVE receiver: delivers C-MOVE data
- PACS server → C-MOVE receiver: sends instances
- Echo workstation → Clinical reporting: supports reporting
- Reference constructor → Reference storage: stores references
- Clinician → Presenter mode: presents studies
