Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

STL Viewer

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.

Run

npm install
cp .env.example .env.local
# put your key in .env.local:
# OPENAI_API_KEY=sk-...
npm run dev

Open the URL Vite prints (usually http://localhost:5173).

Chat agent

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.

Modes

Single STL

Drop or open any .stl file.

Orthoslices (like view_idx.py --mode orthoslices)

Click Open orthoslices and select:

  1. CT multipage .tif / .tiff
  2. registered lattice .json
  3. missing-struts .csv
  4. optional green CT .stl for 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.

Defect overlay

  • 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:

  1. brian_ct_green.stl (exported)
  2. ideal registered lattice .json
  3. 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.stl

Then 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages