Skip to content

How the DICOM Connector Uploads an Image

Introduction

The Flywheel DICOM Connector (formerly known as the reaper) uploads images from a PACS or scanner to Flywheel via HTTPS.

This article explains in detail how the DICOM connector extracts metadata from a DICOM image and uploads it to Flywheel. To learn how to set up a scanning console to upload data, see this guide.

Instruction Steps

Types of Connectors

There are two methods for how data gets from the connector to Flywheel:

  • PULL setup: The Connector pulls images directly from a scanner.
  • PUSH setup: The scanner sends images to a Flywheel receiver. From the receiver, the Connector collects the images and sends them to your Flywheel instance.

Opt-in and Opt-Out

Another possible configuration for a Flywheel Connector is determining when data is uploaded to Flywheel.

  • The Opt-out configuration is when the Connector uploads all data to Flywheel by default. An opt-out string is entered at the scanner's console if the user does not want to upload data.
  • The Opt-in configuration is when the Connector uploads data only when the opt-in string is entered by a user at the scanner's console.

Uploading Data

The Flywheel Connector uploads images by querying a PACS or scanner at regular intervals for new data items. Next the scanner examines the available items to determine if they are ready to be entered into the Flywheel database.

For example when using MR scanners, Flywheel watches the Series (typically defined by SeriesInstanceUID) and the number of images in that series (NumberOfSeriesRelatedInstances) to see if there is an increase in that number).

In general, the Connector uses the following logic to determine if it can start uploading scans to Flywheel:

  1. Has the number of images in the series changed since the last time it checked? If yes, the Connector assumes the scan is still in progress and waits.
  2. If the item has not changed since the last time it checked, has it already been uploaded? If yes, the Connector waits.
  3. If the item hasn't changed and hasn't already been uploaded, the Connector uploads it. Files continue to be monitored.
  4. An automatic re-upload is triggered if there is a change of state of monitored and previously uploaded items.

Note

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

Extracting Metadata

As the connector is uploading data, it also parses metadata to make sure it stays current with the scans and to determine how to organize the data once it is in Flywheel.

Below is the default method for mapping DICOM tags to Flywheel fields:

Warning

These are default mappings. Your site may use different DICOM tags for these Flywheel fields. See your institution's Flywheel Site Admin for your specific mappings.

DICOM tag Flywheel field
PatientID
This is based on using the PatientID field for the routing string. Learn more about the routing string below.
group.\_id
PatientID project.label
PatientID subject.label
PatientName
See below for more info on how the PatientName is parsed
subject.firstname
PatientName
See below for more info on how the PatientName is parsed
subject.lastname
StudyInstanceUID session.uid
StudyDescription (--session-label-key) (4) session.label
OperatorsName session.operator
StudyDate/StudyTime
See below for more info on how StudyDate is parsed
session.timestamp
StudyTime
See below for more info on how StudyTime is parsed
session.timestamp
SeriesInstanceUID
See below for more info on how the SeriesInstanceUID is parsed
acquisition.uid
SeriesDescription acquisition.label
AcquisitionDate
See below for more info on how the AcquisitionDate is parsed
acquisition.timestamp
AcquisitionTime
See below for more info on how the AcquisitionTime is parsed
acquisition.timestamp

PatientName to subject.firstname and subject.lastname

The name is split as {lastname}^{firstname} if the caret (^) character is found, otherwise on a space character as {firstname} {lastname}. If neither a caret nor a space delimiter is present, the whole PatientName will go to subject.lastname while subject.firstname will be empty. Both fields are capitalized.

For example:

PatientName subject.firstname in Flywheel subject.lastname in Flywheel
Doe^John John Doe
Doe^John^Mid John^Mid Doe
John Doe John Doe
John Mid Doe John Mid Doe
john doe John Doe
JohnDoe JohnDoe

SeriesInstanceUID to acquisition.uid

