dicom-meta-lite
dicom-meta-lite is a lightweight Python utility for extracting essential metadata from DICOM medical imaging files (CT, MRI, X-ray, PET, etc.) without requiring heavy medical imaging frameworks.
It is ideal for machine learning pipelines, research, radiomics preprocessing, dataset cleaning, and oncology workflows.
✨ Features
- Extracts key DICOM metadata in a single function call
- Lightweight (minimal dependencies)
- Returns clean Python primitives (not pydicom objects)
- Optional patient anonymization
- Folder batch processing
- Designed for ML preprocessing and dataset inspection
🚀 Installation
Install via pip:
pip install dicom-meta-lite
You must also have pydicom:
pip install pydicom
📌 Usage
Extract metadata from a single DICOM file:
from dicom_meta_lite import extract_meta
meta = extract_meta("scan.dcm")
print(meta)
Example output:
{
"PatientID": "12345",
"Modality": "CT",
"StudyDate": "20240513",
"Manufacturer": "SIEMENS",
"Rows": 512,
"Columns": 512,
"PixelSpacing": [0.5, 0.5],
"SliceThickness": 1.2
}
Extract only selected keys:
extract_meta("scan.dcm", keys=["PatientID", "Modality"])
Remove sensitive identifiers:
extract_meta("scan.dcm", anonymize=True)
Removes fields such as:
- PatientName
- PatientBirthDate
- InstitutionName
Batch process a folder of DICOM files:
from dicom_meta_lite import extract_folder
results = extract_folder("dicom_folder/")
print(results)
🔬 Why this library?
Medical imaging datasets contain important metadata used for:
- Image normalization (pixel spacing, slice thickness)
- Quality checks
- Machine learning model preprocessing
- Radiotherapy planning research
- Oncology research pipelines
Existing tools (pydicom, highdicom, MONAI) are powerful but heavy for simple metadata extraction.
dicom-meta-lite gives you the essentials in seconds.
📦 Default extracted tags
By default, the library extracts:
- PatientID
- StudyDate
- Modality
- Manufacturer
- Rows
- Columns
- PixelSpacing
- SliceThickness
Custom keys are supported.
🧠 Use Cases
- ML model preprocessing
- Dataset cleaning & inspection
- Radiomics feature pipelines
- Medical research automation
- Oncology imaging workflows
🛡️ Privacy Notice
With anonymization enabled, this package removes identifiers commonly used in DICOM headers. However, compliance depends on your dataset and jurisdiction.
For sensitive projects, consult your institution’s IRB or DPO.
📁 Project Structure
dicom-meta-lite/
│ README.md
│ setup.cfg
│ pyproject.toml
│ LICENSE
│
└── dicom_meta_lite/
__init__.py
core.py
🗺️ Roadmap
Future versions will add:
- JSON export support
- CSV metadata export
- CLI (
dicom-meta file.dcm) - Tag description mapping
- Handling nested tag structures
Community contributions are welcome.
🧩 Requirements
- Python >= 3.8
- pydicom >= 2.4.0
👤 Author
Rusheel Sharma GitHub: https://github.com/Rusheel86 LinkedIN : https://www.linkedin.com/in/rusheel-sharma-0a8b70280/
📄 License
This project is licensed under the MIT License — see LICENSE for details.
⭐ Support the Project
If this package helps your research or ML workflow, please consider:
- Leaving a star on PyPI/GitHub
- Citing it in your project
- Sharing with classmates
Every bit of community visibility helps!
Metadata
Release files for dicom-meta-lite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dicom_meta_lite-0.1.0.tar.gz | 4.4 kB | Without provenance | Details for dicom_meta_lite-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dicom_meta_lite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dicom_meta_lite-0.1.0-py3-none-any.whl |
Total release size: 9.3 kB
Release files / dicom_meta_lite-0.1.0.tar.gz
| Download URL | dicom_meta_lite-0.1.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d316bece8044ade77f3d1c986aa4b30b49033a3b8dd7575d0c7afaca2f459795
|
|
BLAKE2b-256 checksum How to use checksums |
5e8c05a02f7a0bc64b4fda6eebb8448ab81b59eab56acb355dde77af79e6fdc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / dicom_meta_lite-0.1.0-py3-none-any.whl
| Download URL | dicom_meta_lite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80931c698d1afc0f3af9a95fc7582d3dcb320e19c6e2b25ff075cfafcc014c45
|
|
BLAKE2b-256 checksum How to use checksums |
b974982485959482164744d952e012ca8176d3ad1be994f1c0948ed936cd58df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for dicom-meta-lite 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.