Skip to content

Ingesting Data in BIDS Format using the CLI

Introduction

BIDS (Brain Imaging Data Structure) has become one of the standard ways for organizing and sharing neuroimaging data. If you have existing data that is in the BIDS format that you would like to migrate to Flywheel, you can use the Flywheel CLI. Because BIDS follows a standard structure, the Flywheel CLI is able to read the metadata and automatically place your files into the correct location in Flywheel.

This article explains how to use the Flywheel CLI to ingest BIDS data and includes a reference guide for the command.

Prefer Videos?

We also have a collection of webinars on using BIDS and Flywheel.

Limitation

Currently, the Flywheel CLI supports ingesting the MR modality. To ingest other modalities into Flywheel (ex. EEG or MEG), use the browser upload

Prerequisites

Example BIDS Directory Structure

From the BIDS specification documentation, here are two examples of a single session and longitudinal and multi-site study.

Single Session Example**

15d8a924597780.png

Longitudinal studies with multiple sessions (visits) example

15d8a92459b82f.png

Instructions

To ingest BIDS data into Flywheel:

  1. Open Terminal or Windows Command Prompt.
  2. Note the location of the parent folder containing the BIDS data you are ingesting.
  3. Find the group ID for the group where you want to ingest your data. To find the group ID in the Flywheel UI:

    1. Open Chrome, and sign in to your Flywheel account
    2. From the menu on the left, select Groups.
    3. Note the group ID.

    Access Control

    You must have read/write permission to ingest data to the group.

  4. In Terminal or Windows Command Prompt, enter the following command to ingest the folder:

    fw ingest bids <BIDS_Folder_Location> <group_ID>

    For example: fw ingest bids ~/Documents/Study1 Ophthalmology

    The Flywheel CLI displays the BIDS data it is processing and then shows if it is creating a new container in Flywheel or if it is adding the data to an existing container.

  5. The ingest is complete once the Flywheel CLI stops showing data. If the Flywheel CLI is unable to ingest any data, an error occurs.

  6. Sign in to Flywheel, and view your data.

  7. In the left-hand navigation pane, select Projects

  8. Your ingested data will be under a project that matches the name of the parent folder for your BIDS data.

If you used the --project option in the command, your data will be under the project you specified in the command.

The Flywheel UI offers the option to view data in the BIDS directory structure. See our BIDS Overview article for more information.

Example: Ingest a Single Session

If you do not want to ingest all of your BIDS data, you can ingest a single subject or session folder to Flywheel. The --session and --subject options only upload folders matching the name you give in the command.

Below is a directory in the BIDS format. In this example, you want to upload session 01 for subject Control01.

15d8a9245a2b37.png

  1. Open Terminal or Windows Command Prompt.
  2. Note the location of the parent folder containing the BIDS data you are ingesting.
  3. Find the group ID for the group where you want to ingest your data. To find the group ID in the Flywheel UI:

    1. Sign in to your Flywheel account
    2. From the menu on the left, select Groups.
    3. Note the group ID.

    Access Control

    You must have read/write permission to ingest data to the group.

  4. Use the --subject and --session options with the ingest bids command. Using the example directory above, the command to ingest ses-01 for subject control01 would look like:

    fw ingest bids --subject sub-Control01 --session ses-01 ~/Documents/Study1 Ophthalmology

  5. The ingest is complete once the Flywheel CLI stops showing data. If the Flywheel CLI is unable to ingest data, an error occurs.

  6. Sign in to Flywheel, and view your data.

    Tip

    The Flywheel UI offers the option to view data in the BIDS directory structure. See our BIDS Overview article for more information.

Usage

BIDS ingest will ingest a BIDS organized folder as a project within flywheel, under the provided group. Learn more about installing the Flywheel CLI.

fw ingest bids [optional flags] [folder] [group]

Positional Arguments

Required Argument Description
folder path to the folder with the BIDS data you would like to upload
group Flywheel group ID

Optional Arguments

Optional Argument Description
--project LABEL, -p LABEL Label of Flywheel project in which to ingest.
--subject SUBJECT Only upload data from single subject folder (e.g., sub-01).
--session SESSION Only upload data from single session folder (e.g., ses-01).

General

Optional Argument Description
-h, --help Show help message and exit.
-C PATH, --config-file Specify configuration options via config file.*
--no-config Do NOT load the default configuration file.
-y, --yes Assume the answer is yes to all prompts.
--ca-certs CA_CERTS Path to a local Certificate Authority certificate bundle file. This option may be required when using a private Certificate Authority.
--timezone TIMEZONE Set the effective local timezone to use when uploading data.
-q, --quiet Squelch log messages to the console.
-d, --debug Turn on debug logging.
-v, --verbose Get more detailed output.

* Learn more about how to create this file.


Resources