SCAMPI is a DICOM processing engine that extracts DICOM files from a source (local filesystem or PACS server), reads their metadata, and writes the metadata to a SQL Server database alongside copying the files to an output directory.
- Docker
- A running SQL Server instance accessible from the container
- DICOM source: either a local directory of
.dcmfiles or a reachable PACS server
Copy processing_engine/sample_config.yml to config.yml and edit it before running.
sources:
my_source: # arbitrary name for this source
type: filesystem # "filesystem" or "pacs"
directory: /my_images # path inside the container (see volume mounts below)
file_regex: .* # optional: filter filenames by regex
include_archives: True # optional: also process .7z and .zip archives
pacs_source:
type: pacs
aet: LOCALMACHINE # your calling AE title
aec: ORTHANC # called AE title (the PACS)
aem: LOCALMACHINE # move destination AE title
ip: 192.168.1.10
port: 4242
store_port: 11113 # port SCAMPI listens on for incoming C-STORE
keys:
- "QueryRetrieveLevel=STUDY"
- "StudyInstanceUID=1.2.3..."
destination:
files:
directory: /output # path inside the container (see volume mounts below)
compress: true
metadata_directory: /my_custom_directory # optional: replacement source path for database file URIs
archive_name_template: "SCAMPI_%Y%m%d.7z" # optional: strftime template; defaults to "%Y%m%d.7z"
metadata:
dbType: MSSQL
connectionString: mssql+pyodbc://user:pass@host.docker.internal,1433/SCAMPI?driver=ODBC+Driver+18+for+SQL+Server&TrustServerCertificate=yes
index: some_columnUse host.docker.internal as the hostname to reach SQL Server running on the Docker host machine.
When destination.files.compress is enabled, processed files are written to a
YYYYMMDD.7z archive in the destination directory. Set
destination.files.archive_name_template to a Python strftime template to
customize its filename (for example, SCAMPI_%Y%m%d.7z); the default is
%Y%m%d.7z. RelativeFileArchiveURI
metadata includes the destination path and points to each member using
<destination>/YYYYMMDD.7z!member/path.
Set destination.files.metadata_directory to replace the configured filesystem
source directory in database URIs without changing where files are stored. For
example, with a source directory of /my_images, the URI
/my_images/subdir/test.dcm becomes
/my_custom_directory/subdir/test.dcm.
Run from the repository root:
docker build -t scampi -f processing_engine/Dockerfile processing_engine/docker run --rm \
-v /path/to/your/config.yml:/config.yml \
-v /path/to/dicoms:/my_images \
-v /path/to/output:/output \
-v /path/to/templates:/templates \
-v /path/to/logs:/SCAMPI/logs \
scampi| Mount | Purpose |
|---|---|
config.yml:/config.yml |
Required. Your configuration file. |
dicoms:/my_images |
Required for filesystem sources. Must match directory in config. |
output:/output |
Required. Where processed DICOM files are written. Must match destination.files.directory in config. |
templates:/templates |
Required. A directory with modality.it config files. See DICOMTypeTranslater |
logs:/SCAMPI/logs |
Optional. Persists log files to the host. |
For PACS sources, no filesystem source mount is needed, but the container must have network access to the PACS server on the configured ip and port.
On Windows, use the full path with forward slashes or escape backslashes:
docker run --rm \
-v C:/Users/you/config.yml:/config.yml \
-v C:/Users/you/dicoms:/my_images \
-v C:/Users/you/output:/output \
scampiLog files are written to /SCAMPI/logs/ inside the container (mount this path to retain them). Structured JSON logs are also printed to stdout, so docker logs <container> works for live output.