Skip to main content

Simple python dicom toolkit.

Project description

spydcmtk

Simple PYthon DiCoM Tool Kit

Dicom organisational, querying and conversion toolkit

spydcmtk is a pure Python package built on top of pydicom.

This package extends pydicom with a class structure based upon the Patient-Study-Series-Image hierarchy. In addition, it provides a number of built in routines for common actions when working with dicom files, such as human readable renaming, anonymisation, searching and summarising.

Version

Current is VERSION 1.1.4 Release.

1.1.4: Additional configuration moved to config file. DCM2VTI active. 1.1.1: Add option to keep private tags when running anonymisation. Dcm2nii path configurable from config file. 1.1.0: Some bug fixes and restrict the use of dicom to vti (WIP) 1.0.0: Initial Release

Installation

Using pip:

pip install spydcmtk

Quick start

If you installed via pip then spydcmtk console script will be exposed in your python environment.

Access via:

spydcmtk -h

to see the commandline useage available to you.

If you would like to incorporate spydcmtk into your python project, then import as:

import spydcmtk

listOfStudies = spydcmtk.dcmTK.ListOfDicomStudies.setFromDirectory(MY_DICOM_DIRECTORY)
dcmStudy = listOfStudies.getStudyByDate('20230429') # Dates in dicom standard string format: YYYYMMDD
dcmSeries = dcmStudy.getSeriesBySeriesNumber(1)
dcmStudy.writeToOrganisedFileStructure(tmpDir, anonName='Not A Name')

Configuration

spydcmtk uses a spydcmtk.conf file for configuration.

By default spydcmtk.conf files are search for in the following locations:

  1. source_code_directory/spydcmtk.conf (file with default settings)
  2. $HOME/spydcmtk.conf
  3. $HOME/.spydcmtk.conf
  4. $HOME/.config/spydcmtk.conf
  5. Full file path defined at environment variable: "SPYDCMTK_CONF"
  6. Full path passed as commandline argument to spydcmtk

Files are read in the above order with each subsequent variable present overwritting any previously defined. For information on files found and variables used run:

spydcmtk -INFO

Documentation

Clear documentation of basic features can be seen by running the "spycmtk -h" command as referenced above.

For detailed documentation please see wiki

Some format conversions are provided by this package:

Dicom to Nifti

Relies on dcm2niix, which must be installed and in path (or set in config file).

Dicom to HTML

Will build a standalone .html file to display dicom series in ParaView Glance renderer.

Dicom to VTK

A dicom to vtk format conversion is provided. See VTK format documentation here.

Format conversions are:

  • dicom to image data (vti format). Suitable for 3D image volumes. This format is axis aligned (there is no embedded transformation). But "Field Data" embedded in the file are included as "ImageOrientationPatient" which, along with the Image Origin and Image Spacing methods can be used to construct a transformation matrix allowing conversion form image to real world coordinate space.

  • WORK IN PROGRESS: dicom to structured dataset (vts format).

  • WORK IN PROGRESS: dicom to planar dataset (vtp format).

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

spydcmtk-1.1.4.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

spydcmtk-1.1.4-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file spydcmtk-1.1.4.tar.gz.

File metadata

  • Download URL: spydcmtk-1.1.4.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for spydcmtk-1.1.4.tar.gz
Algorithm Hash digest
SHA256 e40e8d3ec567fb9ecffa7bf5492faef232948a614ee2e73656bf912dfd614f5c
MD5 7a52d034cc403cc6122bd2cc66bc9c2d
BLAKE2b-256 6559dac863f38783782e0ad422816ec9adea799f777c0bcd9514a365503fe2ce

See more details on using hashes here.

File details

Details for the file spydcmtk-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: spydcmtk-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for spydcmtk-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7b3fd11915bcbefbfd6f9b5b2e2aa0abcd0606b32d4a128aff68b9c710926e95
MD5 75e2ce5340e2491b07c1fdb817f46982
BLAKE2b-256 af677a86e4b8682f2a52c9b7819cc7145670b8f37b66454a2b0c6d1fa08eadee

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