dcm4che Toolkit and Library

repository·master·Indexed 23 days ago

https://github.com/dcm4che/dcm4che

A comprehensive DICOM toolkit and library for high-performance medical imaging data handling with support for DICOM and HL7 standards. It includes a suite of command-line tools such as dcm2dcm for transcoding, jpg2dcm for encapsulating media into DICOM, dcm2jpg for image conversion, and specialized utilities like agfa2dcm, agfa2sr, and fixlo2un. The toolkit also provides dcm4che-conf-ldap for centralized DICOM application configuration management via LDAP and modules for JBoss AS7.

Tokens
84.6K
Snippets
78
Records
344
Agent score
80%

What's inside dcm4che

  1. Overview of dcm4che DICOM Toolkit & Library

    master

    dcm4che is a complete DICOM toolkit and library designed to minimize the memory footprint of DICOM data sets. It includes modules for storing and fetching configuration data via LDAP, compliant with the DICOM Application Configuration Management Profile (DICOM PS 3.15, Annex H).

    Native Library Support for Image Compression/Decompression:

    dcm4che uses native libraries for image processing. Supported platforms include:

    • Linux: x86 64-bit (GLIBC_2.17), ARM 64-bit (GLIBC_2.27), ARM 32-bit (GLIBC_2.17)
    • Windows: x86 64-bit, x86 32-bit (Windows 10 or higher)
    • Mac OS: x86 64-bit (Mac OS 11+), ARM 64-bit (Mac OS 12+)
  2. Subscribe to UPS Event Reports

    master

    The upsscu tool supports various subscription modes:

    • Specific Instance: Use -O subscribe -u <upsiuid> to subscribe to a specific UPS instance.
    • Global Subscription: Use -O subscribe (without -u) to subscribe to all UPS instances.
    • Filtered Global Subscription: Use -O subscribe --filtered-global -m <criteria> to subscribe to instances matching specific attributes. Criteria can be specified as [seq.]attr=value (e.g., PatientName=DOE or 00100010=value).
    • Deletion Lock: Add the -l, --lock flag to enable a deletion lock during subscription.
    • Watch Mode: Use -w, --watch with get or requestCancel operations to use the UPS Watch SOP Class.
  3. Send bulkdata with specific MIME types

    master

    When sending bulkdata (non-DICOM files), use the --contentType flag to explicitly define the MIME type. This ensures the receiver treats the file correctly and prevents the tool from attempting to probe the file type automatically.

    Supported Content Types include:

    • PDF: application/pdf
    • Images: image/jpeg, image/png, image/jp2, image/j2c, image/gif, image/jphc, image/jph
    • Video: video/mpeg, video/mp4, video/quicktime
    • 3D Models: application/sla, model/stl, model/x.stl-binary, model/mtl, model/obj
    • Genomic Data: application/vnd.genozip, application/prs.vcfbzip2, application/x-bzip2
  4. Convert DICOM images to JPEG using dcm2jpg

    master

    The dcm2jpg tool converts DICOM image(s) to JPEG or other supported image formats. It supports several execution modes:

    1. Single file conversion: Convert one DICOM file to one specific output file. dcm2jpg <dicom-file> <jpeg-file>

    2. Multiple files to directory: Convert multiple DICOM files into a destination directory. dcm2jpg <dicom-file>... <outdir>

    3. Directory to directory: Convert all DICOM files within an input directory to a destination directory. dcm2jpg <indir>... <outdir>

    Example:

    dcm2jpg img.dcm img.jpg

    This converts the DICOM image img.dcm to a JPEG image named img.jpg.

  5. Convert HL7 messages to XML with hl72xml

    master

    The hl72xml command-line tool converts HL7 files into an XML presentation. It can read from a specified file or from standard input (using - as the filename) and writes the resulting XML to standard output. You can optionally apply an XSLT stylesheet to the output or include a specific XML namespace.

    $ hl72xml message.hl7
  6. Convert DICOM objects to PDF, CDA, STL, MTL, OBJ, Genozip, or Bzip2

    master

    The dcm2pdf tool extracts encapsulated content from DICOM objects and converts them into specific file formats. It supports single files, multiple files, or entire directories as input.

    Supported Formats and Content Types

    • PDF: .pdf (application/pdf)
    • CDA: .xml (text/xml)
    • STL: .stl (application/sla, model/stl, or model/x.stl-binary)
    • MTL: .mtl (model/mtl)
    • OBJ: .obj (model/obj)
    • Genozip: .genozip (application/vnd.genozip)
    • Bzip2 (VCF): .vcfbz2 (application/prs.vcfbzip2)
    • Bzip2 (Document): .bzip2 (application/x-bzip2)

    Usage Patterns

    • Single file conversion: dcm2pdf <dicom-file> <output-file>
    • Multiple files to a directory: dcm2pdf <dicom-file>... <output-dir>
    • Directory to directory conversion: dcm2pdf <dicom-dir>... <output-dir>
  7. Use the storescp application as a DICOM SCP

    master

    The storescp application acts as a Service Class Provider (SCP) for the Storage Service Class. It listens on a specified TCP/IP port for incoming association requests from a Storage Service Class User (SCU) and can receive DICOM images and other DICOM Composite Objects. It also supports the Verification Service Class as an SCP.

    To start the server, use the -b or --bind option to specify the port and optionally the AE Title and IP address.

    storescp -b STORESCP:11112
  8. Use movescu to perform DICOM C-MOVE retrieval

    master

    The movescu application is a Service Class User (SCU) used to initiate DICOM Query/Retrieve operations via the C-MOVE message. It allows you to request specific DICOM objects from a Service Class Provider (SCP) and have them sent to a specified destination AE Title.

    Core Functionality

    • Supported Information Models: PatientRoot, StudyRoot, PatientStudyOnly, CompositeInstanceRoot, HangingProtocol, and ColorPalette.
    • Matching Keys: You can specify which objects to retrieve using:
      • DICOM files: Provide one or more <dicom-file> paths.
      • Command line options: Use the -m flag to specify attributes (e.g., StudyInstanceUID=value).
    • Retrieve Levels: Use the -L flag to specify the level (PATIENT, STUDY, SERIES, IMAGE, or FRAME).

    Basic Usage Pattern

    To retrieve a study from a remote SCP and send it to a destination AE, use the following syntax:

    movescu -c <remote_aet>@<host>:<port> --dest <destination_aet> -m <attribute>=<value>
    $ movescu -c DCMQRSCP@localhost:11112 -m StudyInstanceUID=1.2.3.4 --dest STORESCP
  9. Use the ianscu tool for Instance Available Notifications

    master

    The ianscu application acts as a Service Class User (SCU) for the Instance Available Notification (IAN) SOP Class and the Verification SOP Class.

    Core Functionality

    • Sending IAN Notifications: You can provide DICOM files or directories. If the files contain IAN or Composite Objects, ianscu sends an IAN N-CREATE to the specified Service Class Provider (SCP).
      • For IAN objects: They are sent verbatim via one IAN N-CREATE.
      • For Composite Objects: For each unique Study, an IAN N-CREATE is sent referencing the SOP Instances found in the scanned files.
    • XML Support: Files with the .xml extension are parsed as an XML Infoset of the native DICOM Model (per DICOM Part 19).
    • Verification: If no DICOM files or directories are specified, the tool sends a DICOM C-ECHO message to the remote AE and waits for a response.

    Basic Usage Pattern

    ianscu [options] -c <aet>@<host>:<port> [<file>..][<directory>..]
    ianscu -c IANSCP@localhost:11112 --retrieve-aet QRSCP path/to/study
  10. Use the deidentify tool to anonymize DICOM files

    master

    The deidentify tool removes or replaces sensitive information in DICOM files according to the Basic Application Level Confidentiality Profile (DICOM Part 15). It supports processing single files, multiple files into a single output file, or multiple input files/directories into an output directory.

    Command Syntax:

    • deidentify [Options] <infile> <outfile>
    • deidentify [Options] <infile>... <outdir>
    • deidentify [Options] <indir>... <outdir>