# mghphysicsresearch/hedos architecture

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

- Interactive diagram: https://gitdiagram.com/mghphysicsresearch/hedos
- Repository: https://github.com/mghphysicsresearch/hedos

## Overview

HEDOS simulates stochastic blood flow through anatomical compartments and combines particle trajectories with radiation dose rates to produce a blood-dose distribution. The user configures a calculation in the example entry point, then selects field-based patient data or organ DVHs. Both workflows initialize a flow model, generate or reload temporal trajectories, accumulate dose, and visualize the result. The README documents these stages; edges are limited to relationships visible in the excerpts or explicit documentation, so unsampled setup details are not expanded.

Main entry points: [`workflows/BloodDoseFromDVH.py`](https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromDVH.py) (DVH workflow), [`workflows/BloodDoseFromFields.py`](https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromFields.py) (Field workflow), [`examples/BloodDose.py`](https://github.com/mghphysicsresearch/hedos/blob/main/examples/BloodDose.py) (Calculation setup), [`simulation/FlowModel.py`](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/FlowModel.py) (Compartment model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Calculation workflows"]
  node_entry["Calculation setup<br/>[BloodDose.py]"]
  node_fields["Field workflow"]
  node_dvhworkflow["DVH workflow"]
end

subgraph group_flow["Blood-flow simulation"]
  node_model["Compartment model<br/>[FlowModel.py]"]
  node_chain["Transit chains<br/>[Chains.py]"]
  node_weibull["Weibull timing<br/>[Weibull.py]"]
  node_temporal["Particle trajectories"]
end

subgraph group_dose["Dose calculation"]
  node_fieldrate["Field dose rate<br/>[DoseRate.py]"]
  node_dvh_rate["DVH dose rate<br/>[DoseRate.py]"]
  node_accumulator["Dose accumulation<br/>[CompartmentDose.py]"]
  node_visualization["Dose visualization"]
end

subgraph group_patient["Patient data"]
  node_patientdata["Patient volumes<br/>[LoadPatient.py]"]
  node_patientfiles[("Segmentations and affine")]
  node_phantom["Compartment workbook"]
  node_dvhs[("Organ DVHs")]
end

node_user(("Researcher"))

node_user -->|"configures"| node_entry
node_entry -->|"selects workflow"| node_fields
node_entry -->|"selects workflow"| node_dvhworkflow
node_fields -->|"loads patient"| node_patientdata
node_patientdata -->|"reads volumes"| node_patientfiles
node_fields -->|"initializes"| node_model
node_dvhworkflow -->|"initializes"| node_model
node_fields -->|"provides model file"| node_phantom
node_dvhworkflow -->|"provides model file"| node_phantom
node_model -->|"builds chain"| node_chain
node_chain -->|"uses timing"| node_weibull
node_fields -->|"generates trajectories"| node_temporal
node_dvhworkflow -->|"generates trajectories"| node_temporal
node_temporal -->|"walks chain"| node_chain
node_fields -->|"builds dose rate"| node_fieldrate
node_fields -->|"accumulates dose"| node_accumulator
node_dvhworkflow -->|"loads DVH rates"| node_dvh_rate
node_dvhworkflow -->|"reads organ DVHs"| node_dvhs
node_dvhworkflow -->|"accumulates dose"| node_accumulator
node_accumulator -->|"plots distribution"| node_visualization
node_dvhworkflow -->|"plots distribution"| node_visualization
node_fieldrate -->|"reads dose fields"| node_patientdata
node_dvh_rate -->|"reads dose histograms"| node_dvhs

click node_entry "https://github.com/mghphysicsresearch/hedos/blob/main/examples/BloodDose.py"
click node_fields "https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromFields.py"
click node_dvhworkflow "https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromDVH.py"
click node_model "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/FlowModel.py"
click node_chain "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/Chains.py"
click node_weibull "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/Weibull.py"
click node_temporal "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/TemporalDistribution.py"
click node_patientdata "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/LoadPatient.py"
click node_patientfiles "https://github.com/mghphysicsresearch/hedos/tree/main/input/patient"
click node_phantom "https://github.com/mghphysicsresearch/hedos/blob/main/input/phantom/ICRP89_compartment_model.xlsx"
click node_dvhs "https://github.com/mghphysicsresearch/hedos/tree/main/input/patient/DVHs"
click node_fieldrate "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/DoseRate.py"
click node_dvh_rate "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/DoseRate.py"
click node_accumulator "https://github.com/mghphysicsresearch/hedos/blob/main/simulation/CompartmentDose.py"
click node_visualization "https://github.com/mghphysicsresearch/hedos/blob/main/PlotDoseDistribution.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_entry,node_fields,node_dvhworkflow toneBlue
class node_model,node_chain,node_weibull,node_temporal toneAmber
class node_fieldrate,node_dvh_rate,node_accumulator,node_visualization toneMint
class node_patientdata,node_patientfiles,node_phantom,node_dvhs toneRose
class node_user toneIndigo
```

## Components

### Calculation workflows

- [Calculation setup](https://github.com/mghphysicsresearch/hedos/blob/main/examples/BloodDose.py): `examples/BloodDose.py`
- [Field workflow](https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromFields.py): `workflows/BloodDoseFromFields.py`
- [DVH workflow](https://github.com/mghphysicsresearch/hedos/blob/main/workflows/BloodDoseFromDVH.py): `workflows/BloodDoseFromDVH.py`

### Blood-flow simulation

- [Compartment model](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/FlowModel.py): `simulation/FlowModel.py`
- [Transit chains](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/Chains.py): `simulation/Chains.py`
- [Weibull timing](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/Weibull.py): `simulation/Weibull.py`
- [Particle trajectories](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/TemporalDistribution.py): `simulation/TemporalDistribution.py`

### Dose calculation

- [Field dose rate](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/DoseRate.py): `simulation/DoseRate.py`
- [DVH dose rate](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/DoseRate.py): `simulation/DoseRate.py`
- [Dose accumulation](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/CompartmentDose.py): `simulation/CompartmentDose.py`
- [Dose visualization](https://github.com/mghphysicsresearch/hedos/blob/main/PlotDoseDistribution.py): `PlotDoseDistribution.py`

### Patient data

- [Patient volumes](https://github.com/mghphysicsresearch/hedos/blob/main/simulation/LoadPatient.py): `simulation/LoadPatient.py`
- [Segmentations and affine](https://github.com/mghphysicsresearch/hedos/tree/main/input/patient): `input/patient`
- [Compartment workbook](https://github.com/mghphysicsresearch/hedos/blob/main/input/phantom/ICRP89_compartment_model.xlsx): `input/phantom/ICRP89_compartment_model.xlsx`
- [Organ DVHs](https://github.com/mghphysicsresearch/hedos/tree/main/input/patient/DVHs): `input/patient/DVHs`

### Other components

- **Researcher**

## Connections

- Researcher → Calculation setup: configures (evidence: `README.md`)
- Calculation setup → Field workflow: selects workflow (evidence: `README.md`)
- Calculation setup → DVH workflow: selects workflow (evidence: `README.md`)
- Field workflow → Patient volumes: loads patient (evidence: `workflows/BloodDoseFromFields.py`)
- Patient volumes → Segmentations and affine: reads volumes (evidence: `simulation/LoadPatient.py`)
- Field workflow → Compartment model: initializes (evidence: `workflows/BloodDoseFromFields.py`)
- DVH workflow → Compartment model: initializes (evidence: `workflows/BloodDoseFromDVH.py`)
- Field workflow → Compartment workbook: provides model file (evidence: `workflows/BloodDoseFromFields.py`)
- DVH workflow → Compartment workbook: provides model file (evidence: `workflows/BloodDoseFromDVH.py`)
- Compartment model → Transit chains: builds chain (evidence: `simulation/FlowModel.py`)
- Transit chains → Weibull timing: uses timing (evidence: `simulation/Chains.py`)
- Field workflow → Particle trajectories: generates trajectories (evidence: `workflows/BloodDoseFromFields.py`)
- DVH workflow → Particle trajectories: generates trajectories (evidence: `workflows/BloodDoseFromDVH.py`)
- Particle trajectories → Transit chains: walks chain (evidence: `simulation/TemporalDistribution.py`)
- Field workflow → Field dose rate: builds dose rate (evidence: `workflows/BloodDoseFromFields.py`)
- Field workflow → Dose accumulation: accumulates dose (evidence: `workflows/BloodDoseFromFields.py`)
- DVH workflow → DVH dose rate: loads DVH rates (evidence: `workflows/BloodDoseFromDVH.py`)
- DVH workflow → Organ DVHs: reads organ DVHs (evidence: `workflows/BloodDoseFromDVH.py`)
- DVH workflow → Dose accumulation: accumulates dose (evidence: `workflows/BloodDoseFromDVH.py`)
- Dose accumulation → Dose visualization: plots distribution (evidence: `workflows/BloodDoseFromFields.py`)
- DVH workflow → Dose visualization: plots distribution (evidence: `workflows/BloodDoseFromDVH.py`)
- Field dose rate → Patient volumes: reads dose fields (evidence: `simulation/DoseRate.py`)
- DVH dose rate → Organ DVHs: reads dose histograms
