Extracts DICOM information from files into a single sqlite file
pip install dicomindex
To recursively read all DICOM files in /path/to/folder
and add patient/study/series objects to index.
dicomindex index_full /tmp/myindex.sql /path/to/folder
For big file collections over slow connections, indexing all files can easily take weeks. Annoying. You could use this to for a faster index:
dicomindex index_per_folder /tmp/myindex.sql /path/to/base_folder
This will find a single DICOM file to index in each folder recursively. This speeds up indexing significantly, but assumes
base_folder
contains sub-folders that are structured in a patient/series/study way.
I've indexed this folder. Now what?
dicomindex stats /path/to/folder
- Install datasette
- From commandline, run
datsette /tmp/myindex.sql
Query the db file directly using dicomindex sqlalchemy ORM:
from dicomindex.orm import Study
from dicomindex.persistence import SQLiteSession
with SQLiteSession("/tmp/archive.sql") as session:
studies = session.query(Study).all()
print(f"found {len(studies)} studies")
dicomindex will not do the following:
- DICOM data exploration and sanitizing legacy archives
- Messy, semi-structured data, 'archives' that are just collections of folders with DICOM files in them