dicomselect: DICOM database and conversion software
dicomselect is a Python tool that simplifies the process of creating SQLite databases from directories containing .dcm files. Once the database is created, you can easily perform SQL-like queries on the data directly within Python. Additionally, dicomselect allows you to convert query results into various file formats supported by SimpleITK, providing flexibility in working with your DICOM data.
Installation
Python 3.10 or higher. You can install this project using pip. If you haven't already, it's recommended to create a virtual environment to isolate project dependencies.
pip install dicomselect
Documentation
Read the documentation.
Example
Clone this repo, install dicomselect, then run this example in the repo.
from dicomselect import Database
from pathlib import Path
db_path = Path('tests/output/example.db')
db_path.parent.mkdir(exist_ok=True)
# initialize the Database object with a path to the to-be-created SQLite database file
db = Database(db_path)
# create the .db file, using test data as the input directory.
db.create('tests/input/ProstateX', max_workers=4)
with db as query:
# we only want to convert images with patient_id "ProstateX-0000" and image_direction "transverse"
query_0000 = query.where('patient_id', '=', 'ProstateX-0000'
).where('image_direction', '=', 'transverse')
# print out a detailed extraction of our query
print(query_0000)
# initialize the Plan object, with a template of DICOM headers for our conversion
# (note: dcm to dcm conversion is possible, if you only need restructuring of your data)
plan = db.plan('{patient_id}/prostateX_{series_description}_{instance_creation_time}', query_0000)
# ensure these properties are set
plan.target_dir = 'tests/output/example'
plan.extension = '.mha'
plan.max_workers = 4
# print out a detailed structure of our intended conversion
print(plan.to_string())
plan.execute()
Check out the results in tests/output/example.
License
This project is licensed under the Apache License 2.0. See LICENSE for details.
Release files for dicomselect 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dicomselect-1.0.1.tar.gz | 75.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dicomselect-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 153.2 kB
Release files / dicomselect-1.0.1.tar.gz
| Download URL | dicomselect-1.0.1.tar.gz |
|---|---|
| Size | 75.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1003c58b509a76512d4785a89875220f48b0011b2f2f3472569325163131bf45
|
|
BLAKE2b-256 checksum How to use checksums |
6d4f41ec5cf85d43aded257e537b0a5c3f360bb52b04bcf61a7dfaa46f1c908f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / dicomselect-1.0.1-py3-none-any.whl
| Download URL | dicomselect-1.0.1-py3-none-any.whl |
|---|---|
| Size | 77.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1af49130cd235729c5a1622efdc23b7213974110b381522fa29f5d0e7fa373f
|
|
BLAKE2b-256 checksum How to use checksums |
350be3f2cbf5f1c8ecf4ffe9264f307998cc693897abd6ffa1305fa9bffb4dc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|