# sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images architecture

> Architecture diagram of the GitHub repository sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images
- Repository: https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images

## Overview

Smartee reconstructs upper and lower 3D teeth from five intra-oral photographs using segmentation, statistical shape priors, and staged multi-view optimization. The principal runtime begins at main.py, which combines predicted tooth boundaries with the five-view optimizer and exports reconstructed meshes; visualization projects results back onto photographs. The README also documents separate segmentation training and SSM preprocessing workflows. Edges rely on README statements and SOURCE INDEX references; unsampled implementation details are not asserted.

Main entry points: [`main.py`](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/main.py) (Reconstruction runner), [`seg/run_train.py`](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/run_train.py) (Segmentation training), [`visualization.py`](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/visualization.py) (Photo projection), [`cpdGp_align_ssm.py`](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/cpdGp_align_ssm.py) (SSM preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_seg["Boundary Segmentation"]
  node_segment["Boundary prediction<br/>[utils.py]"]
  node_network["ASPP U-Net<br/>[seg_model.py]"]
  node_train["Segmentation training<br/>[run_train.py]"]
  node_data["Training data pipeline<br/>[seg_data.py]"]
  node_loss["Dice-SSIM loss<br/>[seg_loss.py]"]
  node_segconfig["Segmentation settings<br/>[seg_const.py]"]
end

subgraph group_shape["Shape Modeling"]
  node_align["SSM preprocessing<br/>[cpdGp_align_ssm.py]"]
  node_registration["Gaussian-process registration"]
  node_ssm["Shape-model utilities<br/>[ssm_utils.py]"]
end

subgraph group_recon["Reconstruction"]
  node_main["Reconstruction runner<br/>[main.py]"]
  node_constants["Photo and model settings<br/>[const.py]"]
  node_optimizer["Five-view EM optimizer<br/>[emopt5views.py]"]
end

subgraph group_results["Evaluation and Views"]
  node_meshutils["Point-cloud and mesh tools<br/>[pcd_mesh_utils.py]"]
  node_metrics["Reconstruction metrics"]
  node_visualize["Photo projection<br/>[visualization.py]"]
  node_h5[("Reconstruction results")]
  node_meshes["Predicted tooth meshes"]
end

node_user(("Clinician / user"))
node_photos["Five photos"]
node_viewuser(("Reconstruction viewer"))

node_user -->|"supplies"| node_photos
node_photos -->|"provides inputs"| node_main
node_main -->|"loads settings"| node_constants
node_main -->|"predicts boundaries"| node_segment
node_segment -->|"uses model"| node_network
node_main -->|"optimizes views"| node_optimizer
node_align -->|"registers shapes"| node_registration
node_align -->|"uses point-cloud tools"| node_meshutils
node_align -->|"builds shape model"| node_ssm
node_main -->|"saves results"| node_h5
node_main -->|"constructs meshes"| node_meshutils
node_main -->|"evaluates results"| node_metrics
node_main -->|"exports meshes"| node_meshes
node_train -->|"loads batches"| node_data
node_train -->|"trains model"| node_network
node_train -->|"optimizes loss"| node_loss
node_data -->|"reads settings"| node_segconfig
node_train -->|"reads settings"| node_segconfig
node_viewuser -->|"requests projection"| node_visualize
node_visualize -.->|"reads reconstruction"| node_h5
node_visualize -->|"projects onto photos"| node_photos
node_visualize -.->|"renders meshes"| node_meshes

click node_main "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/main.py"
click node_constants "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/const.py"
click node_segment "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/utils.py"
click node_network "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_model.py"
click node_train "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/run_train.py"
click node_data "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_data.py"
click node_loss "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_loss.py"
click node_segconfig "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_const.py"
click node_align "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/cpdGp_align_ssm.py"
click node_registration "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/gp_non_rigid_registration.py"
click node_ssm "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/ssm_utils.py"
click node_optimizer "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/emopt5views.py"
click node_meshutils "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/pcd_mesh_utils.py"
click node_metrics "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/recons_eval_metric.py"
click node_visualize "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/visualization.py"
click node_h5 "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/tree/main/demo/h5"
click node_meshes "https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/tree/main/demo/mesh"

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_segment,node_network,node_train,node_data,node_loss,node_segconfig,node_user,node_viewuser toneBlue
class node_align,node_registration,node_ssm toneAmber
class node_main,node_constants,node_optimizer toneMint
class node_meshutils,node_metrics,node_visualize,node_h5,node_meshes toneRose
class node_photos toneIndigo
```

## Components

### Boundary Segmentation

- [Boundary prediction](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/utils.py): `seg/utils.py`
- [ASPP U-Net](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_model.py): `seg/seg_model.py`
- [Segmentation training](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/run_train.py): `seg/run_train.py`
- [Training data pipeline](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_data.py): `seg/seg_data.py`
- [Dice-SSIM loss](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_loss.py): `seg/seg_loss.py`
- [Segmentation settings](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/seg/seg_const.py): `seg/seg_const.py`

### Shape Modeling

- [SSM preprocessing](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/cpdGp_align_ssm.py): `cpdGp_align_ssm.py`
- [Gaussian-process registration](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/gp_non_rigid_registration.py): `gp_non_rigid_registration.py`
- [Shape-model utilities](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/ssm_utils.py): `ssm_utils.py`

### Reconstruction

- [Reconstruction runner](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/main.py): `main.py`
- [Photo and model settings](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/const.py): `const.py`
- [Five-view EM optimizer](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/emopt5views.py): `emopt5views.py`

### Evaluation and Views

- [Point-cloud and mesh tools](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/pcd_mesh_utils.py): `pcd_mesh_utils.py`
- [Reconstruction metrics](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/recons_eval_metric.py): `recons_eval_metric.py`
- [Photo projection](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/blob/main/visualization.py): `visualization.py`
- [Reconstruction results](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/tree/main/demo/h5): `demo/h5`
- [Predicted tooth meshes](https://github.com/sjtuzhou/3d-teeth-reconstruction-from-five-intra-oral-images/tree/main/demo/mesh): `demo/mesh`

### Other components

- **Clinician / user**
- **Five photos**
- **Reconstruction viewer**

## Connections

- Clinician / user → Five photos: supplies (evidence: `readme.md`)
- Five photos → Reconstruction runner: provides inputs (evidence: `readme.md`)
- Reconstruction runner → Photo and model settings: loads settings (evidence: `main.py`)
- Reconstruction runner → Boundary prediction: predicts boundaries (evidence: `main.py`)
- Boundary prediction → ASPP U-Net: uses model (evidence: `main.py`)
- Reconstruction runner → Five-view EM optimizer: optimizes views (evidence: `main.py`)
- SSM preprocessing → Gaussian-process registration: registers shapes (evidence: `cpdGp_align_ssm.py`)
- SSM preprocessing → Point-cloud and mesh tools: uses point-cloud tools (evidence: `cpdGp_align_ssm.py`)
- SSM preprocessing → Shape-model utilities: builds shape model (evidence: `cpdGp_align_ssm.py`)
- Reconstruction runner → Reconstruction results: saves results (evidence: `main.py`)
- Reconstruction runner → Point-cloud and mesh tools: constructs meshes (evidence: `main.py`)
- Reconstruction runner → Reconstruction metrics: evaluates results (evidence: `main.py`)
- Reconstruction runner → Predicted tooth meshes: exports meshes (evidence: `main.py`)
- Segmentation training → Training data pipeline: loads batches (evidence: `seg/run_train.py`)
- Segmentation training → ASPP U-Net: trains model (evidence: `seg/run_train.py`)
- Segmentation training → Dice-SSIM loss: optimizes loss (evidence: `seg/run_train.py`)
- Training data pipeline → Segmentation settings: reads settings (evidence: `seg/seg_data.py`)
- Segmentation training → Segmentation settings: reads settings (evidence: `seg/run_train.py`)
- Reconstruction viewer → Photo projection: requests projection (evidence: `readme.md`)
- Photo projection → Reconstruction results: reads reconstruction
- Photo projection → Five photos: projects onto photos (evidence: `readme.md`)
- Photo projection → Predicted tooth meshes: renders meshes
