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-1.0.0.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dicomselect-1.0.0-py3-none-any.whl (72.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dicomselect-1.0.0.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for dicomselect-1.0.0.tar.gz
Algorithm Hash digest
SHA256 99435ee57cff98d5c726d067afc6563b63fc58b5cc58e1a9cbdf29a282e5b0d5
MD5 3eb89115c58410525b9b4f83dd00da34
BLAKE2b-256 7354f05018841a13a6efaf2e724c443fd74091d084b2d556b46fc46dcaf54e2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dicomselect-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 72.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for dicomselect-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44f5090eb3e7601f17161fb1a08719c2bed11da35994a24f9ad9e51474458bf5
MD5 95289d7a7a0cbb1be54d691820034ab8
BLAKE2b-256 edf5a274dd8f9542d8c355c85390742f1fd5a067a5188dad991b6b491da9bab0

See more details on using hashes here.

Supported by

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