# hutin1/aso architecture

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

- Interactive diagram: https://gitdiagram.com/hutin1/aso
- Repository: https://github.com/hutin1/aso

## Overview

##### Project Type and Purpose
- This is a **3D Slicer extension** (plugin) called **Automated Standardized Orientation (ASO)**.
- It provides a GUI for orienting 3D scans (CBCT and IOS) in two modes:
- **Semi-Automated** – landmark-based ICP registration only
- **Fully-Automated** – includes Pre-Orientation (deep learning), Landmark Identification (ALI_CBCT), then ICP

##### File-Structure Analysis
Top-level:
- ASO/ – core Slicer extension
– ASO.py (entry point/controller)
– Methode/ (generic pipeline classes: Methode.py, CBCT.py, IOS.py, Progress.py)
– Testing/ (CMake test harness, Python tests)
– CMakeLists.txt – build config for Slicer extension
- ASO_CBCT/ – CBCT-specific pipelines
– PRE_ASO_CBCT/ & SEMI_ASO_CBCT/ (mode implementations: .py + .xml descriptors)
– utils/ (NeuralNet loader, resampling, common routines)
- ASO_IOS/ – IOS-specific pipelines
– PRE_ASO_IOS/ & SEMI_ASO_IOS/ (mode implementations)
– utils/ (cache, ICP, pre_icp, transformations, I/O helpers)
- CMakeLists.txt & LICENSE.txt & README.md

##### README Insights
- Describes two modes with their inputs/outputs
- Highlights external dependencies: deep-learning PreASO models, ALI_CBCT for landmark identification, SlicerDentalModelSeg for segmentation
- Shows high-level flowcharts for CBCT and IOS pipelines

##### Key Components
a. **User Interface**
- 3D Slicer GUI extension (ASO.ui)
- Controls: Input type (CBCT/IOS), Mode selector, Folder pickers, Run button, Output options
b. **Controller Layer**
- ASO.py orchestrates user input → pipeline dispatch
- Methode.py defines abstract pipeline interface, Progress.py updates GUI
c. **Processing Pipelines**
- CBCT Pipeline
- Pre-Orientation (deep learning model loader & predictor – utils/Net.py)
- Landmark Identification (ALI_CBCT external module)
- ICP Registration (Methode/CBCT.py + ASO_CBCT utils)
- IOS Pipeline
- (Optional) Pre-ICP cleaning steps (utils/pre_icp.py)
- ICP Registration (Methode/IOS.py + ASO_IOS utils/icp.py)
d. **Data Management**
- **Inputs:** Scan files (.nii, .vtk…), Landmark files, Reference gold files, Models folders
- **Outputs:** Oriented meshes/volumes, logs
e. **External Services & Dependencies**
- 3D Slicer host application
- Deep-learning models (downloaded .zip)
- ALI_CBCT library (landmark detection)
- SlicerDentalModelSeg (for IOS segmentation)

