Segment the patient’s vertebrae from a CT, on your own computer
ScolioSim can draw the model with the patient’s own vertebrae, taken from a segmentation of their CT. The segmentation is made with TotalSegmentator, an open tool from the University Hospital Basel. Installed on your computer from ScolioSim itself, on Windows, macOS or Linux, it takes a CT of any size, and the CT never leaves your computer.
TotalSegmentator is not a medical device, and neither is ScolioSim. The segmentation and its use are your responsibility, as with every other measurement you make in ScolioSim.
What your computer needs
The time it takes depends above all on the graphics card. TotalSegmentator uses an NVIDIA card (or the graphics of a Mac with Apple silicon); with anything else it runs on the processor, which works but is slow.
| For reasonable times | It still works | |
|---|---|---|
| Graphics | NVIDIA card with 8 GB of memory or more, driver up to date; or a Mac with Apple silicon (M1 or later) | None: the processor does the work, slowly |
| Memory (RAM) | 16 GB or more | Less, with the 3 mm model (--fast) |
| System | Windows 10 or 11 (64-bit), Linux, or macOS | Intel Macs: processor only, not tested |
| Disk | About 15 GB free, for the programs and the model weights | |
| Internet | To install it, and the first time it runs (it downloads the model weights once) | |
The authors of TotalSegmentator give these figures for their whole model, all 117 structures, on an NVIDIA RTX 3090: (TotalSegmentator)
| CT size | 1.5 mm model: time | RAM | Graphics memory | 3 mm model: time | RAM | Graphics memory |
|---|---|---|---|---|---|---|
| 512 × 512 × 280 | 1 min 17 s | 7.6 GB | 6.1 GB | 34 s | 7.4 GB | 5.2 GB |
| 512 × 512 × 458 | 2 min 49 s | 10.6 GB | 8.5 GB | 53 s | 8.4 GB | 7.4 GB |
| 512 × 512 × 824 | 3 min 32 s | 11.8 GB | 11.4 GB | 1 min 23 s | 10.6 GB | 7.5 GB |
ScolioSim asks only for the vertebrae from T1 to the sacrum, which in TotalSegmentator’s words “saves a lot of runtime and memory”. On the processor its authors advise exactly that, or the 3 mm model. (TotalSegmentator) On a laptop processor (Intel Core Ultra 9 185H, no NVIDIA card), with the weights already downloaded, we timed 2.3 min for a 512 × 512 × 336 series of 1 mm slices covering 34 cm (TotalSegmentator’s public example CT, resampled to that size) with the computer otherwise idle, and about 5 min with other programs keeping the processor busy. A CT from T1 to the sacrum is longer and takes longer.
On an NVIDIA RTX 4060 with 8 GB, a real lumbar spine CT of 1,437 slices 0.4 mm apart (57 cm) was segmented in 73 s, about 30 s of it prediction. The whole run took 2.9 min, from a study of more than 6,000 files: the rest is reading their headers, setting the series aside and converting it. The first time it took 5.3 min, because it also downloads the model weights (about 1.3 GB, once).
The simple way: the ScolioSim helper
Everything is done from ScolioSim itself, in X-rays, under The patient’s own vertebrae: installing TotalSegmentator, choosing the CT, segmenting it, correcting it, and removing it all when you no longer want it. A browser cannot install or start programs, so that part is done by a small helper that you install once. It works the same on Windows, macOS and Linux; only installing it differs.
Windows
- Get the ScolioSim helper from the Microsoft Store. It is free, installs for you alone, and the Store keeps it updated.
- Where the Store is blocked, as on many hospital computers, download the installer and open it instead: it installs without administrator rights, in about a minute. Windows may say Windows protected your PC, because the installer is not signed with a paid certificate: click More info and then Run anyway.
- Back in ScolioSim, click Connect to the helper. When Chrome asks whether the site may reach apps on this device, allow it: that is how the page talks to the helper.
- ScolioSim shows what your computer has and installs TotalSegmentator with one button. Then choose the CT (the CD folder or its ZIP): the page reads the headers, proposes the series and, once segmented, shows you the vertebrae to check. If two vertebrae come out mixed, or a piece sits in the wrong one, correct it there, slice by slice, before keeping them.
macOS
- Download the ScolioSim helper for Mac and open it: double-click the ZIP if the Mac has not unzipped it, then ScolioSim Helper Installer. It installs for you alone, without administrator rights, in a minute or two (it downloads its own small Python), with a window to start, one while it works and one at the end, as on Windows.
- The first time, macOS says it cannot verify the installer: the helper is free and not signed by Apple. Close that message, open System Settings, Privacy & Security, and near the bottom click Open Anyway beside ScolioSim Helper Installer; confirm it (macOS may ask for your Mac’s password).
- Back in ScolioSim, click Connect to the helper, and go on as on Windows (steps 3 and 4). The first time the page starts the helper again, after half an hour without use, the browser asks whether to open ScolioSim Helper: allow it.
If you prefer not to download anything, the same installation is done by this line, pasted in Terminal (in Applications, Utilities), and then macOS asks nothing; ScolioSim shows it too, with a button to copy it:
On a Mac with Apple silicon (M1 or later) TotalSegmentator uses its graphics, and where they cannot manage a step, the processor takes over. On an Intel Mac it runs on the processor, and it has not been tested there. To update the helper, open the installer again (or paste the line again): TotalSegmentator stays installed.
Linux
- Open a terminal (Ctrl+Alt+T on most desktops), paste the same line and press Enter. It installs the helper for you alone, in a minute or two, without administrator rights and without asking for a password, and starts it. When it says it is done, close the window.
- Back in ScolioSim, click Connect to the helper, and go on as on Windows (steps 3 and 4).
On Linux TotalSegmentator uses an NVIDIA card if there is one, and the processor if not. To update the helper, paste the same line again.
On every system
The helper listens only on your own computer (address 127.0.0.1) and answers only the ScolioSim site. The CT goes from the browser to the helper inside the same computer; nothing of it reaches a server. It stops by itself after half an hour without use, and ScolioSim starts it again when needed. It works in Chrome and Edge on a desktop computer; Safari may not let a web page reach it. To remove it: Uninstall the helper in ScolioSim, which removes TotalSegmentator, its model weights and its Python too. On Windows it is also in Settings, Apps, ScolioSim Helper; on a Mac or Linux, in Terminal, sh ~/Library/Application\ Support/ScolioSim/Helper/uninstall.sh (macOS) or sh ~/.local/share/scoliosim/helper/uninstall.sh (Linux). Its code can be read before installing it: scoliosim_helper.py, worker.py and, for macOS and Linux, helper-install.sh.
With a command (Windows, macOS, Linux)
For those who prefer to work in a terminal, without the helper: the result is a file that you bring into ScolioSim yourself.
Windows
Open PowerShell (Start menu, type PowerShell) and paste this line. It needs no administrator rights.
From the Command Prompt (cmd) instead, this one:
macOS and Linux
Open Terminal and paste this line.
The installer, which you can read before running it (install.ps1, install.sh, scoliosim_segment.py):
- installs uv, a Python manager from Astral, which brings its own Python, apart from any you already have;
- installs TotalSegmentator and PyTorch, in the build for NVIDIA cards if it finds one, and in the one for the processor if not;
- adds the ScolioSim program that picks the series and runs the segmentation, the command
scoliosim-segmentand, on Windows, a file on the desktop, ScolioSim - segment a CT, to drop a CT on; - keeps it all in one folder (
%LOCALAPPDATA%\ScolioSim\segmenton Windows,~/.scoliosim/segmenton macOS and Linux). To remove it, delete that folder and the file on the desktop.
Segment a CT
On Windows, drop the CT folder or ZIP on ScolioSim - segment a CT on the desktop. Anywhere, in a terminal: scoliosim-segment, a space, and drag the folder or ZIP onto the window.
Give it the CT as it came: the CD, the folder exported from the viewer, or the ZIP, whatever its size and however many series it holds. It reads only the headers, says which series it found, picks one, copies only that one aside and segments it. The result is one file, …-vertebrae.nii.gz, written beside the CT (or in Documents/ScolioSim segmentations when that place cannot be written to, as on a CD). Load it in ScolioSim, in X-rays, under The patient’s own vertebrae.
Which series it takes, and why
A CT study usually holds several series: the scout, reconstructions with a bone kernel and with a soft-tissue kernel, thin and thick slices, coronal and sagittal reformats. The vertebrae need one, and the program picks it with these rules, printing the list and the reason each series was left out:
- Left out: anything that is not CT; the scout (localizer); coronal and sagittal reformats (it takes series axial within 30°, as ScolioSim’s own CT reader); series of fewer than 30 slices; slices more than 5 mm apart.
- First, the length: the series that covers most of the spine. A series that covers much less is a worse choice however thin its slices are.
- Then the slices: 1.5 mm apart or less, the resolution of TotalSegmentator’s normal model. Thicker ones are accepted, with a warning: the vertebrae come out coarser.
- Then the kernel: a standard or soft-tissue kernel before a bone or lung one, which is noisier. This is only a preference of ours, to break a tie.
To see the list without segmenting, add --list. To take another series, add --series and its number in the list, for example scoliosim-segment D:\ --series 3.
The CT itself is best when it shows the whole spine, from T1 to the sacrum: ScolioSim only has the patient’s vertebrae that the CT shows, and draws the rest with its reference models.
Other options
--fast: the 3 mm model. Much quicker and lighter, with coarser vertebrae. For a computer without an NVIDIA card, or one that runs out of memory.--cpu: the processor, even with a graphics card.--outand a folder: where to write the result.
Privacy
The CT is read and segmented on your computer, and nothing of it is sent anywhere, to ScolioSim or anyone else. The only things downloaded are the programs, while installing, and the model weights, once, from the TotalSegmentator releases on GitHub. TotalSegmentator sends anonymous usage statistics by default (no images, no patient data); the ScolioSim program turns them off. (TotalSegmentator)
The result file holds only the label map: no name or data of the patient.
If something goes wrong
- It says it found no series that suits: look at the reasons in the list, and pick one with
--seriesif you know better. - Out of memory on the graphics card: close other programs and try again, or use
--fast. - You have an NVIDIA card but it says it runs on the processor: update the NVIDIA driver and run the installer again.
Measure, plan and simulate on your own radiographs, in the browser. Nothing about a patient or a case is stored on a server.
Open ScolioSim — freeReferences
- Wasserthal J, Breit HC, Meyer MT, et al. (2023). TotalSegmentator: robust segmentation of 104 anatomic structures in CT images. Radiol Artif Intell 5(5):e230024. doi:10.1148/ryai.230024. Code, figures and licence (Apache-2.0; the task used here is open for any use): github.com/wasserth/TotalSegmentator.