# kugamaxx/cuke-emlb architecture

> Architecture diagram of the GitHub repository kugamaxx/cuke-emlb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kugamaxx/cuke-emlb
- Repository: https://github.com/kugamaxx/cuke-emlb

## Overview

##### Main Components
- Python Bindings: The “python” directory (with its own CMakeLists.txt and “src”) compiles the core C++ algorithms into Python packages using pybind11. This allows users to run demos (e.g., demo.py, eval_denoisor.py) directly from Python.
- Configuration & Datasets: The “configs” directory contains configuration files (e.g., denoisors.py, datasets.py) that define parameters and settings for the denoising algorithms. The “data” folder provides sample event data (aedat4 files) and is structured to support benchmark evaluation.
- Evaluation Scripts: Files like “demo.py”, “eval_benchmark.py”, and “eval_denoisor.py” serve as entry points for testing, benchmarking, or running a single algorithm.
- DV Modules: Under “modules” there are folders intended to create shared libraries (.so files) that can be integrated with external DV software. This builds additional integration points depending on whether the project is compiled with “-DEMLB_ENABLE_MODULES”.
- External Dependencies: The “external” directory (and the use of submodules such as dv-toolkit) indicates reliance on third-party libraries for handling event-based data and possibly pre-/post-processing support.

##### Relationships and Interactions
- Data Flow: A typical workflow starts with raw event-based camera data (AEDAT4 files) stored in “data”. The evaluation scripts read these inputs and pass them to the denoising algorithms.
- Processing Layer: The central C++ processing layer contains the implementations of the various denoising techniques. Configuration parameters defined in “configs” are used to adjust algorithm behavior.
- Binding & Integration: Python wrappers in the “python” subdirectory expose the C++ algorithms, allowing the demo and evaluation scripts written in Python to invoke them. Likewise, the DV-specific modules under “modules” provide another integration interface.
- Build & Dependency Setup: The project uses CMake (CMakeLists.txt at different levels) to manage builds. Options such as “-DEMLB_ENABLE_PYTHON” and “-DEMLB_ENABLE_MODULES” let you compile either the Python bindings or the DV software modules respectively.
- External Services: Dependencies like OpenCV, Boost, Eigen, and the dv-toolkit are prerequisites. They are not only built as part of the environment but also indicate external integration points.

##### Architectural Patterns and Design Principles
- Modularity: Individual denoising algorithms are encapsulated in their respective modules (directory “denoisors”) enabling easy swapping and extension.
- Interoperability: With both C++ and Python interfaces and specific builds for DV integration, the design emphasizes interoperability across different environments and usage scenarios.

##### Including Technologies and Frameworks
- Languages: C++ (for performance-critical denoising algorithms) and Python (for ease of use in benchmarking and demo scripts).
- Build System: CMake to orchestrate the compilation process.
- Pybind11: For creating Python bindings to the C++ library.
- External Libraries: Boost, OpenCV, Eigen, OpenBLAS, and libtorch (for CUDA support) are key libraries used.

##### Specific Elements
- Blocks/Components with clear labels:
– Data Source: “Data (AEDAT4 files)” from the “data” folder.
– Configuration: “Configs (denoisors.py, datasets.py)”
– Core Denoising Engine: Represented by the “src” and “include/denoisors” components.
– Python Bindings: “python” layer that wraps the C++ engine.
– DV Modules: “modules” that produce shared libraries for DV software integration.
– Evaluation Scripts: “demo.py”, “eval_benchmark.py”, “eval_denoisor.py”.
– External Dependencies: Libraries and the “external/dv-toolkit”.
- Relationships:

##### Final Touches
- Every component is clearly labeled and that interactions (like data input, configuration, and build flows) are easy to follow.
- Architectural decisions, such as the use of pybind11 for Python bindings, and the dual build mode (script usage versus DV module compilation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input Layer"
        I1["Data (AEDAT4 files)"]:::input
        I2["Sample Data"]:::input
        I3["Configuration Files (denoisors.py, datasets.py)"]:::config
    end

    subgraph "Evaluation Layer"
        E1["Evaluation Scripts (demo.py, eval_benchmark.py, eval_denoisor.py)"]:::evaluation
    end

    subgraph "Processing Layer"
        subgraph "Core Denoising Engine"
            C1["Core Source"]:::core
            C2["Core Headers"]:::core
        end
        subgraph "Python Bindings"
            P1["Python Package"]:::python
            P2["Binding Source"]:::python
            P3["Python Utils"]:::python
            P4["Pybind Utilities"]:::python
        end
        DVM["DV Modules"]:::dv
    end

    subgraph "Infrastructure"
        INF1["External Dependencies"]:::external
        INF2["Build System (CMake)"]:::build
    end

    I1 -->|"provides"| E1
    I2 -->|"provides"| E1
    I3 -->|"configures"| E1

    E1 -->|"invokes"| P1
    E1 -->|"invokes"| C1

    P1 -->|"wraps"| C1
    I3 -->|"configures"| C1

    DVM -->|"integrates"| C1

    INF1 -->|"supports"| C1
    INF1 -->|"supports"| DVM

    INF2 -->|"builds"| C1
    INF2 -->|"builds"| P1
    INF2 -->|"builds"| DVM

    click C1 "https://github.com/kugamaxx/cuke-emlb/tree/main/src/denoisors"
    click C2 "https://github.com/kugamaxx/cuke-emlb/tree/main/include/denoisors"
    click P1 "https://github.com/kugamaxx/cuke-emlb/tree/main/python"
    click P2 "https://github.com/kugamaxx/cuke-emlb/tree/main/python/src/denoisors"
    click P3 "https://github.com/kugamaxx/cuke-emlb/tree/main/python/src/utils"
    click P4 "https://github.com/kugamaxx/cuke-emlb/blob/main/python/src/pybind_utils.hpp"
    click I3 "https://github.com/kugamaxx/cuke-emlb/tree/main/configs"
    click I2 "https://github.com/kugamaxx/cuke-emlb/tree/main/data/demo/samples"
    click E1 "https://github.com/kugamaxx/cuke-emlb/blob/main/demo.py"
    click DVM "https://github.com/kugamaxx/cuke-emlb/tree/main/modules"
    click INF1 "https://github.com/kugamaxx/cuke-emlb/tree/main/external/dv-toolkit"
    click INF2 "https://github.com/kugamaxx/cuke-emlb/blob/main/python/CMakeLists.txt"

    classDef input fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef config fill:#FFD580,stroke:#333,stroke-width:2px;
    classDef evaluation fill:#D2B4DE,stroke:#333,stroke-width:2px;
    classDef core fill:#85C1E9,stroke:#333,stroke-width:2px;
    classDef python fill:#82E0AA,stroke:#333,stroke-width:2px;
    classDef dv fill:#F5B041,stroke:#333,stroke-width:2px;
    classDef external fill:#F1948A,stroke:#333,stroke-width:2px;
    classDef build fill:#D5DBDB,stroke:#333,stroke-width:2px;
```
