dichotomise

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.
- Background and incidents: the export problems and evidence.
- Installation: all supported installation methods.
- Usage and output: options, archives, manifests and reports.
- Workflow: the processing stages and their checks.
- Sanitisation policies: policy actions and customisation.
- Development and citation: project layout and checks.
- Changelog: what changed in each release.
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.2
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 |
|---|---|---|---|---|
| dichotomise-2.9.2.tar.gz | 108.4 kB | Without provenance | Details for dichotomise-2.9.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dichotomise-2.9.2-py3-none-any.whl | Python 3 | none | any | Details for dichotomise-2.9.2-py3-none-any.whl |
Total release size: 189.6 kB
Release files / dichotomise-2.9.2.tar.gz
| Download URL | dichotomise-2.9.2.tar.gz |
|---|---|
| Size | 108.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b1ee48df1021f0618c46cd84fc9da9c221aaa881386920530e5670a58ef1420
|
|
BLAKE2b-256 checksum How to use checksums |
268bbd71825e1a4e5c6224f3be69edefd4865ea828b1255aeae674476f7b3778
|
| 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.2-py3-none-any.whl
| Download URL | dichotomise-2.9.2-py3-none-any.whl |
|---|---|
| Size | 81.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24b83ae501eea43614ac6e37070ef0adf03d16dd463d5524ef938ebab72321f3
|
|
BLAKE2b-256 checksum How to use checksums |
401d8e192fbbf9824a94cd972dbb0fa14f17490e33d47094ded53451ea9e8a60
|
| 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.2
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.