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

With uv:

uvx 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.3.0.tar.gz (25.0 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.3.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dicom_info-0.3.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.3.0.tar.gz
Algorithm Hash digest
SHA256 ea957fb5640d234e6e3d8be7911550131c805727b77c634d864f7f5885b153d3
MD5 8267836446fb6ef63c5c4e85715c899c
BLAKE2b-256 49406132ff323b85f7e46a24e81ee59f47e5e37603a6545fdea0da9a5a685072

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dicom_info-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16663e4280a50446e328482d6cf15205265e97adb1987b9cd9c5f44c7a47d835
MD5 0b96aa4751b0c75020752ab3152123fa
BLAKE2b-256 b9dd73d590f17f52bab884e24a3d3f0160668c065c381ca9e07625d6f0500c39

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