The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

PACS Networking & DICOM Query/Retrieve

Overview

dicomtk provides a tidyverse-friendly interface to DICOM networking (dcmnet, dcmqrdb, dcmwlm, dcmtls): - dicom_connect(): Configure a remote DIMSE PACS peer, DICOMweb REST endpoint, or local PACS storage directory. - dicom_tls_config(): Configure BCP 195 TLS transport security (dcmtls). - dicom_echo(): Verify connectivity via DICOM Upper Layer A-ASSOCIATE-RQ + C-ECHO-RQ. - dicom_find(): Query studies, series, or instances as a tidy tibble. - dicom_get(): Retrieve matched DICOM files into a local directory. - dicom_send() / dicom_receive(): Store and receive DICOM objects (C-STORE). - dicom_qrdb_index() & dicom_worklist(): Local index database (dcmqrdb) and Modality Worklist (dcmwlm).

library(dicomtk)
library(dplyr)

dcm_file <- system.file("extdata", "example.dcm", package = "dicomtk")

# 1. Start a local PACS storage receiver (SCP directory)
pacs_dir <- tempfile("local_pacs_")
conn <- dicom_receive(pacs_dir, port = 11112, aetitle = "DICOMTK-SCP")
conn
#> ℹ DICOM Connection: DICOMTK-SCP -> DICOMTK-SCP@127.0.0.1:11112
#> ℹ Local PACS directory: /tmp/RtmpYoeKUo/local_pacs_105a3000e3eb

# 2. Verify PACS connectivity
dicom_echo(conn)
#> # A tibble: 1 × 7
#>   host       port called_ae   success status        message           elapsed_ms
#>   <chr>     <int> <chr>       <lgl>   <chr>         <chr>                  <dbl>
#> 1 127.0.0.1 11112 DICOMTK-SCP TRUE    SUCCESS_LOCAL Local DICOM repo…        0.1

# 3. Send DICOM file(s) to the PACS peer (C-STORE)
dicom_send(dcm_file, conn)
#> # A tibble: 1 × 4
#>   file                                                destination success status
#>   <chr>                                               <chr>       <lgl>   <chr> 
#> 1 /tmp/RtmpJkUnqX/Rinsteb77d2f93ac/dicomtk/extdata/e… /tmp/RtmpY… TRUE    STORE…

# 4. Query PACS studies with tidyverse piping and retrieve matching files
retrieved_files <- conn |>
  dicom_find(level = "STUDY") |>
  dicom_get()

retrieved_files
#> [1] "/tmp/RtmpYoeKUo/dicom_get_105a4ca014f6/example.dcm"

# 5. Build a local dcmqrdb index table
dicom_qrdb_index(pacs_dir) |>
  select(PatientID, Modality, Rows, Columns)
#> # A tibble: 1 × 4
#>   PatientID Modality Rows  Columns
#>   <chr>     <chr>    <chr> <chr>  
#> 1 98890234  CT       512   512

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.