DicomPressor

Free, open-source CLI tool for merging, splitting, compressing, anonymizing, and converting DICOM medical imaging files. Cross-platform. No GUI needed.

macOS Windows / PowerShell Linux / WSL
Download Web Tool GitHub

16 Powerful Features

Everything you need to work with DICOM files from the command line — analogous to Sante Dicommander.

-j

Merge to Multi-Frame

Merge hundreds of single-frame DICOM files into one Enhanced CT multi-frame file with correct 3D spatial reconstruction.

-s

Split Multi-Frame

Split a multi-frame DICOM file back into individual single-frame files.

-x / -z

Compress

Compress DICOM files using JPEG Lossless (-x) or JPEG Lossy (-z) transfer syntaxes.

-u

Decompress

Decompress compressed DICOM files back to uncompressed transfer syntax.

-a / -A

Anonymize

Remove or replace patient-identifying information using a parameter file. Supports rectangle masks for burned-in annotations.

-m / -M

Modify Tags

Insert, modify, or remove any DICOM tag using a simple parameter file.

-I / -i

Export to Images

Export DICOM files to JPEG, PNG, BMP, or TIFF images.

-E / -e

Export to Video

Export multi-frame DICOM files to AVI video.

-d / -D

Create DICOMDIR

Generate a DICOMDIR index file for a folder of DICOM files.

-t

Export Headers

Export DICOM headers (metadata) to human-readable text files.

-b / -l

Endian Conversion

Convert between Little Endian and Big Endian transfer syntaxes.

-p / -n

NEMA2 Conversion

Convert between legacy NEMA2 format and modern DICOM 3.0 Part 10.

--info

File Info

Display detailed information about a DICOM file — dimensions, modality, transfer syntax, patient info, and more.

--summary

Folder Summary

Get an overview of all DICOM files in a folder — patient count, series, modalities, and statistics.

--skip-if-done

Skip If Done

Idempotent processing — creates a .dicompressor_done marker after success. Safe to run repeatedly via cron or scheduler.

--watch N

Watch Mode

Continuously monitors a parent folder for new patient subfolders and auto-processes them every N seconds. Standalone watch scripts included.

--scan-state-file

Incremental Scans

Persistent per-folder mtime cache. After the first pass, watch mode skips folders whose contents haven’t changed since the last pass instead of re-reading every DICOM header. New 3D studies get picked up within one interval even on trees with thousands of patient folders.

📦 Installation

DicomPressor requires Python 3.8+ and works on macOS, Windows, and Linux. The wrapper scripts automatically install all dependencies.

macOS / Linux
Windows (PowerShell)
WSL
1

Clone the repository

git clone https://github.com/nsitnov/dicompressor.git cd dicompressor
2

Make the shell wrapper executable

chmod +x dicompressor.sh
3

Run — it auto-installs pydicom, numpy, Pillow on first run

./dicompressor.sh -j -f /path/to/patient_folder

or run directly with Python
pip3 install pydicom numpy Pillow python3 dicompressor.py -j -f /path/to/patient_folder
1

Clone the repository

git clone https://github.com/nsitnov/dicompressor.git cd dicompressor
2

Recommended: install the requirements once and run Python directly

python -m pip install -r .\requirements.txt python .\dicompressor.py -j -f "C:\path\to\patient_folder"
!

If `python` is missing, use `py -3`. If the wrapper is blocked by execution policy, use the direct Python command above or allow the wrapper only for the current session.

py -3 -m pip install -r .\requirements.txt py -3 .\dicompressor.py -j -f "C:\path\to\patient_folder" Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

optional PowerShell wrapper
Unblock-File .\dicompressor.ps1 .\dicompressor.ps1 -j -f "C:\path\to\patient_folder"

optional hidden Windows startup task
Unblock-File .\dicompressor-install-service.ps1 .\dicompressor-install-service.ps1

The installer uses the built-in Windows Task Scheduler, asks for python.exe, source folder, output folder, log path, interval, and task name, then creates a hidden auto-start background task. No nssm download is required.

1

Open WSL terminal (Ubuntu)

wsl
2

Clone and set up (same as Linux)

