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:
- Discovery: Queries PACS or scanner at regular intervals for new data items
- Readiness Assessment: Determines if series are complete and ready for upload
- Anonymization: Remove or obfuscates sensitive metadata following rules configured via de-identification profiles
- Metadata Extraction: Parses DICOM headers for organizational and descriptive information
- Routing Resolution: Uses routing strings to determine target Flywheel containers
- Upload Process: Transfers complete series to appropriate locations
- Monitoring: Continues monitoring for changes to uploaded items
Series Completion Logic
The Connector uses the following logic to determine when to upload data:
- Change Detection: Has the number of images in the series (
NumberOfSeriesRelatedInstances
header) changed since last check? - If yes: Assumes scan still in progress, waits for next check cycle
-
If no: Proceeds to next check
-
Upload Status Check: Has this item already been uploaded?
- If yes: Continues monitoring for changes
-
If no: Proceeds to upload
-
Upload Execution: Uploads the complete series to Flywheel
-
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:
- Caret Delimiter: If
^
character is present, split as{lastname}^{firstname}
- Space Delimiter: If no
^
, split on space as{firstname} {lastname}
- No Delimiter: Entire string goes to
subject.lastname
,subject.firstname
remains empty - 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 fromStudyDate
+StudyTime
acquisition.timestamp
: Parsed fromAcquisitionDate
+AcquisitionTime
Siemens-Specific Behavior
For Siemens scanners (Manufacturer
= Siemens
):
acquisition.timestamp
usesSeriesDate
+SeriesTime
instead ofAcquisitionDate
+AcquisitionTime
- If
SeriesDate
/SeriesTime
cannot be parsed, defaults tosession.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:
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:
Data Organization Structure
Flywheel Container Hierarchy
The DICOM Connector places data in the Flywheel hierarchy:
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:
- Upload Completion: After successful upload, classification gears are triggered
- Header Analysis: Classification examines DICOM headers and series descriptions
- Pattern Matching: Matches acquisition names against classification rules
- Metadata Application: Applies appropriate classification metadata to acquisitions
Refer to the documentation on Preparing Acquisitions for Automated Classification for further details.