Skip to content

Getting started

This walkthrough installs dicom-kb, downloads the current DICOM Standard from NEMA, builds a local SQLite knowledge base, and answers a question from it. The download is about 130 MB and the build takes a minute or two. After that, everything runs offline.

You need Python 3.12 or newer, uv, network access to dicom.nema.org, and about 250 MB of free disk space for the source files and the database.

Install the command-line tool with MCP support from the source repository:

Terminal window
uv tool install "dicom-standard-kb[mcp] @ git+https://github.com/beatrice-b-m/dicom-standard-kb"
dicom-kb --help

See Install dicom-standard-kb for a source checkout and other options.

Terminal window
dicom-kb fetch

fetch reads the current edition’s label from NEMA and downloads the DocBook XML of all 20 published parts into ~/.cache/dicom-standard-kb/. It finishes with the edition it found:

Fetched DICOM 2026d: 20 parts, 129.8 MB in /home/you/.cache/dicom-standard-kb
Next: dicom-kb build --edition 2026d

Your edition label will differ once NEMA publishes a newer one.

Terminal window
dicom-kb build

build uses the newest fetched edition and writes ~/.cache/dicom-standard-kb/db/<edition>.sqlite. It ends with a summary like this:

Built DICOM 2026d KB: /home/you/.cache/dicom-standard-kb/db/2026d.sqlite
5310 data elements, 492 UIDs, 192 IODs, 414 modules, 306 macros, 184 SOP Classes
400 gaps logged (PS3.16 396, PS3.17 2, PS3.3 2): /home/you/.cache/dicom-standard-kb/db/2026d.gaps.txt

Gaps are places where the source has a shape the parsers skip. They do not stop the build; Coverage and limits explains what they mean.

Terminal window
dicom-kb element "Pixel Spacing"

The answer is markdown: the element’s VR and VM, the modules and macros that use it with their Type, and a closing Source: line naming the tables it came from. Every query command uses the newest built edition unless you pass --edition.