# fdev31/thot architecture

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

- Interactive diagram: https://gitdiagram.com/fdev31/thot
- Repository: https://github.com/fdev31/thot

## Overview

Thotus is a Linux CLI for operating a laser-based 3D scanner. The user starts the interactive CLI, calibrates the camera/platform/lasers, captures rotating images, extracts laser lines, reconstructs a point cloud and saves a PLY model. The graph also preserves live viewing, manual segmentation and two-pass scanning capabilities documented in the README. Relationships are limited to shown calls, imports or README workflow statements; some unsampled implementation links are omitted.

Main entry points: [`src/thotus/commands.py`](https://github.com/fdev31/thot/blob/master/src/thotus/commands.py) (Scan commands), [`src/thotus/cloudify.py`](https://github.com/fdev31/thot/blob/master/src/thotus/cloudify.py) (Laser-line analysis), [`src/thotus/main.py`](https://github.com/fdev31/thot/blob/master/src/thotus/main.py) (CLI and live viewer), [`src/thotus/boards/__init__.py`](https://github.com/fdev31/thot/blob/master/src/thotus/boards/__init__.py) (Scanner controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["CLI control"]
  node_main["CLI and live viewer<br/>[main.py]"]
  node_commands["Scan commands<br/>[commands.py]"]
  node_shell["Shell command mode<br/>[shell_commands.py]"]
end

subgraph group_hardware["Scanner hardware"]
  node_scanner["Scanner controller<br/>[__init__.py]"]
  node_ciclop["Ciclop board<br/>[board.py]"]
  node_camera["V4L2 camera<br/>[v4l2.py]"]
  node_camera_profiles["Webcam controls"]
  node_image_saver["Capture image saver<br/>[workers.py]"]
end

subgraph group_calibration["Calibration"]
  node_calibration_flow["Calibration orchestration<br/>[__init__.py]"]
  node_camera_calibration["Camera calibration<br/>[camera.py]"]
  node_chessboard["Chessboard detection<br/>[chessboard.py]"]
  node_platform_calibration["Platform calibration<br/>[platform.py]"]
  node_laser_calibration["Laser calibration<br/>[lasers.py]"]
  node_calibration_data["Calibration data<br/>[data.py]"]
end

subgraph group_reconstruction["Reconstruction"]
  node_cloudify["Laser-line analysis<br/>[cloudify.py]"]
  node_segmentation["Segmentation algorithms"]
  node_ransac["Line fitting<br/>[ransac.py]"]
  node_projection["Point-cloud projection<br/>[projection.py]"]
  node_mesh["Mesh assembly<br/>[__init__.py]"]
  node_mesh_model["Mesh model<br/>[model.py]"]
  node_ply["PLY export<br/>[ply.py]"]
end

subgraph group_support["Runtime support"]
  node_settings[("Configuration and persistence<br/>[settings.py]")]
  node_image_tools["Image processing tools<br/>[tools.py]"]
  node_ui["Display and feedback<br/>[ui.py]"]
end

node_user(("Scanner operator"))

node_user -->|"starts"| node_main
node_main -->|"loads commands"| node_shell
node_main -->|"dispatches"| node_commands
node_main -->|"live analysis"| node_cloudify
node_main -->|"displays frames"| node_ui
node_commands -->|"gets scanner"| node_scanner
node_commands -->|"analyzes captures"| node_cloudify
node_commands -->|"assembles mesh"| node_mesh
node_commands -->|"runs calibration"| node_calibration_flow
node_commands -->|"loads calibration"| node_calibration_data
node_scanner -->|"selects board"| node_ciclop
node_scanner -->|"creates capture"| node_camera
node_scanner -->|"selects controls"| node_camera_profiles
node_scanner -->|"queues images"| node_image_saver
node_calibration_flow -->|"runs camera fit"| node_camera_calibration
node_calibration_flow -->|"runs platform fit"| node_platform_calibration
node_calibration_flow -->|"runs laser fit"| node_laser_calibration
node_camera_calibration -->|"detects corners"| node_chessboard
node_camera_calibration -->|"loads images"| node_image_tools
node_camera_calibration -->|"reads and saves"| node_settings
node_platform_calibration -->|"uses geometry"| node_projection
node_laser_calibration -->|"analyzes laser lines"| node_cloudify
node_cloudify -->|"loads captures"| node_image_tools
node_cloudify -->|"reports progress"| node_ui
node_cloudify -->|"loads selected algorithm"| node_segmentation
node_segmentation -->|"fits detected lines"| node_ransac
node_mesh -->|"projects points"| node_projection
node_mesh -->|"builds model"| node_mesh_model
node_mesh -->|"saves scene"| node_ply
node_calibration_flow -->|"uses calibration"| node_calibration_data
node_settings -->|"persists values"| node_calibration_data

click node_main "https://github.com/fdev31/thot/blob/master/src/thotus/main.py"
click node_commands "https://github.com/fdev31/thot/blob/master/src/thotus/commands.py"
click node_shell "https://github.com/fdev31/thot/blob/master/src/thotus/shell_commands.py"
click node_scanner "https://github.com/fdev31/thot/blob/master/src/thotus/boards/__init__.py"
click node_ciclop "https://github.com/fdev31/thot/blob/master/src/thotus/boards/ciclop/board.py"
click node_camera "https://github.com/fdev31/thot/blob/master/src/thotus/camera/v4l2.py"
click node_camera_profiles "https://github.com/fdev31/thot/tree/master/src/thotus/webcams"
click node_image_saver "https://github.com/fdev31/thot/blob/master/src/thotus/image/workers.py"
click node_calibration_flow "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/__init__.py"
click node_camera_calibration "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/camera.py"
click node_chessboard "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/chessboard.py"
click node_platform_calibration "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/platform.py"
click node_laser_calibration "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/lasers.py"
click node_calibration_data "https://github.com/fdev31/thot/blob/master/src/thotus/calibration/data.py"
click node_cloudify "https://github.com/fdev31/thot/blob/master/src/thotus/cloudify.py"
click node_segmentation "https://github.com/fdev31/thot/tree/master/src/thotus/algorithms"
click node_ransac "https://github.com/fdev31/thot/blob/master/src/thotus/algorithms/ransac.py"
click node_projection "https://github.com/fdev31/thot/blob/master/src/thotus/algorithms/projection.py"
click node_mesh "https://github.com/fdev31/thot/blob/master/src/thotus/mesh/__init__.py"
click node_mesh_model "https://github.com/fdev31/thot/blob/master/src/thotus/mesh/model.py"
click node_ply "https://github.com/fdev31/thot/blob/master/src/thotus/mesh/ply.py"
click node_settings "https://github.com/fdev31/thot/blob/master/src/thotus/settings.py"
click node_image_tools "https://github.com/fdev31/thot/blob/master/src/thotus/image/tools.py"
click node_ui "https://github.com/fdev31/thot/blob/master/src/thotus/ui.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_main,node_commands,node_shell toneBlue
class node_scanner,node_ciclop,node_camera,node_camera_profiles,node_image_saver toneAmber
class node_calibration_flow,node_camera_calibration,node_chessboard,node_platform_calibration,node_laser_calibration,node_calibration_data toneMint
class node_cloudify,node_segmentation,node_ransac,node_projection,node_mesh,node_mesh_model,node_ply toneRose
class node_settings,node_image_tools,node_ui,node_user toneIndigo
```

## Components

### CLI control

- [CLI and live viewer](https://github.com/fdev31/thot/blob/master/src/thotus/main.py): `src/thotus/main.py`
- [Scan commands](https://github.com/fdev31/thot/blob/master/src/thotus/commands.py): `src/thotus/commands.py`
- [Shell command mode](https://github.com/fdev31/thot/blob/master/src/thotus/shell_commands.py): `src/thotus/shell_commands.py`

### Scanner hardware

- [Scanner controller](https://github.com/fdev31/thot/blob/master/src/thotus/boards/__init__.py): `src/thotus/boards/__init__.py`
- [Ciclop board](https://github.com/fdev31/thot/blob/master/src/thotus/boards/ciclop/board.py): `src/thotus/boards/ciclop/board.py`
- [V4L2 camera](https://github.com/fdev31/thot/blob/master/src/thotus/camera/v4l2.py): `src/thotus/camera/v4l2.py`
- [Webcam controls](https://github.com/fdev31/thot/tree/master/src/thotus/webcams): `src/thotus/webcams`
- [Capture image saver](https://github.com/fdev31/thot/blob/master/src/thotus/image/workers.py): `src/thotus/image/workers.py`

### Calibration

- [Calibration orchestration](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/__init__.py): `src/thotus/calibration/__init__.py`
- [Camera calibration](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/camera.py): `src/thotus/calibration/camera.py`
- [Chessboard detection](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/chessboard.py): `src/thotus/calibration/chessboard.py`
- [Platform calibration](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/platform.py): `src/thotus/calibration/platform.py`
- [Laser calibration](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/lasers.py): `src/thotus/calibration/lasers.py`
- [Calibration data](https://github.com/fdev31/thot/blob/master/src/thotus/calibration/data.py): `src/thotus/calibration/data.py`

### Reconstruction

- [Laser-line analysis](https://github.com/fdev31/thot/blob/master/src/thotus/cloudify.py): `src/thotus/cloudify.py`
- [Segmentation algorithms](https://github.com/fdev31/thot/tree/master/src/thotus/algorithms): `src/thotus/algorithms`
- [Line fitting](https://github.com/fdev31/thot/blob/master/src/thotus/algorithms/ransac.py): `src/thotus/algorithms/ransac.py`
- [Point-cloud projection](https://github.com/fdev31/thot/blob/master/src/thotus/algorithms/projection.py): `src/thotus/algorithms/projection.py`
- [Mesh assembly](https://github.com/fdev31/thot/blob/master/src/thotus/mesh/__init__.py): `src/thotus/mesh/__init__.py`
- [Mesh model](https://github.com/fdev31/thot/blob/master/src/thotus/mesh/model.py): `src/thotus/mesh/model.py`
- [PLY export](https://github.com/fdev31/thot/blob/master/src/thotus/mesh/ply.py): `src/thotus/mesh/ply.py`

### Runtime support

- [Configuration and persistence](https://github.com/fdev31/thot/blob/master/src/thotus/settings.py): `src/thotus/settings.py`
- [Image processing tools](https://github.com/fdev31/thot/blob/master/src/thotus/image/tools.py): `src/thotus/image/tools.py`
- [Display and feedback](https://github.com/fdev31/thot/blob/master/src/thotus/ui.py): `src/thotus/ui.py`

### Other components

- **Scanner operator**

## Connections

- Scanner operator → CLI and live viewer: starts
- CLI and live viewer → Shell command mode: loads commands (evidence: `src/thotus/main.py`)
- CLI and live viewer → Scan commands: dispatches (evidence: `src/thotus/main.py`)
- CLI and live viewer → Laser-line analysis: live analysis (evidence: `src/thotus/main.py`)
- CLI and live viewer → Display and feedback: displays frames (evidence: `src/thotus/main.py`)
- Scan commands → Scanner controller: gets scanner (evidence: `src/thotus/commands.py`)
- Scan commands → Laser-line analysis: analyzes captures (evidence: `src/thotus/commands.py`)
- Scan commands → Mesh assembly: assembles mesh (evidence: `src/thotus/commands.py`)
- Scan commands → Calibration orchestration: runs calibration (evidence: `src/thotus/commands.py`)
- Scan commands → Calibration data: loads calibration (evidence: `src/thotus/commands.py`)
- Scanner controller → Ciclop board: selects board (evidence: `src/thotus/boards/__init__.py`)
- Scanner controller → V4L2 camera: creates capture (evidence: `src/thotus/boards/__init__.py`)
- Scanner controller → Webcam controls: selects controls (evidence: `src/thotus/boards/__init__.py`)
- Scanner controller → Capture image saver: queues images (evidence: `src/thotus/boards/__init__.py`)
- Calibration orchestration → Camera calibration: runs camera fit (evidence: `src/thotus/calibration/__init__.py`)
- Calibration orchestration → Platform calibration: runs platform fit (evidence: `src/thotus/calibration/__init__.py`)
- Calibration orchestration → Laser calibration: runs laser fit (evidence: `src/thotus/calibration/__init__.py`)
- Camera calibration → Chessboard detection: detects corners (evidence: `src/thotus/calibration/camera.py`)
- Camera calibration → Image processing tools: loads images (evidence: `src/thotus/calibration/camera.py`)
- Camera calibration → Configuration and persistence: reads and saves (evidence: `src/thotus/calibration/camera.py`)
- Platform calibration → Point-cloud projection: uses geometry (evidence: `src/thotus/calibration/platform.py`)
- Laser calibration → Laser-line analysis: analyzes laser lines (evidence: `src/thotus/calibration/lasers.py`)
- Laser-line analysis → Image processing tools: loads captures (evidence: `src/thotus/cloudify.py`)
- Laser-line analysis → Display and feedback: reports progress (evidence: `src/thotus/cloudify.py`)
- Laser-line analysis → Segmentation algorithms: loads selected algorithm
- Segmentation algorithms → Line fitting: fits detected lines (evidence: `src/thotus/algorithms/algo_pureimage.py`)
- Mesh assembly → Point-cloud projection: projects points (evidence: `src/thotus/mesh/__init__.py`)
- Mesh assembly → Mesh model: builds model (evidence: `src/thotus/mesh/__init__.py`)
- Mesh assembly → PLY export: saves scene (evidence: `src/thotus/mesh/__init__.py`)
- Calibration orchestration → Calibration data: uses calibration (evidence: `src/thotus/calibration/__init__.py`)
- Configuration and persistence → Calibration data: persists values (evidence: `src/thotus/settings.py`)
