Python library and app to extract images from DCM files with metadata in a JSON-based standard format
pip install process-dcm
Usage: process-dcm [OPTIONS] INPUT_PATH
Process DICOM files in subfolders, extract images and metadata.
Version: 0.9.0
╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * input_path PATH Input path to either a DCM file or a folder containing DICOM files. [default: None] [required] │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --image_format -f TEXT Image format for extracted images (png, jpg, webp). [default: png] │
│ --output_dir -o PATH Output directory for extracted images and metadata. [default: exported_data] │
│ --group -g Re-group DICOM files in a given folder by AcquisitionDateTime. │
│ --tol -t FLOAT Tolerance in seconds for grouping DICOM files by AcquisitionDateTime. Only used │
│ when --group is set. │
│ [default: None] │
│ --n_jobs -j INTEGER Number of parallel jobs. [default: 1] │
│ --mapping -m TEXT Path to CSV containing patient_id to study_id mapping. If not provided and │
│ patient_id is anonymised, a 'study_2_patient.csv' file will be generated. │
│ --keep -k TEXT Keep the specified fields (p: patient_key, n: names, d: date_of_birth, D: │
│ year-only DOB, g: gender) │
│ --overwrite -w Overwrite existing images if found. │
│ --reset -r Reset the output directory if it exists. │
│ --quiet -q Silence verbosity. │
│ --version -V Prints app version. │
│ --install-completion Install completion for the current shell. │
│ --show-completion Show completion for the current shell, to copy it or customize the installation. │
│ --help -h Show this message and exit. │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
To run this project locally, you will need to install the prerequisites and follow the installation section.
This Project depends on the poetry
.
-
Install poetry, via
homebrew
orpipx
:brew install poetry
or
pipx install poetry
-
Don't forget to use the python environment you set before and, if using
VScode
, apply it there. -
It's optional, but we strongly recommend
commitizen
, which follows Conventional Commits
-
Clone the repo
git clone https://github.com/pontikos-lab/process-dcm cd process-dcm
We use commitizen
, which follows Conventional Commits. The instructions below are only for exceptional cases.
-
Using poetry-bumpversion. Bump the version number by running
poetry version [part] [--dry-run]
where[part]
ismajor
,minor
, orpatch
, depending on which part of the version number you want to bump.Use
--dry-run
option to check it in advance. -
Push the tagged commit created above and the tag itself, i.e.:
ver_tag=$(poetry version | cut -d ' ' -f2) git tag -a v"$ver_tag" -m "Tagged version $ver_tag" git push git push --tags