Skip to main content

Python library and app to extract images from DCM in a JSON-based standard format

Project description

Process DCM

Maintenance GitHub GitHub release (latest by date) GitHub Release PyPI Poetry Ruff pre-commit

About The Project

Python library and app to extract images from DCM files with metadata in a JSON-based standard format

Installation and Usage

pip install process-dcm
 Usage: process-dcm [OPTIONS] INPUT_DIR

 Process DICOM files in subfolders, extract images and metadata.
 Version: 0.6.1

╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    input_dir      PATH  Input directory containing subfolders with 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.                                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────

For Developers

To run this project locally, you will need to install the prerequisites and follow the installation section.

Prerequisites

This Project depends on the poetry.

  1. Install poetry, via homebrew or pipx:

    brew install poetry
    

    or

    pipx install poetry
    
  2. Don't forget to use the python environment you set before and, if using VScode, apply it there.

  3. It's optional, but we strongly recommend commitizen, which follows Conventional Commits

Installation

  1. Clone the repo

    git clone https://github.com/pontikos-lab/process-dcm
    cd process-dcm
    

Bumping Version

We use commitizen, which follows Conventional Commits. The instructions below are only for exceptional cases.

  1. Using poetry-bumpversion. Bump the version number by running poetry version [part] [--dry-run] where [part] is major, minor, or patch, depending on which part of the version number you want to bump.

    Use --dry-run option to check it in advance.

  2. 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
    

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

process_dcm-0.9.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

process_dcm-0.9.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file process_dcm-0.9.0.tar.gz.

File metadata

  • Download URL: process_dcm-0.9.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.16 Linux/6.8.0-1021-azure

File hashes

Hashes for process_dcm-0.9.0.tar.gz
Algorithm Hash digest
SHA256 12d43ac61640f82a621b7faa8fb7232c8bb7507d499dbf465c9fa34f667732c0
MD5 9877b1fc30f8b05b19c9925e06c60f71
BLAKE2b-256 5ea9cdce4179b93c9f758a4f8bc2f8b0ccfee928cc5db5aafd295cc5289d1ed2

See more details on using hashes here.

File details

Details for the file process_dcm-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: process_dcm-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.16 Linux/6.8.0-1021-azure

File hashes

Hashes for process_dcm-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c957698e7b4d7d8d320187992bae6a31685bbb56cfb3e57df15216b5a9a6243
MD5 212ea816c84d3f97f1c8510b370492e9
BLAKE2b-256 9e5d6d17e447a3ecaf79f7b640d6bd73d253d32aacabb2c654c48f4f5254a14f

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