# sannn-boo/scgproject architecture

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

- Interactive diagram: https://gitdiagram.com/sannn-boo/scgproject
- Repository: https://github.com/sannn-boo/scgproject

## Overview

This repository provides a web app for turning multi-view photos into calibrated, reviewable 3D measurements. Users upload and frame a capture, run a background reconstruction job, review and adjust cut planes, then inspect mesh and volume results; precomputed samples also support browsing without the GPU service. The backend orchestrates image preparation, VGGT inference, mesh cleanup and volume computation. The graph shows documented/import-indexed relationships; several stage internals and backend-to-pipeline wiring were not excerpted, so uncertain links are omitted.

Main entry points: [`pipeline/orchestrator.py`](https://github.com/sannn-boo/scgproject/blob/main/pipeline/orchestrator.py) (Pipeline orchestrator), [`src/app/page.tsx`](https://github.com/sannn-boo/scgproject/blob/main/src/app/page.tsx) (Screen flow), [`vggt/models/vggt.py`](https://github.com/sannn-boo/scgproject/blob/main/vggt/models/vggt.py) (VGGT model), [`pipeline/stages/clean.py`](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/clean.py) (Mesh cleanup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_page["Screen flow<br/>[page.tsx]"]
  node_capture["Capture screens<br/>[Framing.tsx]"]
  node_processing["Processing screen<br/>[Processing.tsx]"]
  node_review["Review screen<br/>[Review.tsx]"]
  node_result["Results screen<br/>[Result.tsx]"]
  node_samples["Sample data<br/>[data.ts]"]
  node_api["Job API client<br/>[api.ts]"]
  node_review3d["Cut review<br/>[CutReview.tsx]"]
  node_ply["PLY loader<br/>[usePly.ts]"]
end

subgraph group_service["Job service"]
  node_serviceapp["HTTP service<br/>[app.py]"]
  node_jobs["Job management<br/>[jobs.py]"]
end

subgraph group_pipeline["Reconstruction pipeline"]
  node_orchestrator["Pipeline orchestrator<br/>[orchestrator.py]"]
  node_prep["Frame preparation<br/>[prep.py]"]
  node_stage0["Capture preparation<br/>[stage0_prep.py]"]
  node_inference["VGGT inference<br/>[inference.py]"]
  node_pointcloud["Point cloud stage<br/>[pointcloud.py]"]
  node_clean["Mesh cleanup<br/>[clean.py]"]
  node_segmentation["Cloud segmentation<br/>[segmentation.py]"]
  node_ghost["Ghost removal<br/>[ghost.py]"]
  node_reconstruct["Mesh reconstruction<br/>[reconstruct.py]"]
  node_watertight["Watertight check<br/>[watertight.py]"]
  node_volume["Volume measurement<br/>[volume.py]"]
  node_config["Measurement config<br/>[config.py]"]
end

subgraph group_model["VGGT model"]
  node_vggt["VGGT model<br/>[vggt.py]"]
  node_aggregator["Feature aggregator<br/>[aggregator.py]"]
  node_dpt["Depth head<br/>[dpt_head.py]"]
  node_camera["Camera head<br/>[camera_head.py]"]
  node_trackhead["Tracking head<br/>[track_head.py]"]
  node_transformer["Transformer blocks<br/>[block.py]"]
  node_attention["Attention<br/>[attention.py]"]
  node_mlp["MLP layers<br/>[mlp.py]"]
  node_headact["Head activations<br/>[head_act.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_page -->|"shows"| node_capture
node_page -->|"shows"| node_processing
node_page -->|"shows"| node_review
node_page -->|"shows"| node_result
node_page -->|"starts jobs"| node_api
node_review -->|"loads measurements"| node_samples
node_review -->|"renders"| node_review3d
node_review3d -->|"loads mesh"| node_ply
node_api -.->|"calls service"| node_serviceapp
node_serviceapp -->|"delegates jobs"| node_jobs
node_orchestrator -->|"runs"| node_stage0
node_orchestrator -->|"runs"| node_inference
node_orchestrator -->|"runs"| node_pointcloud
node_orchestrator -->|"runs"| node_clean
node_orchestrator -->|"runs"| node_reconstruct
node_orchestrator -->|"runs"| node_watertight
node_orchestrator -->|"runs"| node_volume
node_stage0 -->|"uses"| node_prep
node_inference -->|"runs model"| node_vggt
node_clean -->|"uses"| node_segmentation
node_clean -->|"uses"| node_ghost
node_prep -->|"reads settings"| node_config
node_clean -->|"reads settings"| node_config
node_vggt -->|"aggregates features"| node_aggregator
node_vggt -->|"predicts depth"| node_dpt
node_vggt -->|"predicts cameras"| node_camera
node_vggt -->|"predicts tracks"| node_trackhead
node_aggregator -->|"uses blocks"| node_transformer
node_transformer -->|"applies attention"| node_attention
node_transformer -->|"applies MLP"| node_mlp
node_dpt -->|"uses activations"| node_headact

click node_page "https://github.com/sannn-boo/scgproject/blob/main/src/app/page.tsx"
click node_capture "https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Framing.tsx"
click node_processing "https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Processing.tsx"
click node_review "https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Review.tsx"
click node_result "https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Result.tsx"
click node_samples "https://github.com/sannn-boo/scgproject/blob/main/src/lib/data.ts"
click node_api "https://github.com/sannn-boo/scgproject/blob/main/src/lib/api.ts"
click node_review3d "https://github.com/sannn-boo/scgproject/blob/main/src/components/three/CutReview.tsx"
click node_ply "https://github.com/sannn-boo/scgproject/blob/main/src/components/three/usePly.ts"
click node_serviceapp "https://github.com/sannn-boo/scgproject/blob/main/service/app.py"
click node_jobs "https://github.com/sannn-boo/scgproject/blob/main/service/jobs.py"
click node_orchestrator "https://github.com/sannn-boo/scgproject/blob/main/pipeline/orchestrator.py"
click node_prep "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/prep.py"
click node_stage0 "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stage0_prep.py"
click node_inference "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/inference.py"
click node_pointcloud "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/pointcloud.py"
click node_clean "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/clean.py"
click node_segmentation "https://github.com/sannn-boo/scgproject/blob/main/pipeline/core/segmentation.py"
click node_ghost "https://github.com/sannn-boo/scgproject/blob/main/pipeline/ghost.py"
click node_reconstruct "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/reconstruct.py"
click node_watertight "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/watertight.py"
click node_volume "https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/volume.py"
click node_config "https://github.com/sannn-boo/scgproject/blob/main/pipeline/config.py"
click node_vggt "https://github.com/sannn-boo/scgproject/blob/main/vggt/models/vggt.py"
click node_aggregator "https://github.com/sannn-boo/scgproject/blob/main/vggt/models/aggregator.py"
click node_dpt "https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/dpt_head.py"
click node_camera "https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/camera_head.py"
click node_trackhead "https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/track_head.py"
click node_transformer "https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/block.py"
click node_attention "https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/attention.py"
click node_mlp "https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/mlp.py"
click node_headact "https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/head_act.py"

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_page,node_capture,node_processing,node_review,node_result,node_samples,node_api,node_review3d,node_ply,node_user toneBlue
class node_serviceapp,node_jobs toneAmber
class node_orchestrator,node_prep,node_stage0,node_inference,node_pointcloud,node_clean,node_segmentation,node_ghost,node_reconstruct,node_watertight,node_volume,node_config toneMint
class node_vggt,node_aggregator,node_dpt,node_camera,node_trackhead,node_transformer,node_attention,node_mlp,node_headact toneRose
```

## Components

### Web experience

- [Screen flow](https://github.com/sannn-boo/scgproject/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Capture screens](https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Framing.tsx): `src/components/screens/Framing.tsx`
- [Processing screen](https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Processing.tsx): `src/components/screens/Processing.tsx`
- [Review screen](https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Review.tsx): `src/components/screens/Review.tsx`
- [Results screen](https://github.com/sannn-boo/scgproject/blob/main/src/components/screens/Result.tsx): `src/components/screens/Result.tsx`
- [Sample data](https://github.com/sannn-boo/scgproject/blob/main/src/lib/data.ts): `src/lib/data.ts`
- [Job API client](https://github.com/sannn-boo/scgproject/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Cut review](https://github.com/sannn-boo/scgproject/blob/main/src/components/three/CutReview.tsx): `src/components/three/CutReview.tsx`
- [PLY loader](https://github.com/sannn-boo/scgproject/blob/main/src/components/three/usePly.ts): `src/components/three/usePly.ts`

### Job service

- [HTTP service](https://github.com/sannn-boo/scgproject/blob/main/service/app.py): `service/app.py`
- [Job management](https://github.com/sannn-boo/scgproject/blob/main/service/jobs.py): `service/jobs.py`

### Reconstruction pipeline

- [Pipeline orchestrator](https://github.com/sannn-boo/scgproject/blob/main/pipeline/orchestrator.py): `pipeline/orchestrator.py`
- [Frame preparation](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/prep.py): `pipeline/stages/prep.py`
- [Capture preparation](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stage0_prep.py): `pipeline/stage0_prep.py`
- [VGGT inference](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/inference.py): `pipeline/stages/inference.py`
- [Point cloud stage](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/pointcloud.py): `pipeline/stages/pointcloud.py`
- [Mesh cleanup](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/clean.py): `pipeline/stages/clean.py`
- [Cloud segmentation](https://github.com/sannn-boo/scgproject/blob/main/pipeline/core/segmentation.py): `pipeline/core/segmentation.py`
- [Ghost removal](https://github.com/sannn-boo/scgproject/blob/main/pipeline/ghost.py): `pipeline/ghost.py`
- [Mesh reconstruction](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/reconstruct.py): `pipeline/stages/reconstruct.py`
- [Watertight check](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/watertight.py): `pipeline/stages/watertight.py`
- [Volume measurement](https://github.com/sannn-boo/scgproject/blob/main/pipeline/stages/volume.py): `pipeline/stages/volume.py`
- [Measurement config](https://github.com/sannn-boo/scgproject/blob/main/pipeline/config.py): `pipeline/config.py`

### VGGT model

- [VGGT model](https://github.com/sannn-boo/scgproject/blob/main/vggt/models/vggt.py): `vggt/models/vggt.py`
- [Feature aggregator](https://github.com/sannn-boo/scgproject/blob/main/vggt/models/aggregator.py): `vggt/models/aggregator.py`
- [Depth head](https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/dpt_head.py): `vggt/heads/dpt_head.py`
- [Camera head](https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/camera_head.py): `vggt/heads/camera_head.py`
- [Tracking head](https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/track_head.py): `vggt/heads/track_head.py`
- [Transformer blocks](https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/block.py): `vggt/layers/block.py`
- [Attention](https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/attention.py): `vggt/layers/attention.py`
- [MLP layers](https://github.com/sannn-boo/scgproject/blob/main/vggt/layers/mlp.py): `vggt/layers/mlp.py`
- [Head activations](https://github.com/sannn-boo/scgproject/blob/main/vggt/heads/head_act.py): `vggt/heads/head_act.py`

### Other components

- **User**

## Connections

- User → Screen flow: uses (evidence: `src/app/page.tsx`)
- Screen flow → Capture screens: shows (evidence: `src/app/page.tsx`)
- Screen flow → Processing screen: shows (evidence: `src/app/page.tsx`)
- Screen flow → Review screen: shows (evidence: `src/app/page.tsx`)
- Screen flow → Results screen: shows (evidence: `src/app/page.tsx`)
- Screen flow → Job API client: starts jobs (evidence: `src/app/page.tsx`)
- Review screen → Sample data: loads measurements (evidence: `src/components/screens/Review.tsx`)
- Review screen → Cut review: renders (evidence: `src/components/screens/Review.tsx`)
- Cut review → PLY loader: loads mesh (evidence: `src/components/three/CutReview.tsx`)
- Job API client → HTTP service: calls service
- HTTP service → Job management: delegates jobs (evidence: `service/app.py`)
- Pipeline orchestrator → Capture preparation: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → VGGT inference: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → Point cloud stage: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → Mesh cleanup: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → Mesh reconstruction: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → Watertight check: runs (evidence: `pipeline/orchestrator.py`)
- Pipeline orchestrator → Volume measurement: runs (evidence: `pipeline/orchestrator.py`)
- Capture preparation → Frame preparation: uses (evidence: `pipeline/stage0_prep.py`)
- VGGT inference → VGGT model: runs model (evidence: `pipeline/stages/inference.py`)
- Mesh cleanup → Cloud segmentation: uses (evidence: `pipeline/stages/clean.py`)
- Mesh cleanup → Ghost removal: uses (evidence: `pipeline/stages/clean.py`)
- Frame preparation → Measurement config: reads settings (evidence: `pipeline/stages/prep.py`)
- Mesh cleanup → Measurement config: reads settings (evidence: `pipeline/stages/clean.py`)
- VGGT model → Feature aggregator: aggregates features (evidence: `vggt/models/vggt.py`)
- VGGT model → Depth head: predicts depth (evidence: `vggt/models/vggt.py`)
- VGGT model → Camera head: predicts cameras (evidence: `vggt/models/vggt.py`)
- VGGT model → Tracking head: predicts tracks (evidence: `vggt/models/vggt.py`)
- Feature aggregator → Transformer blocks: uses blocks (evidence: `vggt/models/aggregator.py`)
- Transformer blocks → Attention: applies attention (evidence: `vggt/layers/block.py`)
- Transformer blocks → MLP layers: applies MLP (evidence: `vggt/layers/block.py`)
- Depth head → Head activations: uses activations (evidence: `vggt/heads/dpt_head.py`)
