# vaclavnezerka/cloud2bim architecture

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

- Interactive diagram: https://gitdiagram.com/vaclavnezerka/cloud2bim
- Repository: https://github.com/vaclavnezerka/cloud2bim

## Overview

#### Purpose and Entry Point
Cloud2BIM is a Python Scan-to-BIM research pipeline that converts large point clouds into parametric building entities and IFC output. Its CLI entry point is `cloud2entities.py`, which accepts a YAML configuration path and defaults to `config.yaml`.

#### Input, Configuration, and Workspace Boundaries
Source scans are expected in E57 or XYZ form under `input_e57/` and `input_xyz/`. Runtime parameters—including processing choices and paths—are centralized in `config.yaml`. Intermediate or processed point-cloud results are separated into `output_xyz/`; IFC artifacts are written to `output_IFC/`. These directory boundaries support file-based, batch-oriented execution rather than a service or web runtime.

#### Point-Cloud-to-Entity Orchestration
`cloud2entities.py` is the top-level controller for the extraction workflow. It coordinates loading/conversion of point-cloud data, density-based segmentation, geometry processing, entity generation, and IFC export. The README identifies target classes as slabs, walls, windows, and doors, derived using point-density analysis augmented by image and morphological operations.

#### Spatial Segmentation and Geometry Extraction
The core reconstruction logic is distributed between `cloud2entities.py` and `space_generator.py`. This stage transforms raw spatial samples into segmented regions and inferred building spaces/elements. `aux_functions.py` supplies shared processing utilities, while `plotting_functions.py` supports visual inspection of point clouds, segmentation, or generated geometry—important for a research pipeline whose parameterization may require manual tuning.

#### Parametric BIM / IFC Generation
`generate_ifc.py` forms the output boundary from extracted geometric entities to IFC-compatible BIM data. It consumes inferred geometry from the prior stages and emits model files under `output_IFC/`. This is the principal interoperability boundary: upstream logic operates on point-cloud and image-like representations, while downstream consumers receive industry-standard IFC.

#### Optional Deep-Learning Assets
`DL_module/` contains a distinct ML component with pretrained checkpoints such as `DL_module/weights/run_20260804_1517/best.pth` and training logs. Its separate README and weights hierarchy indicate that neural inference/training is an optional or separately managed capability rather than the visible primary CLI entry point. The main documented method remains density-, image-, and morphology-based segmentation.

#### Runtime and External Dependencies
The project runs as a local Python application, installed through `requirements.txt`; no deployed infrastructure, database, or API service is represented in the repository. External inputs may be obtained from the Zenodo-hosted Kladno station dataset. IFC files are the key external output contract, while E57/XYZ are the input data contracts.

