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.
Before you begin
Section titled “Before you begin”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.
1. Install
Section titled “1. Install”Install the command-line tool with MCP support from the source repository:
uv tool install "dicom-standard-kb[mcp] @ git+https://github.com/beatrice-b-m/dicom-standard-kb"dicom-kb --helpSee Install dicom-standard-kb for a source checkout and other options.
2. Fetch the standard
Section titled “2. Fetch the standard”dicom-kb fetchfetch 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-kbNext: dicom-kb build --edition 2026dYour edition label will differ once NEMA publishes a newer one.
3. Build the knowledge base
Section titled “3. Build the knowledge base”dicom-kb buildbuild 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.sqlite5310 data elements, 492 UIDs, 192 IODs, 414 modules, 306 macros, 184 SOP Classes400 gaps logged (PS3.16 396, PS3.17 2, PS3.3 2): /home/you/.cache/dicom-standard-kb/db/2026d.gaps.txtGaps are places where the source has a shape the parsers skip. They do not stop the build; Coverage and limits explains what they mean.
4. Ask a question
Section titled “4. Ask a question”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.
Next steps
Section titled “Next steps”- Connect an MCP client so an agent can use the same seven tools.
- Answer DICOM questions shows which command or tool fits each kind of question.
- CLI reference lists every command and option.