Utils for gathering, aggregation and handling metadata from DICOM files.
Installation
From pip
pip install dicom-csv
or from GitHub
git clone https://github.com/neuro-ml/dicom-csv
cd dicom-csv
pip install -e .
Example join_tree
>>> from dicom_csv import join_tree
>>> folder = '/path/to/folder/'
>>> meta = join_tree(folder, verbose=2)
>>> meta.head(3)
| AccessionNumber | AcquisitionDate | ... | WindowCenter | WindowWidth |
|---|---|---|---|---|
| 000002621237 | 20200922 | ... | -500.0 | 1500.0 |
| 000002621237 | 20200922 | ... | -40.0 | 400.0 |
| 000002621237 | 20200922 | ... | -500.0 | 1500.0 |
| 3 rows x 155 columns |
Example load 3D image
from a series of dicom files (each containing 2D image)
from dicom_csv import join_tree, order_series, stack_images
from pydicom import dcmread
from pathlib import Path
# 1. Collect metadata from all dicom files
folder = Path('/path/to/folder/')
meta = join_tree(folder, verbose=2)
# 2. Select series to load
uid = '...' # unique identifier of a series you want to load,
# you could list them by `meta.SeriesInstanceUID.unique()`
series = meta.query("SeriesInstanceUID==@uid")
# 3. Read files & combine them into a single volume
images2d = [dcmread(folder / row[1].PathToFolder / row[1].FileName) for row in series.iterrows()]
image3d = stack_images(order_series(images2d))
Documentation
You can find the documentation here.
Metadata
Release files for dicom-csv 0.5.1
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_csv-0.5.1.tar.gz | 20.4 kB | Without provenance | Details for dicom_csv-0.5.1.tar.gz |
Release files / dicom_csv-0.5.1.tar.gz
| Download URL | dicom_csv-0.5.1.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e48236081652eab0eeccde71e9db108872f6e1669c17ff52a02f1fc5e1dddb61
|
|
BLAKE2b-256 checksum How to use checksums |
26c1f0f6e8a95f8cbacf3c4a44d06b041924ff9116ca61d345d3ccd19d000c73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for dicom-csv 0.5.1
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.