# sampsapursiainen/zeffiro_interface architecture

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

- Interactive diagram: https://gitdiagram.com/sampsapursiainen/zeffiro_interface
- Repository: https://github.com/sampsapursiainen/zeffiro_interface

## Overview

Zeffiro Interface is a MATLAB application for finite-element forward and inverse simulations in complex geometries. Its documented research workflow takes anatomical segmentations into a volumetric mesh, constructs a lead field for forward simulation, and uses inverse methods to reconstruct activity from measurements; results can then be explored through the interface. The tree also shows import utilities, specialized inversion plugins, and external anatomy-tool integrations. The README documents the high-level workflow and capabilities, but no source excerpts were supplied, so detailed call ownership and wiring between individual modules cannot be verified.

Main entry points: [`m/inverse`](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/inverse) (Reconstruction), [`m/forward_simulation/lead_field`](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/forward_simulation/lead_field) (Lead field), [`m/mesh`](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/mesh) (FE mesh), [`plugins`](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/plugins) (Inversion plugins)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Anatomy and model"]
  node_project["Source model"]
  node_mesh["FE mesh"]
end

subgraph group_simulation["Forward simulation"]
  node_leadfield["Lead field"]
  node_forward["Forward simulation"]
end

subgraph group_inverse["Inverse analysis"]
  node_inverse_methods["Inverse methods"]
  node_plugins["Inversion plugins"]
  node_reconstruction["Reconstruction"]
  node_preconditioners["Preconditioners"]
end

subgraph group_interface["Interface and results"]
  node_gui["User interface"]
  node_visualization["Visualization"]
end

subgraph group_integrations["Import integrations"]
  node_import["Data import"]
  node_brainstorm["Brainstorm converter"]
  node_freesurfer["FreeSurfer converter"]
  node_simnibs["SimNIBS converter"]
  node_duneuro["DUNEuro converter"]
end

node_researcher(("Researcher"))
node_anatomy["Anatomy data"]
node_measurements["Measurement data"]
node_external_solvers["Solver libraries"]

node_researcher -->|"uses"| node_gui
node_anatomy -->|"imports"| node_import
node_import -->|"loads anatomy"| node_project
node_brainstorm -.->|"converts data"| node_project
node_freesurfer -.->|"converts data"| node_project
node_simnibs -.->|"converts data"| node_project
node_duneuro -.->|"converts data"| node_project
node_project -->|"builds mesh"| node_mesh
node_mesh -->|"defines geometry"| node_leadfield
node_leadfield -->|"supports simulation"| node_forward
node_measurements -->|"input data"| node_reconstruction
node_leadfield -->|"forward model"| node_reconstruction
node_inverse_methods -->|"computes estimates"| node_reconstruction
node_plugins -->|"provides methods"| node_reconstruction
node_preconditioners -->|"accelerates solving"| node_inverse_methods
node_external_solvers -.->|"optional solvers"| node_plugins
node_reconstruction -->|"displays results"| node_visualization
node_gui -->|"presents results"| node_visualization

click node_import "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/import"
click node_mesh "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/mesh"
click node_leadfield "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/forward_simulation/lead_field"
click node_forward "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/forward_simulation"
click node_plugins "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/plugins"
click node_reconstruction "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/inverse"
click node_visualization "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/visualization"
click node_external_solvers "https://github.com/sampsapursiainen/zeffiro_interface/tree/master/external"

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_project,node_mesh toneBlue
class node_leadfield,node_forward toneAmber
class node_inverse_methods,node_plugins,node_reconstruction,node_preconditioners toneMint
class node_gui,node_visualization toneRose
class node_import,node_brainstorm,node_freesurfer,node_simnibs,node_duneuro,node_researcher,node_anatomy,node_measurements toneIndigo
class node_external_solvers toneTeal
```

## Components

### Anatomy and model

- **Source model**
- [FE mesh](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/mesh): `m/mesh`

### Forward simulation

- [Lead field](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/forward_simulation/lead_field): `m/forward_simulation/lead_field`
- [Forward simulation](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/forward_simulation): `m/forward_simulation`

### Inverse analysis

- **Inverse methods**
- [Inversion plugins](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/plugins): `plugins`
- [Reconstruction](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/inverse): `m/inverse`
- **Preconditioners**

### Interface and results

- **User interface**
- [Visualization](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/visualization): `m/visualization`

### Import integrations

- [Data import](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/m/import): `m/import`
- **Brainstorm converter**
- **FreeSurfer converter**
- **SimNIBS converter**
- **DUNEuro converter**

### Other components

- **Researcher**
- **Anatomy data**
- **Measurement data**
- [Solver libraries](https://github.com/sampsapursiainen/zeffiro_interface/tree/master/external): `external`

## Connections

- Researcher → User interface: uses
- Anatomy data → Data import: imports
- Data import → Source model: loads anatomy
- Brainstorm converter → Source model: converts data
- FreeSurfer converter → Source model: converts data
- SimNIBS converter → Source model: converts data
- DUNEuro converter → Source model: converts data
- Source model → FE mesh: builds mesh
- FE mesh → Lead field: defines geometry
- Lead field → Forward simulation: supports simulation
- Measurement data → Reconstruction: input data
- Lead field → Reconstruction: forward model
- Inverse methods → Reconstruction: computes estimates
- Inversion plugins → Reconstruction: provides methods
- Preconditioners → Inverse methods: accelerates solving
- Solver libraries → Inversion plugins: optional solvers
- Reconstruction → Visualization: displays results
- User interface → Visualization: presents results
