Skip to content

DICOM Connector Technical Reference

Introduction

This document provides comprehensive technical specifications for the Flywheel DICOM Connector, including metadata mapping rules, data processing logic, and system architecture details.

Data Processing Workflow

The DICOM Connector follows this processing sequence:

  1. Discovery: Queries PACS or scanner at regular intervals for new data items
  2. Readiness Assessment: Determines if series are complete and ready for upload
  3. Anonymization: Remove or obfuscates sensitive metadata following rules configured via de-identification profiles
  4. Metadata Extraction: Parses DICOM headers for organizational and descriptive information
  5. Routing Resolution: Uses routing strings to determine target Flywheel containers
  6. Upload Process: Transfers complete series to appropriate locations
  7. Monitoring: Continues monitoring for changes to uploaded items

Series Completion Logic

The Connector uses the following logic to determine when to upload data:

  1. Change Detection: Has the number of images in the series (NumberOfSeriesRelatedInstances header) changed since last check?
  2. If yes: Assumes scan still in progress, waits for next check cycle
  3. If no: Proceeds to next check

  4. Upload Status Check: Has this item already been uploaded?

  5. If yes: Continues monitoring for changes
  6. If no: Proceeds to upload

  7. Upload Execution: Uploads the complete series to Flywheel

  8. Continued Monitoring: Monitors for state changes that might trigger re-upload

The definition for "item", "state", and "change" varies for different data types or modalities.

DICOM Metadata Mapping

Default Field Mappings

The following table shows standard mappings from DICOM tags to Flywheel fields:

Flywheel Field DICOM Tag Notes
group._id Routing field (e.g., PatientComments) Based on routing string parsing
project.label Routing field (e.g., PatientComments) Based on routing string parsing
subject.label Routing field (e.g., PatientComments) Based on routing string parsing
subject.firstname PatientName See name parsing rules
subject.lastname PatientName See name parsing rules
session.uid StudyInstanceUID
session.label Configured routing field (e.g., PatientComments) or header mapping (e.g., StudyDescription by default) Can be based on routing string parsing or directly mapped from other DICOM headers.
session.operator OperatorsName
session.timestamp StudyDate / StudyTime See timestamp parsing
acquisition.uid SeriesInstanceUID See UID processing rules
acquisition.label SeriesDescription
acquisition.timestamp AcquisitionDate / AcquisitionTime See timestamp parsing

Site-Specific Configurations

These are default mappings. Individual sites may use different DICOM tags for Flywheel fields. Consult your Site Administrator for site-specific mappings.

PatientName Parsing

The PatientName field is parsed using these rules:

  1. Caret Delimiter: If ^ character is present, split as {lastname}^{firstname}
  2. Space Delimiter: If no ^, split on space as {firstname} {lastname}
  3. No Delimiter: Entire string goes to subject.lastname, subject.firstname remains empty
  4. Capitalization: Both fields are automatically capitalized

PatientName Examples

Input PatientName Parsed subject.firstname Parsed subject.lastname
Doe^John John Doe
Doe^John^Middle John^Middle Doe
John Doe John Doe
John Middle Doe John Middle Doe
john doe John Doe
JohnDoe (empty) JohnDoe

SeriesInstanceUID Processing

Special processing rules apply to SeriesInstanceUID values:

Derived Series Handling

DICOMs with ImageType values DERIVED\SECONDARY\SCREEN SAVE or DERIVED\SECONDARY\VXTL STATE receive a "decremented" UID:

  • Original: SeriesInstanceUID=4.5.6
  • Processed: acquisition.uid=4.5.5

AcquisitionNumber Suffix

For non-Siemens manufacturers, when AcquisitionNumber > 1, the UID is suffixed with _{AcquisitionNumber}:

SeriesInstanceUID ImageType Manufacturer AcquisitionNumber acquisition.uid
1.2.3.4 ORIGINAL... (any) (any) 1.2.3.4
1.2.3.4 DERIVED... (any) (any) 1.2.3.3
1.2.3.4 (any) SIEMENS 2 1.2.3.4
1.2.3.4 (any) GE 2 1.2.3.4_2
1.2.3.4 (any) GE 1 1.2.3.4