git clone https://github.com/nsitnov/dicompressor.git cd dicompressor chmod +x dicompressor.sh
3

Run — access Windows drives via /mnt/c/

./dicompressor.sh -j -f /mnt/c/Users/You/DICOM/patient_folder
!

Install Python if missing

sudo apt update && sudo apt install python3 python3-pip

Requirements

Python 3.8+

Core runtime

pydicom

DICOM file parsing

numpy

Pixel data processing

Pillow

Image export

💻 Usage & Common Commands

DicomPressor uses a simple CLI syntax: dicompressor.py [action] [options] -f/-F <path>

Use -f to scan subfolders recursively, or -F to process a single file or folder only.

MERGE Merge CT slices into one multi-frame DICOM
python3 dicompressor.py -j -f /path/to/patient_folder
SPLIT Split multi-frame back into single frames
python3 dicompressor.py -s -F multiframe.dcm
COMPRESS JPEG Lossless compression
python3 dicompressor.py -x -f /path/to/folder
COMPRESS JPEG Lossy — smaller files, slight quality loss
python3 dicompressor.py -z -f /path/to/folder
DECOMPRESS Decompress back to uncompressed
python3 dicompressor.py -u -f /path/to/folder
ANONYMIZE Anonymize patient data with parameter file
python3 dicompressor.py -a anon_params.txt -f /path/to/folder
MODIFY Modify DICOM tags
python3 dicompressor.py -m modify_params.txt -f /path/to/folder
EXPORT Export DICOM to PNG images
python3 dicompressor.py -I png -f /path/to/folder
EXPORT Export multi-frame DICOM to video
python3 dicompressor.py -E -F multiframe.dcm
DICOMDIR Create DICOMDIR index file
python3 dicompressor.py -d -f /path/to/folder
HEADERS Export DICOM headers to text files
python3 dicompressor.py -t -f /path/to/folder
INFO Get detailed info for a single DICOM file
python3 dicompressor.py --info -F file.dcm
SUMMARY Get folder summary — patients, series, sizes
python3 dicompressor.py --summary -f /path/to/folder
SCHEDULER Merge, but skip if already processed
python3 dicompressor.py -j --skip-if-done -f /path/to/patient
WATCH Streaming watch mode: starts merging during the scan
python3 dicompressor.py -j --watch 300 -f /path/to/patients/
WATCH+OUTPUT Watch + copy merged files to output dir
python3 dicompressor.py -j --watch 300 --output-dir /data/merged -f /data/patients/
WINDOWS Recommended direct Python command for Windows
python .\dicompressor.py -j --watch 300 --output-dir "D:\Merged" -f "D:\DICOM\Patients"
LOG FILE Write the rotating watch log to a custom location
python .\dicompressor.py -j --watch 300 --log-file "D:\DICOM\Logs\dicompressor.log" --output-dir "D:\Merged" -f "D:\DICOM\Patients"
TASK Interactive Windows startup task installer for hidden auto-start watch mode
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass Unblock-File .\dicompressor-install-service.ps1 .\dicompressor-install-service.ps1
WATCH Standalone watch script (Linux/macOS/WSL)
./dicompressor-watch.sh /path/to/patients 300 /data/merged /data/logs/dicompressor.log
WATCH Standalone watch script (Windows PowerShell)
.\dicompressor-watch.ps1 -WatchDir "D:\DICOM\Patients" -OutputDir "D:\Merged" -LogFile "D:\DICOM\Logs\dicompressor.log"
Behavior

The generic merge/watch workflow now behaves like the Vatech scheduler: it starts processing folders while the recursive scan is still running, writes a rotating dicompressor.log file next to the script by default, skips done-marked folders before deep re-inspection on later passes, and waits only for the remaining part of the interval before the next pass.

Windows Notes & Troubleshooting

Scripts Disabled

If PowerShell says running scripts is disabled on this system, either use the direct python command above or allow the wrapper only for the current session:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Common Warnings

This warning is usually safe and does not stop the merge:

Expected implicit VR, but found explicit VR - using explicit VR for reading

The first watch pass can still take time on very large historical trees, but matching folders now start merging during the scan instead of waiting for a full candidate list.

