# oskarowski/imagio-image-processing-app architecture

> Architecture diagram of the GitHub repository oskarowski/imagio-image-processing-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oskarowski/imagio-image-processing-app
- Repository: https://github.com/oskarowski/imagio-image-processing-app

## Overview

##### Project type and purpose
- This is a Go-based, monolithic image-processing application with two user interfaces:
- A CLI front-end (cmd/cli_app.go + cmd/executioner)
- A TUI front-end (cmd/tui + internal/ascii_preview)
- Core business logic resides in package directories: manipulations, morphological, noise, orthogonal_transforms, analysis, imageio, reporting.

##### File structure
- Top-level UIs:
- cmd/cli_app.go + cmd/executioner/* → CLI command definitions & handlers
- cmd/tui/* + internal/ascii_preview → TUI screens, helper renderers, input forms
- Core engine packages:
- imageio → BMP file read/write
- manipulations → pixel-level operations (brightness, contrast, geometric…)
- morphological → dilation, erosion, thinning, region growing
- noise → synthetic noise generators/filters
- orthogonal_transforms → Fourier, bandpass, mask filters
- analysis → histogram, comparison metrics
- reporting → execution reports, performance metrics
- Assets & configuration:
- assets/cli, assets/tui → example images, TUI sprites
- masks.json, structure_elements.json → filter configurations

##### README
- Confirms dual‐mode operation (CLI vs TUI)
- Lists all commands and parameters
- No external services or databases—purely file-based I/O

##### Main components & interactions
a. Front-ends (CLI, TUI)
b. Command Dispatcher/Executioner
c. Core Processing Engine (sub-modules for manipulations, morphological, noise, transforms, analysis)
d. Image IO (read/write BMP)
e. Reporting (command metrics, durations)
f. Configuration/data stores (masks.json, structure_elements.json, built-in assets)
g. File System (imgs/, output files)

##### Architectural pattern
- Layered architecture with clear separation:
UI layer → Dispatcher layer → Business logic layer → IO layer
- Command pattern in cmd/executioner for pluggable handlers
- Modular package structure for extensibility

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        CLI["CLI Front-End"]:::ui
        TUI["TUI Front-End"]:::ui
        ASCII["ASCII Preview Helper"]:::ui
    end

    %% Dispatcher Layer
    Dispatcher["Command Dispatcher / Executioner"]:::logic

    %% Core Processing Engine
    subgraph "Core Processing Engine"
        Manipulations["Manipulations Module"]:::logic
        Morphological["Morphological Module"]:::logic
        Noise["Noise Module"]:::logic
        Orthogonal["Orthogonal Transforms Module"]:::logic
        Analysis["Analysis Module"]:::logic
        ImageIO["Image I/O Layer"]:::storage
    end

    %% Reporting
    Reporting["Reporting Module"]:::storage

    %% Configuration
    subgraph "Configuration / Assets"
        Masks["masks.json"]:::config
        Structure["structure_elements.json"]:::config
    end

    %% File System
    FileSystem["File System Storage (imgs/, output)"]:::storage

    %% Connections
    CLI -->|"invoke command"| Dispatcher
    TUI -->|"submit form"| Dispatcher
    TUI -->|"preview ascii"| ASCII

    Dispatcher -->|"execute handler"| Manipulations
    Dispatcher -->|"execute handler"| Morphological
    Dispatcher -->|"execute handler"| Noise
    Dispatcher -->|"execute handler"| Orthogonal
    Dispatcher -->|"execute handler"| Analysis

    Manipulations -->|"read/write BMP"| ImageIO
    Morphological -->|"read/write BMP"| ImageIO
    Noise -->|"read/write BMP"| ImageIO
    Orthogonal -->|"read/write BMP"| ImageIO
    Analysis -->|"read metrics"| ImageIO

    Morphological -->|"load structure"| Structure
    Orthogonal -->|"load masks"| Masks

    Dispatcher -->|"collect metrics"| Reporting
    Reporting -->|"write report"| FileSystem

    ImageIO -->|"save BMP"| FileSystem

    %% Click Events
    click CLI "https://github.com/oskarowski/imagio-image-processing-app/blob/master/cmd/cli_app.go"
    click Dispatcher "https://github.com/oskarowski/imagio-image-processing-app/tree/master/cmd/executioner/"
    click TUI "https://github.com/oskarowski/imagio-image-processing-app/tree/master/cmd/tui/"
    click ASCII "https://github.com/oskarowski/imagio-image-processing-app/tree/master/internal/ascii_preview/"
    click ImageIO "https://github.com/oskarowski/imagio-image-processing-app/tree/master/imageio/"
    click Manipulations "https://github.com/oskarowski/imagio-image-processing-app/tree/master/manipulations/"
    click Morphological "https://github.com/oskarowski/imagio-image-processing-app/tree/master/morphological/"
    click Noise "https://github.com/oskarowski/imagio-image-processing-app/tree/master/noise/"
    click Orthogonal "https://github.com/oskarowski/imagio-image-processing-app/tree/master/orthogonal_transforms/"
    click Analysis "https://github.com/oskarowski/imagio-image-processing-app/tree/master/analysis/"
    click Reporting "https://github.com/oskarowski/imagio-image-processing-app/blob/master/reporting/report.go"
    click Masks "https://github.com/oskarowski/imagio-image-processing-app/blob/master/manipulations/masks.json"
    click Structure "https://github.com/oskarowski/imagio-image-processing-app/blob/master/morphological/structure_elements.json"
    click FileSystem "https://github.com/oskarowski/imagio-image-processing-app/tree/master/imgs/"

    %% Styles
    classDef ui fill:#e0f7fa,stroke:#006064
    classDef logic fill:#f5f5f5,stroke:#424242
    classDef storage fill:#ffecb3,stroke:#bf360c
    classDef config fill:#ffe0b2,stroke:#e65100
```
