# openoct/octsharp architecture

> Architecture diagram of the GitHub repository openoct/octsharp, 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/openoct/octsharp
- Repository: https://github.com/openoct/octsharp

## Overview

OCTSharp is a Windows application for interactive, high-throughput OCT acquisition and imaging. Users configure camera, scan, and processing parameters in the GUI; the application acquires camera frames, coordinates scanner output, processes scans with CUDA, and presents B-scan/en-face imagery and performance data. It can also save raw scan data for later processing. The README documents dedicated GUI, transfer, processing, and display threads. The sampled source confirms the GUI, acquisition setup, processing, CUDA operations, and raw saving; finer thread wiring and some documented capabilities are not visible in the excerpts.

Main entry points: [`MainDlg.cs`](https://github.com/openoct/octsharp/blob/main/MainDlg.cs) (Imaging GUI), [`ProcessClass.cs`](https://github.com/openoct/octsharp/blob/main/ProcessClass.cs) (OCT processing), [`OCTSharp.cs`](https://github.com/openoct/octsharp/blob/main/OCTSharp.cs) (Application startup), [`MainDlg.Designer.cs`](https://github.com/openoct/octsharp/blob/main/MainDlg.Designer.cs) (GUI layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Acquisition and control"]
  node_app["Application startup<br/>[OCTSharp.cs]"]
  node_gui["Imaging GUI<br/>[MainDlg.cs]"]
  node_ui["GUI layout"]
  node_camera_config["Camera profiles"]
  node_acquisition["Camera acquisition<br/>[MainDlg.cs]"]
  node_transfer["Frame transfer<br/>[MainDlg.cs]"]
  node_scanner["Scanner control<br/>[MainDlg.cs]"]
end

subgraph group_compute["Image processing"]
  node_processor["OCT processing<br/>[ProcessClass.cs]"]
  node_cuda_kernels["CUDA kernels<br/>[kernel.cu]"]
end

subgraph group_view["Visualization and data"]
  node_display["Image display<br/>[MainDlg.cs]"]
  node_charts["Signal charts<br/>[MainDlg.cs]"]
  node_raw_files["Raw scan files"]
end

node_user(("Research user"))
node_frame_grabber["Frame grabber"]
node_daq["NI DAQ hardware"]
node_gpu["CUDA GPU"]

node_user -->|"sets parameters"| node_gui
node_app -->|"opens"| node_gui
node_ui -->|"defines controls"| node_gui
node_gui -->|"configures capture"| node_acquisition
node_camera_config -->|"configures camera"| node_acquisition
node_frame_grabber -->|"provides frames"| node_acquisition
node_gui -->|"configures scan"| node_scanner
node_scanner -->|"writes voltages"| node_daq
node_acquisition -->|"signals frames"| node_transfer
node_transfer -->|"passes frame buffer"| node_processor
node_gui -->|"starts processing"| node_processor
node_processor -->|"invokes kernels"| node_cuda_kernels
node_processor -->|"runs CUDA work"| node_gpu
node_processor -->|"returns image data"| node_display
node_gui -->|"updates views"| node_display
node_gui -->|"plots metrics"| node_charts
node_transfer -->|"saves raw scans"| node_raw_files

click node_app "https://github.com/openoct/octsharp/blob/main/OCTSharp.cs"
click node_gui "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"
click node_ui "https://github.com/openoct/octsharp/blob/main/MainDlg.Designer.cs"
click node_camera_config "https://github.com/openoct/octsharp/tree/main/Camera%20Files"
click node_acquisition "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"
click node_transfer "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"
click node_scanner "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"
click node_processor "https://github.com/openoct/octsharp/blob/main/ProcessClass.cs"
click node_cuda_kernels "https://github.com/openoct/octsharp/blob/main/CudaKernels.cu/kernel.cu"
click node_display "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"
click node_charts "https://github.com/openoct/octsharp/blob/main/MainDlg.cs"

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_app,node_gui,node_ui,node_camera_config,node_acquisition,node_transfer,node_scanner,node_user toneBlue
class node_processor,node_cuda_kernels toneAmber
class node_display,node_charts,node_raw_files toneMint
class node_frame_grabber,node_daq,node_gpu toneIndigo
```

## Components

### Acquisition and control

- [Application startup](https://github.com/openoct/octsharp/blob/main/OCTSharp.cs): `OCTSharp.cs`
- [Imaging GUI](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`
- [GUI layout](https://github.com/openoct/octsharp/blob/main/MainDlg.Designer.cs): `MainDlg.Designer.cs`
- [Camera profiles](https://github.com/openoct/octsharp/tree/main/Camera%20Files): `Camera Files`
- [Camera acquisition](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`
- [Frame transfer](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`
- [Scanner control](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`

### Image processing

- [OCT processing](https://github.com/openoct/octsharp/blob/main/ProcessClass.cs): `ProcessClass.cs`
- [CUDA kernels](https://github.com/openoct/octsharp/blob/main/CudaKernels.cu/kernel.cu): `CudaKernels.cu/kernel.cu`

### Visualization and data

- [Image display](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`
- [Signal charts](https://github.com/openoct/octsharp/blob/main/MainDlg.cs): `MainDlg.cs`
- **Raw scan files**

### Other components

- **Research user**
- **Frame grabber**
- **NI DAQ hardware**
- **CUDA GPU**

## Connections

- Research user → Imaging GUI: sets parameters
- Application startup → Imaging GUI: opens
- GUI layout → Imaging GUI: defines controls
- Imaging GUI → Camera acquisition: configures capture
- Camera profiles → Camera acquisition: configures camera
- Frame grabber → Camera acquisition: provides frames
- Imaging GUI → Scanner control: configures scan
- Scanner control → NI DAQ hardware: writes voltages
- Camera acquisition → Frame transfer: signals frames
- Frame transfer → OCT processing: passes frame buffer
- Imaging GUI → OCT processing: starts processing
- OCT processing → CUDA kernels: invokes kernels
- OCT processing → CUDA GPU: runs CUDA work
- OCT processing → Image display: returns image data
- Imaging GUI → Image display: updates views
- Imaging GUI → Signal charts: plots metrics
- Frame transfer → Raw scan files: saves raw scans
