Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dicomselect-0.11.0.tar.gz (70.9 kB view details)

Uploaded Source

Built Distribution

dicomselect-0.11.0-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

Details for the file dicomselect-0.11.0.tar.gz.

File metadata

  • Download URL: dicomselect-0.11.0.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.1

File hashes

Hashes for dicomselect-0.11.0.tar.gz
Algorithm Hash digest
SHA256 22d3193545f0d090f2e87c16d6497159fa4903b10258c769ad32b42caa94fe2a
MD5 cb11803e9eebe63b8badcebd286132c7
BLAKE2b-256 b785968d333721851dbd745f08dcedb8710438c09750b72a4d78435d14f3deb8

See more details on using hashes here.

File details

Details for the file dicomselect-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dicomselect-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5a7668196c3ced2f2102c29c8ca49f07aa30cdf15af85f1f6f5855908a5c74c
MD5 075d3fcf56b4b33692e6b4e944583046
BLAKE2b-256 c0bfe248d64c4110487b6ac0ce9ece2f419f19ef3a14b3339b270863405efaeb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page