Logs

By default the script writes a rotating log file next to itself:

D:\dicompressor\dicompressor.log

Use the log to confirm scan progress, found folders, copied outputs, and failures. You can override the location with --log-file.

Incremental Scans

Watch mode keeps a per-folder mtime cache so subsequent passes skip folders whose contents haven’t changed:

D:\dicompressor\dicompressor-scan-state.json

The first pass on a large historical tree still reads every folder. Every pass after that looks only at folders whose direct-child list has changed since the previous scan, so a new 3D study is picked up within one --watch interval. Override with --scan-state-file or disable it by passing an empty string.

Windows Startup Task

The generic ZIP and GitHub repo now include an interactive installer built on the Windows Task Scheduler. It asks for the important paths instead of requiring a hand-written command or an external service wrapper.

.\dicompressor-install-service.ps1

Run it from an Administrator PowerShell. The created scheduled task starts with Windows, runs hidden as SYSTEM, restarts automatically if it exits, and uses the source, output, interval, and log path you enter during the prompts.

Legacy Consoles

If an older Windows console cannot print box-drawing Unicode characters, the CLI help output now falls back to plain ASCII separators automatically.

python .\dicompressor.py -h

Parameter File Format

Anonymize and Modify commands accept a simple text file with tag assignments:

ANONYMIZE anon_params.txt
(0010,0010)=ANONYMOUS^PATIENT
(0010,0020)=ANON001
(0010,0030)=19000101
(0010,0040)=O
(0008,0090)=
MODIFY modify_params.txt
(0008,1030)=My Study Description
(0008,103E)=Modified Series

🗃 Vatech Workflow

Use the dedicated Vatech variant when the machine exports a DCM_FILE.CT archive instead of a folder with many small DICOM slices.

Original Workflow

Keep using the default DicomPressor for normal CBCT / CT folders

If the machine already writes hundreds of single-frame .dcm files into one folder, the current generic script stays the right tool.

python3 dicompressor.py -j --skip-if-done -f /path/to/patients
Vatech Variant

Use the dedicated Vatech script for .CT archives

The Vatech variant searches folders for normal slices and Vatech archives in parallel. For every DCM_FILE.CT it extracts to a temp folder, merges the slices, moves the merged output back next to the source data, removes the temp folder, and writes .dicompressor_vatech_done.

python3 dicompressor-vatech.py -j --skip-if-done -f /path/to/patients

Install The Vatech Variant

macOS / Linux

Clone the dedicated Vatech repo or use the ZIP below.

git clone https://github.com/nsitnov/dicompressor-vatech.git cd dicompressor-vatech chmod +x dicompressor-vatech.sh ./dicompressor-vatech.sh -j -F /path/to/patient_folder
Windows

Recommended for most Windows users: install the requirements once, then run the Python script directly. If python is missing, replace it with py -3.

python -m pip install -r .\requirements.txt python .\dicompressor-vatech.py -j --watch 300 --output-dir "D:\Vatech\Merged" -f "D:\VatechDatabase\FMData\Files"
Windows Wrapper

If you want to use the PowerShell wrapper, allow it only for the current terminal session and then start it normally.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass Unblock-File .\dicompressor-vatech.ps1 .\dicompressor-vatech.ps1 -j -F "C:\path\to\patient_folder"
Windows Startup Task

For clinics that want the watcher to start with Windows and stay hidden, use the interactive Task Scheduler installer. It asks for the Python path, source folder, output folder, log file, interval, and task name.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass Unblock-File .\dicompressor-vatech-install-service.ps1 .\dicompressor-vatech-install-service.ps1
WSL

Run the Linux wrapper inside WSL and point it to the Windows mount.

wsl git clone https://github.com/nsitnov/dicompressor-vatech.git cd dicompressor-vatech ./dicompressor-vatech.sh -j -F /mnt/c/Users/You/DICOM/patient_folder

Common Vatech Commands