##### Architectural Patterns & Principles
- **Plugin Architecture:** Clear separation between host (3D Slicer) and extension code
- **Modular Pipeline:** Abstract base class for pipelines (Methode) with CBCT/IOS specializations
- **Separation of Concerns:**
- UI vs. Orchestration vs. Processing vs. Data I/O
- Fully vs. Semi modes share common ICP step, differ in preprocessing

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface"
        UI_ASO["ASO.ui"]:::ui
        Icons["Icons"]:::ui
        Image["Image"]:::ui
    end

    %% Controller Layer
    subgraph "Controller Layer"
        ASO_py["ASO.py"]:::controller
        Methode["Methode.py"]:::controller
        Progress["Progress.py"]:::controller
    end

    %% CBCT Pipeline
    subgraph "CBCT Pipeline"
        subgraph "Fully-Automated CBCT"
            PRE_cbct_py["PRE_ASO_CBCT.py"]:::cbct
            PRE_cbct_xml["PRE_ASO_CBCT.xml"]:::cbct
            Net["Net.py"]:::cbct
            Resample["ResamplePreASO.py"]:::cbct
        end
        subgraph "Semi-Automated CBCT"
            SEMI_cbct_py["SEMI_ASO_CBCT.py"]:::cbct
            SEMI_cbct_xml["SEMI_ASO_CBCT.xml"]:::cbct
            utils_cbct["utils.py"]:::cbct
        end
        ICP_CBCT["CBCT.py"]:::controller
    end

    %% IOS Pipeline
    subgraph "IOS Pipeline"
        subgraph "Fully-Automated IOS"
            PRE_ios_py["PRE_ASO_IOS.py"]:::ios
            PRE_ios_xml["PRE_ASO_IOS.xml"]:::ios
        end
        subgraph "Semi-Automated IOS"
            SEMI_ios_py["SEMI_ASO_IOS.py"]:::ios
            SEMI_ios_xml["SEMI_ASO_IOS.xml"]:::ios
        end
        pre_icp["pre_icp.py"]:::ios
        icp_ios["icp.py"]:::ios
        transform["transformation.py"]:::ios
        data_file["data_file.py"]:::ios
        cache["cache/"]:::ios
        IOS_stub["IOS.py"]:::controller
    end

    %% Data Management & External Services
    subgraph "Data & External"
        Inputs["Input Folder"]:::data
        Models["DL Models"]:::data
        Reference["Reference Folder"]:::data
        Output["Output Folder"]:::data
        Slicer["3D Slicer"]:::external
        ALI["ALI_CBCT"]:::external
        Seg["SlicerDentalModelSeg"]:::external
        Tests["ASO/Testing"]:::data
        Build1["ASO/CMakeLists.txt"]:::data
        BuildRoot["CMakeLists.txt"]:::data
        README["README.md"]:::data
        LICENSE["LICENSE.txt"]:::data
    end

    %% Connections
    UI_ASO --> ASO_py
    Icons --> UI_ASO
    Image --> UI_ASO

    ASO_py --> Methode
    ASO_py --> Progress
    ASO_py --> PRE_cbct_py
    ASO_py --> SEMI_cbct_py
    ASO_py --> PRE_ios_py
    ASO_py --> SEMI_ios_py
    ASO_py --> Inputs
    ASO_py --> README
    ASO_py --> LICENSE
    ASO_py --> Slicer

    PRE_cbct_py --> Net
    PRE_cbct_py --> Resample
    PRE_cbct_py --> ALI
    PRE_cbct_py --> ICP_CBCT
    PRE_cbct_py --> Models
    PRE_cbct_py --> PRE_cbct_xml

    SEMI_cbct_py --> utils_cbct
    SEMI_cbct_py --> ICP_CBCT
    SEMI_cbct_py --> SEMI_cbct_xml

    ICP_CBCT --> Reference
    ICP_CBCT --> Output

    PRE_ios_py --> Seg
    PRE_ios_py --> pre_icp
    PRE_ios_py --> icp_ios
    PRE_ios_py --> transform
    PRE_ios_py --> data_file
    PRE_ios_py --> IOS_stub
    PRE_ios_py --> Models
    PRE_ios_py --> PRE_ios_xml

    SEMI_ios_py --> pre_icp
    SEMI_ios_py --> icp_ios
    SEMI_ios_py --> IOS_stub
    SEMI_ios_py --> SEMI_ios_xml

    pre_icp --> icp_ios
    icp_ios --> Output
    IOS_stub --> icp_ios

    Tests --> Build1
    Build1 --> BuildRoot

    %% Click Events
    click UI_ASO "https://github.com/hutin1/aso/blob/main/ASO/Resources/UI/ASO.ui"
    click Icons "https://github.com/hutin1/aso/tree/main/ASO/Resources/Icons/"
    click Image "https://github.com/hutin1/aso/tree/main/ASO/Resources/Image/"
    click ASO_py "https://github.com/hutin1/aso/blob/main/ASO/ASO.py"
    click Methode "https://github.com/hutin1/aso/blob/main/ASO/Methode/Methode.py"
    click Progress "https://github.com/hutin1/aso/blob/main/ASO/Methode/Progress.py"
    click PRE_cbct_py "https://github.com/hutin1/aso/blob/main/ASO_CBCT/PRE_ASO_CBCT/PRE_ASO_CBCT.py"
    click PRE_cbct_xml "https://github.com/hutin1/aso/blob/main/ASO_CBCT/PRE_ASO_CBCT/PRE_ASO_CBCT.xml"
    click Net "https://github.com/hutin1/aso/blob/main/ASO_CBCT/utils/Net.py"
    click Resample "https://github.com/hutin1/aso/blob/main/ASO_CBCT/utils/ResamplePreASO.py"
    click SEMI_cbct_py "https://github.com/hutin1/aso/blob/main/ASO_CBCT/SEMI_ASO_CBCT/SEMI_ASO_CBCT.py"
    click SEMI_cbct_xml "https://github.com/hutin1/aso/blob/main/ASO_CBCT/SEMI_ASO_CBCT/SEMI_ASO_CBCT.xml"
    click utils_cbct "https://github.com/hutin1/aso/blob/main/ASO_CBCT/utils/utils.py"
    click PRE_ios_py "https://github.com/hutin1/aso/blob/main/ASO_IOS/PRE_ASO_IOS/PRE_ASO_IOS.py"
    click PRE_ios_xml "https://github.com/hutin1/aso/blob/main/ASO_IOS/PRE_ASO_IOS/PRE_ASO_IOS.xml"
    click SEMI_ios_py "https://github.com/hutin1/aso/blob/main/ASO_IOS/SEMI_ASO_IOS/SEMI_ASO_IOS.py"
    click SEMI_ios_xml "https://github.com/hutin1/aso/blob/main/ASO_IOS/SEMI_ASO_IOS/SEMI_ASO_IOS.xml"
    click pre_icp "https://github.com/hutin1/aso/blob/main/ASO_IOS/utils/pre_icp.py"
    click icp_ios "https://github.com/hutin1/aso/blob/main/ASO_IOS/utils/icp.py"
    click transform "https://github.com/hutin1/aso/blob/main/ASO_IOS/utils/transformation.py"
    click data_file "https://github.com/hutin1/aso/blob/main/ASO_IOS/utils/data_file.py"
    click cache "https://github.com/hutin1/aso/tree/main/ASO_IOS/utils/cache/"
    click Tests "https://github.com/hutin1/aso/tree/main/ASO/Testing/"
    click Build1 "https://github.com/hutin1/aso/blob/main/ASO/CMakeLists.txt"
    click BuildRoot "https://github.com/hutin1/aso/blob/main/CMakeLists.txt"
    click README "https://github.com/hutin1/aso/blob/main/README.md"
    click LICENSE "https://github.com/hutin1/aso/blob/main/LICENSE.txt"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085
    classDef controller fill:#add8e6,stroke:#004085
    classDef cbct fill:#d4edda,stroke:#155724
    classDef ios fill:#ffe5b4,stroke:#856404
    classDef data fill:#e2e3e5,stroke:#383d41
    classDef external fill:#f8d7da,stroke:#721c24
```
