Creates virtual CTs for testing the HDSS profile
  • Python 99.1%
  • PowerShell 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Christof Schadt 36af038bba
All checks were successful
CI / test (push) Successful in 1m31s
chore: change zooming
2026-09-25 15:35:23 +02:00
.forgejo/workflows CI: install Node.js before the JS actions, as dicom-gateway does 2026-09-02 00:35:50 +12:00
.vscode feat: initial submit 2026-03-30 06:28:38 +02:00
icon chore: add icon 2026-04-21 09:40:09 +02:00
src/ct_phantom chore: change zooming 2026-09-25 15:35:23 +02:00
tests fix: only export implicit little endian 2026-09-25 13:30:01 +02:00
.gitignore feat: initial submit 2026-03-30 06:28:38 +02:00
build.ps1 chore: add icon 2026-04-21 09:40:09 +02:00
LICENSE Initial commit 2026-03-28 18:58:38 +01:00
poetry.lock feat: add image tilt 2026-09-24 14:50:37 +02:00
pyproject.toml Add tests for (3006,004C) and a CI workflow 2026-09-01 20:03:55 +12:00
README.md feat: also export SD RT Structure Set 2026-09-25 12:47:57 +02:00

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-python in 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

  1. Clone the repository and open it in VS Code:

    git clone <repository-url> virtual-ct
    cd virtual-ct
    code .
    
  2. Create the virtual environment inside the project folder (.venv). The build script build.ps1 expects it there.

    py -3.13 -m venv .venv
    

    Poetry picks up an existing .venv in the project folder automatically. Alternatively, run poetry config virtualenvs.in-project true --local and let Poetry create it.

  3. Install the dependencies (including the dev group with pytest) from poetry.lock:

    poetry install
    
  4. 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 F5 and 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.