Single Folder
python3 dicompressor-vatech.py -j -F /path/to/patient_folder
Skip If Done
python3 dicompressor-vatech.py -j --skip-if-done -f /path/to/patients
Watch Mode
python3 dicompressor-vatech.py -j --watch 300 -f /path/to/patients
Watch + Output
python3 dicompressor-vatech.py -j --watch 300 --output-dir /data/merged -f /data/patients
Windows Watch Example
python .\dicompressor-vatech.py -j --watch 300 --output-dir "D:\Vatech\Merged" -f "D:\VatechDatabase\FMData\Files"
Custom Log File
python .\dicompressor-vatech.py -j --watch 300 --log-file "D:\Vatech\Logs\dicompressor-vatech.log" --output-dir "D:\Vatech\Merged" -f "D:\VatechDatabase\FMData\Files"
Behavior

The Vatech script supports normal single-frame DICOM folders and Vatech archives side by side in the same tree. In watch mode it starts processing folders as soon as they are found during the scan, writes .dicompressor_vatech_done only after success, prunes done-marked study folders from later recursive passes, and writes a rotating dicompressor-vatech.log file next to the script by default. If you need to re-run a folder, delete the done marker.

Windows Notes & Troubleshooting

Expected Folder Layout

Best match for the Vatech workflow:

D:\VatechDatabase\FMData\Files\Sub022093\CT20220930_152004_9476_56703857\DCM_FILE.CT

Each patient stays in its own Sub... folder. The script looks for real 3D CT folders and ignores small patient-root 2D series like PX*.dcm.

Scripts Disabled

If PowerShell says running scripts is disabled on this system, either use the direct python command above or allow the wrapper only for the current session:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Common Warnings

This warning is usually safe and does not stop the merge:

Expected implicit VR, but found explicit VR - using explicit VR for reading

The first watch pass can still take time on very large archives, but the script now logs scan progress, starts merging matching folders during the scan, and skips done-marked study folders before deep inspection on later passes.

Logs

By default the script writes a rotating log file next to itself:

D:\dicompressor\dicompressor-vatech.log

Use that log to confirm scan progress, found folders, extracted DCM_FILE.CT archives, copy operations, and failures. You can override the location with --log-file.

Windows Startup Task

The ZIP and GitHub repo include an interactive installer built on the Windows Task Scheduler. It prompts for the important paths instead of making you edit a command by hand or download nssm.

.\dicompressor-vatech-install-service.ps1

Run it from an Administrator PowerShell. The created scheduled task starts automatically with Windows, runs hidden as SYSTEM, restarts if it exits, and writes the same Vatech log file you configure during the prompts.

Legacy Consoles

If an older Windows console cannot print box-drawing Unicode characters, the Vatech CLI help output now falls back to plain ASCII separators automatically.

python .\dicompressor-vatech.py -h
Output Filenames

Merged filenames do not come from DCM_FILE.CT. They come from the DICOM headers inside the archive, usually PatientName and SeriesNumber.

Stamenov_Enco_series31_multiframe.dcm test_test_series31_multiframe.dcm

If two merged files would have the same name in the output folder, the later one gets a suffix like _1 or _2 instead of overwriting the existing file.

⬇️ Download

Download the generic DicomPressor workflow or the dedicated Vatech variant. Both are free and open source.

GitHub Repository

Clone the repo, get updates, contribute, and report issues.

Open on GitHub

Download ZIP

Download the latest generic release — includes the CLI tool, wrapper scripts, watch scripts, Windows startup task installer, and README. No Git needed.

Download .zip

Vatech GitHub Repository

Dedicated source repository for the Vatech workflow and future release history.

Open Vatech Repo

Download Vatech ZIP

ZIP package with the dedicated Vatech script, wrapper scripts, watch scripts, Windows startup task installer, and README.

Download Vatech .zip

🧰 Visualize Your DICOM Files

After merging, use the built-in VolView viewer to explore your DICOM data in 3D — right here in the browser. Drag & drop your .dcm file into the viewer below.

VolView — 3D DICOM Viewer Open in new tab ↗

Powered by VolView by Kitware — self-hosted on this server.

📧 Contact & Support

Found a bug? Have a feature request? Need help?

Get In Touch

Report bugs, request features, or ask questions. We'll get back to you as soon as possible.

[email protected]

You can also open an issue on GitHub.