- Python 99.1%
- PowerShell 0.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| .vscode | ||
| icon | ||
| src/ct_phantom | ||
| tests | ||
| .gitignore | ||
| build.ps1 | ||
| LICENSE | ||
| poetry.lock | ||
| pyproject.toml | ||
| README.md | ||
Virtual Phantom CT Generator
This application allows to create a virtual CT data set using an arbitrary resolution with defined geometric shapes inside.
Features
It is possible to
- create a virtual ct volume with a specific x, y and z resolution and Hounsfield units.
- transversal planes
- sheared planes
- tilted Frame of Reference
- define a set of defined geometric shapes (cone, pyramid, cube, sphere, torus ...), their position, orientation and Hounsfield units.
- have enclosing contours created for these shapes.
- export CT image series with a defined resolution (the same or lower than the virtual CT data set)
- export a high-resolution RT Structure Set, according to the IHE-RO HDSS profile.
- optionally also export a standard-definition RT Structure Set according to IHE-RO BRTO (contours only on the CT image planes), to see what gets lost compared to HDSS.
- export an RT Dose instance with a 1.0Gy inside the geometric shapes.
Getting Started
The steps below assume Windows, PowerShell and Visual Studio Code.
Prerequisites
- Git
- Python 3.13 or 3.14 (see
requires-pythonin pyproject.toml) - Poetry 2.x, e.g. via
pipx install poetry - VS Code with the extensions Python (
ms-python.python) and Python Debugger (ms-python.debugpy)
Setup
-
Clone the repository and open it in VS Code:
git clone <repository-url> virtual-ct cd virtual-ct code . -
Create the virtual environment inside the project folder (
.venv). The build script build.ps1 expects it there.py -3.13 -m venv .venvPoetry picks up an existing
.venvin the project folder automatically. Alternatively, runpoetry config virtualenvs.in-project true --localand let Poetry create it. -
Install the dependencies (including the dev group with pytest) from
poetry.lock:poetry install -
Select the interpreter in VS Code:
Ctrl+Shift+P→ Python: Select Interpreter →.\.venv\Scripts\python.exe. New terminals in VS Code then activate the venv automatically.
Run and Debug
-
In VS Code, press
F5and choose the launch configuration Debug ct_phantom (defined in .vscode/launch.json). -
Or from the terminal:
poetry run python src/ct_phantom/main.py
Tests
poetry run pytest
The tests can also be run from the VS Code Testing view once pytest is enabled as the test framework.
Build a Standalone Executable
.\build.ps1
This uses Nuitka to create virt_ct_phantom.exe in dist\. Version and product information
are read from src/ct_phantom/version.py. A C compiler is required;
Nuitka offers to download one on first use if none is found.
Icon
Icon created by Hilmy Abiyyu A. - Flaticon.