Timestamp Parsing

Timestamp fields combine date and time DICOM tags:

  • session.timestamp: Parsed from StudyDate + StudyTime
  • acquisition.timestamp: Parsed from AcquisitionDate + AcquisitionTime

Siemens-Specific Behavior

For Siemens scanners (Manufacturer = Siemens):

  • acquisition.timestamp uses SeriesDate + SeriesTime instead of AcquisitionDate + AcquisitionTime
  • If SeriesDate/SeriesTime cannot be parsed, defaults to session.timestamp

Timezone Configuration

Timestamps use the timezone specified by the --timezone configuration option (defaults to UTC).

Complete Mapping Example

DICOM Field DICOM Value Flywheel Field Flywheel Value
PatientComments fw://neurology/parkinsons/sub-001 group.id neurology
PatientComments fw://neurology/parkinsons/sub-001 project.label parkinsons
PatientComments fw://neurology/parkinsons/sub-001 subject.label sub-001
PatientComments fw://neurology/parkinsons/sub-001 session.label ses-baseline
PatientName doe^john subject.firstname John
PatientName doe^john subject.lastname Doe
StudyInstanceUID 1.2.3.4.5 session.uid 1.2.3.4.5
StudyDescription Baseline Assessment session.label Baseline Assessment
OperatorsName tech^smith session.operator tech^smith
StudyDate 20241201 session.timestamp 2024-12-01T14:30:00+00:00
StudyTime 143000
SeriesInstanceUID 1.2.3.4.5.6 acquisition.uid 1.2.3.4.5.6
SeriesDescription T1w MPRAGE acquisition.label T1w MPRAGE
AcquisitionDate 20241201 acquisition.timestamp 2024-12-01T14:35:00+00:00
AcquisitionTime 143500

Routing String Processing

Format Specification

Valid routing strings follow this format:

fw://group/project/subject/session

Processing Rules

The Connector parses routing strings according to these rules:

Routing String Pattern Result Notes
fw://group/project/subject/session Complete routing Ideal case - all containers specified
fw://group/project/subject Partial routing Session name derived from StudyDescription
fw://group/project Group + Project only Subject and session from DICOM metadata
fw://group Group only Data goes to Unsorted Project
Invalid format or missing Default routing Data goes to Unknown Group

Container Resolution Logic

The following flowchart describes how the DICOM Connector determines container placement:

DICOM Connector Routing Diagram

Data Organization Structure

Flywheel Container Hierarchy

The DICOM Connector places data in the Flywheel hierarchy:

1
2
3
4
5
6
Group (Institution/Department)
└── Project (Study/Research Initiative)
    └── Subject (Participant/Patient)
        └── Session (Scan Visit/Date)
            └── Acquisition (Scan Series)
                └── Files (Image Files)

Container Creation Rules

  • Groups: Desired group should be manually created in advance.
    • Unknown group is automatically created if desired group does not exist or if mapping string is missing or cannot be parsed.
  • Projects: Created based on routing string.
    • Ideally, the desired project is manually created in advance with the preferred settings. Otherwise, the DICOM connector will create it with default settings.
    • Unsorted project is created if mapping string is missing or cannot be parsed.
  • Subjects: Created based on routing string or derived from DICOM metadata (e.g., PatientID)
  • Sessions: Created based on routing string or derived from DICOM metadata (e.g., StudyDescription)
  • Acquisitions: Always created for each unique SeriesDescription

Classification Integration

Automated Classification

The DICOM Connector integrates with Flywheel's automated classification system:

  1. Upload Completion: After successful upload, classification gears are triggered
  2. Header Analysis: Classification examines DICOM headers and series descriptions
  3. Pattern Matching: Matches acquisition names against classification rules
  4. Metadata Application: Applies appropriate classification metadata to acquisitions

Refer to the documentation on Preparing Acquisitions for Automated Classification for further details.