# brawzzz/psyn architecture

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

- Interactive diagram: https://gitdiagram.com/brawzzz/psyn
- Repository: https://github.com/brawzzz/psyn

## Overview

PSYN analyzes composite-material images to delineate regions of similarly oriented fibres. The documented runtime workflow loads a configured sample, processes it, groups regions by orientation, computes shapes, and saves and renders results. The graph preserves the fibre, region, shape, tiling, and configuration responsibilities visible in the supplied excerpts. Some internal Sample processing is omitted, so uncertain links are left unverified rather than presented as confirmed calls.

Main entry points: [`src/Sample.py`](https://github.com/brawzzz/psyn/blob/main/src/Sample.py) (Sample workflow), [`src/main.py`](https://github.com/brawzzz/psyn/blob/main/src/main.py) (Run analysis), [`src/Region.py`](https://github.com/brawzzz/psyn/blob/main/src/Region.py) (Orientation regions), [`src/Fiber.py`](https://github.com/brawzzz/psyn/blob/main/src/Fiber.py) (Fibre detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflow"]
  node_entry["Run analysis<br/>[main.py]"]
  node_sample["Sample workflow<br/>[Sample.py]"]
end

subgraph group_vision["Image analysis"]
  node_splits["Image splits<br/>[Split.py]"]
  node_fibers["Fibre detection<br/>[Fiber.py]"]
  node_regions["Orientation regions<br/>[Region.py]"]
end

subgraph group_output["Geometry and output"]
  node_shapes["Region shapes<br/>[Shape.py]"]
  node_render_tools["Image utilities<br/>[tools.py]"]
  node_data_tools["Data and ROI tools<br/>[data.py]"]
end

subgraph group_config["Configuration"]
  node_config_file["Analysis config<br/>[config.json]"]
  node_parameters["Runtime parameters<br/>[setup.py]"]
end

node_user(("Analyst"))
node_images["Sample images"]

node_user -->|"starts"| node_entry
node_images -.->|"provides images"| node_sample
node_config_file -->|"configures run"| node_entry
node_entry -->|"initializes sample"| node_sample
node_entry -->|"processes sample"| node_sample
node_entry -->|"groups regions"| node_sample
node_entry -->|"computes shapes"| node_sample
node_entry -->|"saves and renders"| node_sample
node_sample -->|"merges regions"| node_regions
node_regions -->|"uses fibre data"| node_fibers
node_sample -.->|"uses image tiles"| node_splits
node_sample -.->|"detects fibres"| node_fibers
node_sample -.->|"builds shapes"| node_shapes
node_sample -.->|"uses image utilities"| node_render_tools
node_entry -->|"selects render mode"| node_parameters
node_data_tools -->|"loads sample and ROIs"| node_sample

click node_config_file "https://github.com/brawzzz/psyn/blob/main/config/config.json"
click node_entry "https://github.com/brawzzz/psyn/blob/main/src/main.py"
click node_sample "https://github.com/brawzzz/psyn/blob/main/src/Sample.py"
click node_splits "https://github.com/brawzzz/psyn/blob/main/src/Split.py"
click node_fibers "https://github.com/brawzzz/psyn/blob/main/src/Fiber.py"
click node_regions "https://github.com/brawzzz/psyn/blob/main/src/Region.py"
click node_shapes "https://github.com/brawzzz/psyn/blob/main/src/Shape.py"
click node_render_tools "https://github.com/brawzzz/psyn/blob/main/src/tools.py"
click node_parameters "https://github.com/brawzzz/psyn/blob/main/src/setup.py"
click node_data_tools "https://github.com/brawzzz/psyn/blob/main/src/data.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_sample toneBlue
class node_splits,node_fibers,node_regions toneAmber
class node_shapes,node_render_tools,node_data_tools toneMint
class node_config_file,node_parameters toneRose
class node_user,node_images toneIndigo
```

## Components

### Analysis workflow

- [Run analysis](https://github.com/brawzzz/psyn/blob/main/src/main.py): `src/main.py`
- [Sample workflow](https://github.com/brawzzz/psyn/blob/main/src/Sample.py): `src/Sample.py`

### Image analysis

- [Image splits](https://github.com/brawzzz/psyn/blob/main/src/Split.py): `src/Split.py`
- [Fibre detection](https://github.com/brawzzz/psyn/blob/main/src/Fiber.py): `src/Fiber.py`
- [Orientation regions](https://github.com/brawzzz/psyn/blob/main/src/Region.py): `src/Region.py`

### Geometry and output

- [Region shapes](https://github.com/brawzzz/psyn/blob/main/src/Shape.py): `src/Shape.py`
- [Image utilities](https://github.com/brawzzz/psyn/blob/main/src/tools.py): `src/tools.py`
- [Data and ROI tools](https://github.com/brawzzz/psyn/blob/main/src/data.py): `src/data.py`

### Configuration

- [Analysis config](https://github.com/brawzzz/psyn/blob/main/config/config.json): `config/config.json`
- [Runtime parameters](https://github.com/brawzzz/psyn/blob/main/src/setup.py): `src/setup.py`

### Other components

- **Analyst**
- **Sample images**

## Connections

- Analyst → Run analysis: starts (evidence: `ReadMe.md`)
- Sample images → Sample workflow: provides images (evidence: `ReadMe.md`)
- Analysis config → Run analysis: configures run (evidence: `ReadMe.md`)
- Run analysis → Sample workflow: initializes sample (evidence: `src/main.py`)
- Run analysis → Sample workflow: processes sample (evidence: `src/main.py`)
- Run analysis → Sample workflow: groups regions (evidence: `src/main.py`)
- Run analysis → Sample workflow: computes shapes (evidence: `src/main.py`)
- Run analysis → Sample workflow: saves and renders (evidence: `src/main.py`)
- Sample workflow → Orientation regions: merges regions (evidence: `src/Sample.py`)
- Orientation regions → Fibre detection: uses fibre data (evidence: `src/Region.py`)
- Sample workflow → Image splits: uses image tiles (evidence: `src/Sample.py`)
- Sample workflow → Fibre detection: detects fibres (evidence: `src/Sample.py`)
- Sample workflow → Region shapes: builds shapes (evidence: `src/Sample.py`)
- Sample workflow → Image utilities: uses image utilities (evidence: `src/Sample.py`)
- Run analysis → Runtime parameters: selects render mode (evidence: `src/main.py`)
- Data and ROI tools → Sample workflow: loads sample and ROIs (evidence: `src/data.py`)
