Skip to main content

Command line tool for dicom query and download

Project description

dicomtrolleytool

CI PyPI - Python Version Code style: black Checked with mypy

Command line tool to query and retrieve DICOM datasets

  • CLI frontend to dicomtrolley
  • Developed for debug and testing. Quick queries and downloads from command line
  • Convenient handling of login secrets using keyring

Why?

For testing and debugging DICOM server connections I kept creating single use, throw-away python scripts. This is annoying for three reasons:

  • Duplication: Copy-pasting code for each single query, files piling up.
  • Slowness: Creating a pyton file, running this is overhead each time.
  • Credential faff: Finding the right credentials and safely including them in this script for each single query.

dicomtrolleytool solves these three issues.

Development - Alpha

Nov 2023: This is a personal tool. I try to keep it clean and tested enough to continue developing, but expect NotImplementedError, incomplete coverage, incomplete docs, missing parameters. If this tool containue to work for me I might make an effort and clean up.

Installation

pip install dicomtrolleytool

Setup

NOTE: this whole section is not implemented yet (feel free to step in). The actual current method of setting up channels is:

  • Install keyring (see 'handling credentials' below)
  • Look at /examples/persist_connection, fill in and run
  • Manually edit your settings file trolley settings edit to add your channel to the channels list.

A channel is ready-to use communication channel including password. This needs to be saved to a secure location. To this end the channel information is first entered into a file, which is then stored in a secure location using the store command.

trolley channel new <type>
# Creates a new empty channel file
# Add data to this file, then:
trolley channel store <template_file>
shred -d <template_file>

Handling credentials

intall keyring. Works great. But installation can be a bit fiddly because it has to link to your OS secret store. I've only tested this

For me the magic installation string (tested on on ubuntu 20,22,24) was:

pip install secretstorage dbus-python keyring

But this could definitely be just my system.. Just search for it

When that works, you need to write your dicomtrolley channels into your secret store For this, look at /examples/persist_connection. Would be great to have a cli command for this like trolley credentials add -f <json file> but there isn't. Feel free to add.

Usage

You can used the keyword trolley from the command line.

Some examples:

> trolley query suid 12345                     # simple query
> trolley query suid 12345 324345 345345       # query multiple
> trolley query patient_id 1234
> trolley download suid 12345


Query levels

You can get series level information like this:

> trolley query suid 123 --query-level Series

Filtering output

You can restrict the output using --output-fields

> trolley -v query acc 1234 --query-level INSTANCE --output-format TABLE --output-fields ProtocolName,SeriesInstanceUID,PatientID

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

dicomtrolleytool-0.6.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

dicomtrolleytool-0.6.1-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file dicomtrolleytool-0.6.1.tar.gz.

File metadata

  • Download URL: dicomtrolleytool-0.6.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1014-azure

File hashes

Hashes for dicomtrolleytool-0.6.1.tar.gz
Algorithm Hash digest
SHA256 b6b52191adfb226fea3959df3ce0c730543d0f2b41f3edcfe4eac0822c4742c7
MD5 afbe98f97d592964f94fe97ef6064d0b
BLAKE2b-256 93c905da353d0a205e269600ce1a60e25880484926fbb21c6dda9164dd7ab157

See more details on using hashes here.

File details

Details for the file dicomtrolleytool-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: dicomtrolleytool-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1014-azure

File hashes

Hashes for dicomtrolleytool-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c7effaf7c138db052942a4f762e962723c379882974fba5b9f7717dab9615b
MD5 d119a87f5b9049cc8068306e078ca4d0
BLAKE2b-256 acbb4732294faeace2d55fbb63c5a4ec07d4b310692dd7cae91295de45602c2b

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