# neogeographytoolkit/stereopipeline architecture

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

- Interactive diagram: https://gitdiagram.com/neogeographytoolkit/stereopipeline
- Repository: https://github.com/neogeographytoolkit/stereopipeline

## Overview

##### Project type and purpose
- This is a native C++/Python open-source command-line toolkit (the Ames Stereo Pipeline, ASP) for automated geodesy and stereogrammetry. It produces DTMs/DEMs, ortho images, 3D models, and camera networks from stereo imagery.

##### File structure
- Top-level directories:
- src/asp: all core C++ libraries and Python helper scripts organized into subpackages (Camera, Core, GUI, Sessions, SfS, Tools, etc.)
- thirdparty: bundled test and utility libraries (gtest, protobuf, autotroll)
- docs: ReST source + examples + images for documentation site
- examples: sample stereo‐processing jobs and data
- conda: environment definitions for multiple Python/OS versions
- .github/workflows & cmake/: CI, build and environment helpers
- Each C++ subdirectory under src/asp builds into libraries or executables via CMakeLists.txt
- Tools/ directories contain small binaries or scripts that form the CLI entry points
- Plugins/stereo holds runtime‐loadable plugin lists for extension
- Build artifacts: CMake generates executables (in bin/) and libraries (in lib/)

##### Key insights from the README
- ASP is modular, cross-platform, built under Apache 2.0
- Relies heavily on external libs: GDAL, OpenCV, Ceres, ISIS, Eigen, PDAL, Boost
- Uses Sessions/Factory pattern to select per-sensor processing logic
- Provides Python utilities for scripting and batch driving

##### Detail
- Every major module (Camera, Core, GUI, Sessions, Tools, SfS)
- Build/deploy layer (CMake, conda, CI)
- How data transforms as it flows through the pipeline

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User("User"):::user

    %% CLI Layer
    subgraph "CLI Layer"
        Tools("CLI Tools"):::cli
        Orchestrators("Python Orchestrators"):::py
    end

    %% Core C++ Libraries
    subgraph "Core C++ Libraries"
        Camera("Camera Models"):::cpp
        Stereo("Stereo Algorithms"):::cpp
        Bundle("Bundle Adjustment"):::cpp
        SfS("Surface-From-Shading"):::cpp
        Sessions("Sessions Factory & Plugins"):::cpp
        PclIO("Point-Cloud I/O (PclIO)"):::cpp
        Gdal("Raster I/O (GdalUtils)"):::cpp
        Rig("Rig Processing"):::cpp
        OpenMVG("OpenMVG Integration"):::cpp
        PcAlign("Point-Cloud Alignment"):::cpp
        WVCorrect("WV Correct"):::cpp
        GUI("GUI Layer"):::cpp
        PythonHelpers("Python Helper Modules"):::py
    end

    %% External Dependencies
    subgraph "External Dependencies"
        GDAL("GDAL"):::external
        OpenCV("OpenCV"):::external
        Ceres("Ceres"):::external
        ISIS("ISIS"):::external
        Boost("Boost"):::external
        Eigen("Eigen"):::external
        PDAL("PDAL"):::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        CMake("CMake"):::build
        Conda("Conda Packaging"):::build
        CI("CI Workflows"):::build
    end

    %% Docs & Examples
    subgraph "Docs & Examples"
        Docs("Documentation Site Sources"):::doc
        Examples("Example Data & Jobs"):::doc
    end

    %% Third-Party Bundles
    ThirdParty("Third-Party Libraries"):::external

    %% Relationships
    User -->|invokes| Tools
    User -->|runs workflows| Orchestrators

    Orchestrators -->|calls| Tools
    Orchestrators -->|uses| PythonHelpers

    Tools -->|uses| Camera
    Tools -->|uses| Stereo
    Tools -->|uses| Bundle
    Tools -->|uses| SfS
    Tools -->|uses| Sessions
    Tools -->|uses| PclIO
    Tools -->|uses| Gdal
    Tools -->|invokes GUI| GUI

    PythonHelpers -->|orchestrates| Tools

    Sessions -->|selects sensor| Camera
    Camera -->|feeds data| Stereo
    Stereo -->|runs| Bundle
    Bundle -->|refines| SfS
    SfS -->|reads/writes| Gdal
    PclIO -->|reads/writes| PDAL

    Gdal -->|calls| GDAL
    Stereo -->|calls| OpenCV
    Bundle -->|uses| Ceres
    Sessions -->|integrates| ISIS
    Camera -->|templated by| Boost
    Stereo -->|vector math| Eigen
    PclIO -->|calls| PDAL

    Tools -->|built by| CMake
    PythonHelpers -->|packaged by| Conda
    CMake -->|tested by| CI

    Docs -->|documents| Tools
    Examples -->|sample inputs| Tools

    ThirdParty -->|included in build| CMake

    %% Click Events
    click Tools "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/Tools/"
    click Orchestrators "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/IceBridge/"
    click PythonHelpers "https://github.com/neogeographytoolkit/stereopipeline/blob/master/src/asp/Python/asp_*_utils.py"
    click Camera "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/Camera/"
    click Stereo "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/Core/"
    click Bundle "https://github.com/neogeographytoolkit/stereopipeline/blob/master/src/asp/Camera/BundleAdjust*.cc"
    click Bundle "https://github.com/neogeographytoolkit/stereopipeline/blob/master/src/asp/Core/BundleAdjustUtils.*"
    click SfS "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/SfS/"
    click Sessions "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/Sessions/"
    click Sessions "https://github.com/neogeographytoolkit/stereopipeline/blob/master/plugins/stereo/plugin_list.txt"
    click PclIO "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/PclIO/"
    click Gdal "https://github.com/neogeographytoolkit/stereopipeline/blob/master/src/asp/Core/GdalUtils.*"
    click Rig "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/Rig/"
    click OpenMVG "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/OpenMVG/"
    click PcAlign "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/PcAlign/"
    click WVCorrect "https://github.com/neogeographytoolkit/stereopipeline/tree/master/src/asp/WVCorrect/"
    click CMake "https://github.com/neogeographytoolkit/stereopipeline/blob/master/CMakeLists.txt"
    click CMake "https://github.com/neogeographytoolkit/stereopipeline/tree/master/cmake/"
    click Conda "https://github.com/neogeographytoolkit/stereopipeline/tree/master/conda/"
    click CI "https://github.com/neogeographytoolkit/stereopipeline/tree/master/.github/workflows/"
    click Docs "https://github.com/neogeographytoolkit/stereopipeline/tree/master/docs/"
    click Examples "https://github.com/neogeographytoolkit/stereopipeline/tree/master/examples/"
    click ThirdParty "https://github.com/neogeographytoolkit/stereopipeline/tree/master/thirdparty/"

    %% Styles
    classDef cli fill:#9f6,stroke:#333
    classDef cpp fill:#6bf,stroke:#333
    classDef py fill:#fc3,stroke:#333
    classDef external fill:#ccc,stroke:#333
    classDef build fill:#c6f,stroke:#333
    classDef doc fill:#afa,stroke:#333
    classDef user fill:#ff9,stroke:#333
```
