Collection of command line utilities to operate on DICOM data.
The tools are written entirely in Python (version >=3.6)
Download the repository and install required packages:
git clone "https://github.com/hirsch-lab/dicom-tools.git"
cd dicom-tools
python -m pip install -r "requirements.txt"
Build and install the package from source:
# Build package
python setup.py sdist
# Install
python -m pip install "dist/dicom-tools*.tar.gz"
This installs the below command-line tools.
dicom-copy-from-list -h
dicom-copy-headers -h
dicom-inventory -h
dicom-print-info -h
Note: it is possible to run the command-line utilities without installing the package.
# In the root directory of the project
python -m "dicom_tools.scripts.copy_from_list" -h
python -m "dicom_tools.scripts.copy_headers" -h
# ...
The following command-line utilities are availble after installing the dicom-tools package.
dicom-copy-from-list
dicom_tools.scripts.copy_from_list
dicom-copy-headers
dicom_tools.scripts.copy_headers
dicom-inventory
dicom_tools.scripts.create_inventory.py
dicom-print-info
dicom_tools.scripts.print_info
# Copy from a list of content
dicom-copy-from-list --in-dir "path/to/dicom/repository" \
--out-dir "path/to/output/" \
--list-file "path/to/list.csv"
# Copy headers.
dicom-copy-headers --in-dir "path/to/dicom/repository" \
--out-dir "path/to/output/"
# Print info about a DICOM file.
dicom-print-info --in-file "path/to/dicom/file-or-folder"
dicom-print-info --in-file "path/to/dicom/file-or-folder" --all
# Create a summary of a DICOM repository.
dicom-inventory --in-dir "path/to/dicom/repository" -v
Run the unitests with pytest. See also the file .coveragerc
for the settings of the code coverage analysis
pytest
# To see print statements, use the -s flag
pytest -s
# To see nicely formatted live logs, use the flag `--log-cli-level`
# Note: Don't confuse failing tests with error-logs.
pytest --log-cli-level="info"
# To assess code coverage (requires package pytest-cov)
pytest --cov \
--cov-config="./.coveragerc" \
--cov-report=html
The package uses type hints. For a static type check, install mypy and run the following command:
mypy "dicom_tools" --ignore-missing-imports --allow-redefinition
DICOM standard
DICOM dictionary browser
Pydicom (docs, api docs)
Python type checking