Skip to content

Logo Logo

Additional Template Examples

Introduction

Below are additional examples of templates. Use these as a starting point for your own ingest template.

Instruction Steps

Uploading JPG files

The template is a good option if you want to upload non-DICOM data to Flywheel. Note that the packfile_type can be any filetype

template: 
  - pattern: "{subject}"
  - pattern: "{session}"
  - pattern: ".*"
  - pattern: "{acquisition}"
    packfile_type: jpg 

Uploading DICOM files

The template below pulls out the subject and session labels from the first folder name, skips a level, uses the 3rd folder name as the acquisition label, and then uses the dicom scan to validate DICOM files before upload:

template: 
  - pattern: "wimrpetct{subject}_{session}"
  - pattern: ".*"
  - pattern: "{acquisition}"
    scan: 
      name: dicom

Setting Custom Metadata

The example below uses folder names to set 2 different custom metadata fields.

- pattern: "{session.info.dataset}"
- pattern: "XR_{acquisition}"
- pattern: "patient{subject}"
- pattern: "study{session}_{acquisition.info.outcome}"

The custom metadata fields are called dataset , which is stored in the session, and the other is called outcome, which is stored on the acquisition.

Using regex to set acquisition label from a file name

The template below uses the filename from the imaging data to label the acquisitions in Flywheel.

Template

---
- pattern: "{subject}"
- pattern: "{session}"
  scan: 
     name: filename 
     pattern: "^(?:[^_]*_){3}(?P<acquisition>[^.]*)"

Outcome

Original Filename Flywheel Acquisition label
20210214_164316_SubjectName_AcqParameter1_AcqParameter2_AcqParameter3.mhd AcqParameter1_AcqParameter2_AcqParameter3

Regex can quickly become complicated. You can test out your filename and regex using an online tool such as regex101.

Click Next to de-identify your dataset with a custom de-id profile.