A local-first web viewer for .stl models and defect overlays (Brian CT green + missing ideal struts red).
Files stay in your browser — nothing is uploaded.
npm install
cp .env.example .env.local
# put your key in .env.local:
# OPENAI_API_KEY=sk-...
npm run devOpen the URL Vite prints (usually http://localhost:5173).
The bottom-right Viewer agent panel talks to OpenAI and can change the 3D view (theme, zoom, orbit, layers, tube radius, colors).
Environment variables (in .env.local):
| Variable | Required | Purpose |
|---|---|---|
OPENAI_API_KEY |
yes | OpenAI API token |
OPENAI_MODEL |
no | Defaults to gpt-4o-mini |
The key stays on the Vite dev server (/api/chat) and is not exposed to the browser bundle.
Drop or open any .stl file.
Click Open orthoslices and select:
- CT multipage
.tif/.tiff - registered lattice
.json - missing-struts
.csv - optional green CT
.stlfor the 3D surface
The right panel shows XY / XZ / YZ planes (downsample 2×). Red lines are missing struts. Asking chat to focus a strut ID jumps both the 3D camera and the three slice planes.
- Green — segmented Brian CT surface
- Red — known missing ideal struts (tubes from the registered lattice)
The browser cannot threshold a ~1 GB TIFF for the 3D surface, so export the green mesh once with the helper script, then load three files together:
brian_ct_green.stl(exported)- ideal registered lattice
.json missing_struts.csv
pip install -r scripts/requirements-overlay.txt
python scripts/export_defect_overlay.py \
--tiff "/path/to/Brian_Tran...Slices.tif" \
--ideal "/path/to/Brian_Tran...Slices.json" \
--output brian_ct_green.stlThen in the viewer click Open overlay (or drop all three files).
Controls:
- Toggle Brian CT / missing struts
- Adjust CT opacity and red tube radius
- Theme, grid, axes, reset camera