Skip to main content

Prints information about DICOM files.

Project description

dicom-info

CI Coverage Python Version Code style: ruff Type checking: mypy License: GPL v3

A command-line tool for displaying DICOM file information.

Description

dicom-info is a simple Python utility that reads and displays information from DICOM (Digital Imaging and Communications in Medicine) files. It provides a straightforward way to inspect DICOM file metadata from the command line, and can also display DICOM images interactively.

Requirements

  • Python >= 3.13
  • pydicom >= 3.0.1
  • matplotlib >= 3.7.0 (for image display)
  • numpy >= 1.24.0 (for image display)

Installation

Not required with uvx, use uvx to start using dicom-info straight away:

uvx dicom-info --help

To use uv as a more traditional package manager, i.e. download dicom-info locally before first use:

uv tool install dicom-info

or pip

pip install dicom-info

Usage

The basic syntax is:

dicom-info FILE [FILE ...]

Displaying Metadata

To display DICOM file metadata:

dicom-info path/to/file.dcm
dicom-info file1.dcm file2.dcm file3.dcm

The tool will display information for each DICOM file, including all available metadata and attributes.

Displaying Images

To display DICOM images interactively, use the --display or -d flag:

dicom-info --display path/to/file.dcm
dicom-info -d file1.dcm file2.dcm file3.dcm

Image display features:

  • 2D images: Displayed as grayscale plots with a colorbar
  • 3D images: Displayed with an interactive slider to navigate through slices
  • Multiple files: Each image is shown in its own subplot with the filename as the title

Error Handling

The tool will exit with status code 1 if:

  • Files are not found
  • Files are not valid DICOM files
  • When using --display, if no files contain pixel data

License

This project is licensed under the GNU GPL version 3 license which can be found here.

Development

Setup

This project uses uv for dependency management. To set up the development environment:

# Clone the repository
git clone https://github.com/sbu-physics-mri/dicom-info.git
cd dicom-info

# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install the package with dev dependencies
make install

Running Tests and Checks

This project uses a Makefile as the single source of truth for development commands. All commands can be run locally and are also used in CI.

# Run all CI checks (format, lint, type, coverage)
make ci

# Individual commands:
make lint      # Run ruff linting
make format    # Check code formatting
make type      # Run mypy type checking
make test      # Run pytest
make coverage  # Run tests with coverage report (80% minimum)

# Apply fixes:
make fix       # Auto-fix linting issues and apply formatting

CI/CD

The project uses GitHub Actions for continuous integration. On every pull request and push to main, the following checks run in parallel:

  • lint: Code quality checks with ruff
  • format: Code formatting validation
  • type: Type checking with mypy
  • test: Test suite with coverage (minimum 80%)

All checks must pass before merging.

Contributing

Contributions welcome! Please open an issue or submit a pull request.

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

dicom_info-0.4.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

dicom_info-0.4.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file dicom_info-0.4.0.tar.gz.

File metadata

  • Download URL: dicom_info-0.4.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dicom_info-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1a76d88e1d3041b17cc0a8af68a842bfa5d5fea9a27c467ec7f29311cca74759
MD5 64a72860180186779d4891fbb448814f
BLAKE2b-256 74c45c52ce43d5fc8b053dd4cb17c71abfbe48ae215139495bbb4e29a64a068e

See more details on using hashes here.

File details

Details for the file dicom_info-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: dicom_info-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dicom_info-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfcef7405085a7d853d39a29c92b2778641aa14f1822b21e5984d1894071e27
MD5 5d2414021a277bed6e3f8224ad612f72
BLAKE2b-256 7c2e1f1a9ef258ffd1c4c1f69cc5f738d28b298de63b37870fdff48aff57e405

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