DICOMs that have an ImageType tag with value DERIVED\SECONDARY\SCREEN SAVE or DERIVED\SECONDARY\VXTL STATE will be assigned a "decremented" UID. For example SeriesInstanceUID=4.5.6 would translate to acquisition.uid=4.5.5. If the Manufacturer is not Siemens and AcquisitionNumber is set and greater than 1 then acquisition.uid is suffixed with _{AcquisitionNumber}.

For example:

SeriesInstanceUID ImageType Manufacturer AcquisitionNumber acquisition.uid in Flywheel
1.2.3.4 ORIGINAL\... 1.2.3.4
1.2.3.4 DERIVED\... 1.2.3.3
1.2.3.4 SIEMENS 2 1.2.3.4
1.2.3.4 GE 2 1.2.3.4_2
1.2.3.4 GE 1 1.2.3.4

SeriesDate, SeriesTime, AcquisitionDate, and AcquisitionTime to session.timestamp and acquisition.timestamp

Timestamp fields in Flywheel are parsed from a pair of date and time fields like StudyDate and StudyTime. Similar pairs exist with prefixes Acquisition* and Series*. The timezone is configured via the --timezone option which defaults to UTC.

Note

Siemens scanners

If the Manufacturer is Siemens then acquisition.timestamp is parsed from SeriesDate and SeriesTime instead of AcquisitionDate/AcquisitionTime. If these tags are not parsable, the value defaults to session.timestamp.

Example DICOM Metadata Mapping

DICOM tags Flywheel metadata
patientID: fw://g/p/s group.id: g
project.label: p
subject.label: s
PatientName: doe^john subject.firstname: John
subject.lastname: Doe
StudyInstanceUID: 1.2.3 session.uid: 1.2.3
StudyDescription: My Study session.label: My Study
OperatorsName: OP^Mike session.operator: OP^Mike
StudyDate: 20201023
StudyTime: 105624
session.timestamp: 2020-10-23T10:56:24+00:00
SeriesInstanceUID: 4.5.6 acquisition.uid: 4.5.6
series.description: Series 002 acquisition.label: Series 002
AcquisitionDate: 20201023
AcquisitionTimestamp: 105649
acquisition.timestamp: 2020-10-23T10:56:49+00:00

Determining Where to Place Data in Flywheel

Once the metadata is extracted from the images, the Connector uses that information, along with the routing string, to place the data within Group, Project, Subject, Session, and Acquisition containers. Below shows where the series from the Connector is placed.

15f7f210ec9566.png

The Routing String

The routing string tells the Connector where to place data on your Flywheel site. In an agreed-upon field on the scanner console, a user enters the following:

fw://group/project/subject/session

with the labels for group, project, subject, and session entered.

Typical fields for the routing string are PatientID or Additional Info. These fields are configurable per site, so you should check with your institution's Site Admin to confirm the exact location.

This routing string does require that you enter the string correctly. Learn more about how to enter the routing string in the scanner console in our other article Capturing data directly from the MR scanner

Here's an example of how the Connector would parse an incomplete routing string:

Routing string entered group.id project.label session.label Notes
fw://psych/study01/ses01 psych study01 ses01
fw://psych/study01 psych study01 Flywheel will attempt to use studyDescription for the session label
fw://psych This will go into the Unsorted project within the psych group
psych/study01 This will go into Unknown Group since it does not include fw://

Warning

The Connector still uploads sessions that have missing, incomplete, or incorrect routing strings

These sessions are uploaded to the Unknown Group or Unsorted Project (depending on how much information was given at the scanner).

Sessions in the Unknown Group require a Site Admin to move them into the correct Group and Project. Sessions in a Group, but not sorted into a Project must also be manually moved from the Unsorted Project to the correct Project.

How does Flywheel determine where to place data?

Below is a diagram of how the DICOM Connector determines where to upload a session and if it should create new containers or use existing:

15f7f210ed02a7.png