Main entry points: [`cloud2entities.py`](https://github.com/vaclavnezerka/cloud2bim/blob/master/cloud2entities.py) (CLI controller), [`space_generator.py`](https://github.com/vaclavnezerka/cloud2bim/blob/master/space_generator.py) (Spatial reconstruction), [`aux_functions.py`](https://github.com/vaclavnezerka/cloud2bim/blob/master/aux_functions.py) (Processing utilities), [`generate_ifc.py`](https://github.com/vaclavnezerka/cloud2bim/blob/master/generate_ifc.py) (IFC generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs &amp; Configuration"]
  node_config["Runtime configuration<br/>YAML config<br/>[config.yaml]"]
  node_e57_input["E57 scans<br/>point-cloud input"]
  node_xyz_input["XYZ scans<br/>point-cloud input"]
end

subgraph group_pipeline["Reconstruction Pipeline"]
  node_cli["CLI controller<br/>Python entry point<br/>[cloud2entities.py]"]
  node_spatial_reconstruction["Spatial reconstruction<br/>segmentation &amp; geometry<br/>[space_generator.py]"]
  node_shared_processing["Processing utilities<br/>shared Python utilities<br/>[aux_functions.py]"]
  node_visualization["Visual inspection<br/>plotting tools"]
  node_entities{{"Building entities<br/>parametric geometry"}}
end

subgraph group_outputs["Output Contracts"]
  node_processed_clouds["Processed point clouds<br/>intermediate files"]
  node_ifc_generator["IFC generator<br/>BIM export<br/>[generate_ifc.py]"]
  node_ifc_output["IFC artifacts<br/>industry output contract"]
end

subgraph group_ml["Optional ML Assets"]
  node_dl_module["Deep-learning module<br/>optional ML component"]
  node_dl_weights["Pretrained checkpoint<br/>model weights<br/>[best.pth]"]
end

node_config -->|"configures"| node_cli
node_e57_input -->|"loads / converts"| node_cli
node_xyz_input -->|"loads"| node_cli
node_cli -->|"orchestrates"| node_spatial_reconstruction
node_shared_processing -->|"supports"| node_cli
node_shared_processing -->|"supports"| node_spatial_reconstruction
node_spatial_reconstruction -->|"infers"| node_entities
node_cli -->|"writes"| node_processed_clouds
node_spatial_reconstruction -.->|"inspected through"| node_visualization
node_entities -->|"exports"| node_ifc_generator
node_ifc_generator -->|"writes"| node_ifc_output
node_dl_weights -->|"loads"| node_dl_module
node_dl_module -.->|"optional inference"| node_spatial_reconstruction

click node_cli "https://github.com/vaclavnezerka/cloud2bim/blob/master/cloud2entities.py"
click node_config "https://github.com/vaclavnezerka/cloud2bim/blob/master/config.yaml"
click node_spatial_reconstruction "https://github.com/vaclavnezerka/cloud2bim/blob/master/space_generator.py"
click node_shared_processing "https://github.com/vaclavnezerka/cloud2bim/blob/master/aux_functions.py"
click node_visualization "https://github.com/vaclavnezerka/cloud2bim/blob/master/plotting_functions.py"
click node_ifc_generator "https://github.com/vaclavnezerka/cloud2bim/blob/master/generate_ifc.py"
click node_dl_weights "https://github.com/vaclavnezerka/cloud2bim/blob/master/DL_module/weights/run_20260804_1517/best.pth"

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_config,node_e57_input,node_xyz_input toneBlue
class node_cli,node_spatial_reconstruction,node_shared_processing,node_visualization,node_entities toneAmber
class node_processed_clouds,node_ifc_generator,node_ifc_output toneMint
class node_dl_module,node_dl_weights toneRose
```

## Components

### Inputs & Configuration

- [Runtime configuration](https://github.com/vaclavnezerka/cloud2bim/blob/master/config.yaml): YAML config · `config.yaml`
- **E57 scans**: point-cloud input
- **XYZ scans**: point-cloud input

### Reconstruction Pipeline

- [CLI controller](https://github.com/vaclavnezerka/cloud2bim/blob/master/cloud2entities.py): Python entry point · Loads YAML settings and coordinates batch reconstruction. · `cloud2entities.py`
- [Spatial reconstruction](https://github.com/vaclavnezerka/cloud2bim/blob/master/space_generator.py): segmentation & geometry · Converts samples into regions, spaces, and building-element geometry. · `space_generator.py`
- [Processing utilities](https://github.com/vaclavnezerka/cloud2bim/blob/master/aux_functions.py): shared Python utilities · `aux_functions.py`
- [Visual inspection](https://github.com/vaclavnezerka/cloud2bim/blob/master/plotting_functions.py): plotting tools · Supports tuning and inspection of point clouds and inferred geometry. · `plotting_functions.py`
- **Building entities**: parametric geometry · Inferred slabs, walls, windows, and doors.

### Output Contracts

- **Processed point clouds**: intermediate files
- [IFC generator](https://github.com/vaclavnezerka/cloud2bim/blob/master/generate_ifc.py): BIM export · Maps extracted geometry to IFC-compatible BIM data. · `generate_ifc.py`
- **IFC artifacts**: industry output contract

### Optional ML Assets

- **Deep-learning module**: optional ML component · Separately managed training and inference capability.
- [Pretrained checkpoint](https://github.com/vaclavnezerka/cloud2bim/blob/master/DL_module/weights/run_20260804_1517/best.pth): model weights · `DL_module/weights/run_20260804_1517/best.pth`

## Connections

- Runtime configuration → CLI controller: configures
- E57 scans → CLI controller: loads / converts
- XYZ scans → CLI controller: loads
- CLI controller → Spatial reconstruction: orchestrates
- Processing utilities → CLI controller: supports
- Processing utilities → Spatial reconstruction: supports
- Spatial reconstruction → Building entities: infers
- CLI controller → Processed point clouds: writes
- Spatial reconstruction → Visual inspection: inspected through
- Building entities → IFC generator: exports
- IFC generator → IFC artifacts: writes
- Pretrained checkpoint → Deep-learning module: loads
- Deep-learning module → Spatial reconstruction: optional inference
