Skip to main content

dichotomise Version Licence CI DOI

DIChOtoMise checks, sorts, renames, optionally sanitises and archives DICOM exports. It was prompted by problems we found in Siemens XA60+ exports.

Contents

Why dichotomise?

TL;DR: Scanner exports reuse filenames and can contain duplicated or misfiled images. Dichotomise checks DICOM headers and file content to make those problems visible.

XA60+ exports name files 1.dcm, 2.dcm and so on in every series folder. Two unrelated images can therefore have the same filename. Once a file is separated from its folder, the filename does not identify it, even though its header carries a SOP Instance UID.

The export format makes good data-handling practice difficult. Dichotomise addresses each problem as follows:

Export problem What dichotomise does
Repeated filenames hide file identity and can collide when files are moved. Uses the SOP Instance UID from the header in each rectified filename.
A file's series folder can contradict its header. Audits series metadata and sends files that disagree with their folder's majority to review.
A repeated export can add byte-identical files. Detects byte-identical copies within each source folder and sends later copies to review. A copy in another folder is written once, not twice.
Two different files can claim one SOP Instance UID. Sends every file in the group to review as a sop_conflict, never as a duplicate.
Processing can obscure the original export. Archives the untouched source DICOMs and records manifests before processing.

Two examples prompted this work. One Series 22 image was found in a Series 21 folder. In another export, an 81-image DWI series appeared twice as 162 files; each duplicate pair was byte-identical. The files show what happened to the export, but do not establish the underlying cause.

Read the background and incident accounts for the examples, evidence and limitations. The workflow guide explains the checks and how retained and review files are handled.

Installation

TL;DR: Create a Python 3.11+ virtual environment and install from PyPI.

python3.11 -m venv .venv
source .venv/bin/activate
pip install dichotomise
dichotomise --help

For conda, uv, source checkouts and containers, see the installation guide.

Quick start

TL;DR: Give dichotomise a source directory and an output directory. Use --qc to audit the source in place without creating files.

dichotomise --source-dir ./study/sub-001 --out-dir ./dichotomise-runs
dichotomise --qc --source-dir ./study/sub-001

To only sort a folder of DICOMs into <subject>/<series>/ subfolders, use --sort. It works in place when every file sits directly in the source folder (no --out-dir); otherwise give --out-dir to sort a copy. Add --dry-run first to see the plan; in place moves your originals.

dichotomise --sort --dry-run --source-dir ./study/sub-001
dichotomise --sort --source-dir ./study/sub-001

Use --sanitise to apply a policy to processed and review files. Choose the policy carefully: descriptions can contain identifying text, and the untouched source archive retains the original identifiers. See the sanitisation policies before sharing output.

See usage and output for all options, mapping files, archive contents and reports.

Documentation

TL;DR: Start with the guide for the task you need.

Citation and licence

TL;DR: Cite the Zenodo concept DOI; the project uses the MIT licence.

Citation details are in CITATION.cff. The project is licensed under the MIT licence.

Metadata

Release files for dichotomise 2.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dichotomise 2.9.1
File Size Uploaded Provenance Actions
dichotomise-2.9.1.tar.gz 106.5 kB Without provenance Details for dichotomise-2.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dichotomise 2.9.1
File Interpreter ABI Platform Actions
dichotomise-2.9.1-py3-none-any.whl Python 3 none any Details for dichotomise-2.9.1-py3-none-any.whl

Total release size: 186.9 kB

Release files / dichotomise-2.9.1.tar.gz

Download URL dichotomise-2.9.1.tar.gz
Size 106.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7ca02bd5263821206ab8c03e3f70c53cc330adee792adf687dfcb60bbd626264
BLAKE2b-256 checksum
How to use checksums
2654c355a88c648a7ecf2540bd000d6ea5a856782e3108bcd4e3a887d0586094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dichotomise-2.9.1-py3-none-any.whl

Download URL dichotomise-2.9.1-py3-none-any.whl
Size 80.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4c9a1ab00c12b8873fddf825767d3dac93d5c789109a6a4f07cf89ea1034e51
BLAKE2b-256 checksum
How to use checksums
8873e21c143d47a56a0b8f265f4dab707abb6d0d309056e7e2b23a00de6a79cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dichotomise 2.9.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page