A lightweight Python viewer for .BPT tomography files, with support for:
- axial, coronal, and sagittal MPR
- frontal MIP
- curved panoramic reconstruction (curved MPR)
- brightness/contrast adjustment
- visual Z aspect adjustment
- movable panel dividers
- export of rendered slices
- Structured
.BPTparser - Async volume loading with responsive UI
- Axial / Coronal / Sagittal views
- Frontal MIP view
- Curved panoramic reconstruction from user-defined spline
- Crosshair toggle
- Per-slice export (axial, coronal, sagittal)
- Window/level controls
- Resizable split panes
Install dependencies with:
pip install numpy imagecodecs Pillow scipyOr from requirements.txt:
pip install -r requirements.txtRun without arguments to choose a file manually:
python bpt_viewer.pyRun with a .BPT file path:
python bpt_viewer.py path/to/exam.bptThis project includes a parser for the .BPT container layout observed during development.
Observed structure:
-
64-byte header (
16 × uint32, little-endian) -
first JPEG slice stored without a size prefix
-
remaining slices stored as:
[uint32 little-endian size][JPEG payload]
-
optional undocumented trailing bytes after the last slice
Mapped header fields:
| Index | Field | Type |
|---|---|---|
h[6] |
width |
uint32 |
h[7] |
height |
uint32 |
h[8] |
num_slices |
uint32 |
h[9] |
spacing_x |
float32 LE |
h[10] |
spacing_y |
float32 LE |
h[11] |
spacing_z |
float32 LE |
h[15] |
first slice length | uint32 |
Rendering and click mapping use the same geometry function, which keeps interaction consistent across panels.
The frontal MIP follows the same internal display convention used by coronal and sagittal views, keeping crosshair and click mapping aligned.
The panoramic view is reconstructed from a spline drawn in the axial view and sampled in physical space, using interpolated slab MIP along the curve.
The viewer exposes a visual Z aspect control for display.
The default display preset is 1.5×, while the physical aspect ratio derived from spacing is still tracked internally.
- The implementation is based on the
.BPTstructure observed in this project. Other.BPTvariants may not work. - Panoramic reconstruction runs on the UI thread and may briefly pause the interface on larger volumes.
- The panoramic window does not auto-update when window/level changes; it must be recalculated.
- No distance measurement tools are included.
- No keyboard shortcuts are currently implemented.
This project is a personal/technical viewer for .BPT tomography files.
It is:
- not a certified medical workstation
- not intended for official clinical diagnosis
- not a replacement for approved medical imaging software
MIT
For a Portuguese version of this documentation, see:
README.pt-BR.md