No project description provided
Project description
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
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dicomselect-0.11.1.tar.gz
.
File metadata
- Download URL: dicomselect-0.11.1.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f0261a2bee61bc8e161a61bb417e14bdd5f0e243aad7742bb059e14701454ba |
|
MD5 | 07d83090cda097ce0dbf36d86f52d7a2 |
|
BLAKE2b-256 | 79d12c652c1c855f491d2ab840ac341f1e59a6dbe2ec860c3b6596694c9b753a |
File details
Details for the file dicomselect-0.11.1-py3-none-any.whl
.
File metadata
- Download URL: dicomselect-0.11.1-py3-none-any.whl
- Upload date:
- Size: 71.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6043b30316f27cfbc1d4e0538ecf7c353c6fa7f116583c53d1f81b1080bf95c5 |
|
MD5 | c35c2b3c1786b1412d6a2af0e35a12c3 |
|
BLAKE2b-256 | d3b0bcc13829cb2bb452cb6f188009ba3707ea38c344956ec2d8f33ee232369b |