Title: Flywheel SDK Example

Date: April 24th 2020

Description: This notebook is used to showcase a live version of commands used in the Flywheel SDK Documentation Examples section.

Install and Import Dependencies

Flywheel API Key and Client

Get a API_KEY. More on this at in the Flywheel SDK doc here.

Instantiate the Flywheel API client

Show Flywheel logging information


To learn more about different roles and respective permissions, please see Permissions.

<b>Notes:</b> Be sure you have the right permission to run the cells below.

Add a New Group

Create a new group, with an id of new_group and a label of New Group:

List Groups

List all Groups that you have access to:

Modify Group Tags

In this example, you will be adding tags named Control and Study to a Group

Tip: To learn more about different types of Containers and managing tags, files, notes or info, see Containers.

List Projects in Group

List all of the projects belonging to a Group.


How to Create a New Project

In this use case, you will be creating a new Project that belongs to the Group Label named my_group with a label of new_project_label.

Then, you can use add_project method to create a new Project with the label you have pre-defined earlier.

List All Projects that You Have Access to

  1. Access your Project via the Project Label, which is new_project_label.
  1. Access your Project via Flywheel path (Group/ProjectLabel) You can find the path in the Project Homepage

    • EX: (fw://new_group/new_project_label)
  1. Access Project container with Project ID
    • You can get your Project ID on the URL path OR via the Project container

Project Container Property and Info Attributes

Discover the Property in the Project container.

Tip: For more information about each property, visit the SDK Documentations.

You will be working with the new_project in this section.

Please make sure you have followed the steps above before moving forward.

Modify/Update Information in Property

In this section, you are going to add new information to the info property.

Based on your inputs above, they will be stored in dictionary format.

We are going to use update_info() to update the Project Info with the tmp_info we define above.

This is a more "user-friendly" way to add the metadata (or overwrite if the key already exists) to the Project container.

Check if it has been successfully modified

Replace Metadata

You can also removes all information on the Project and only adds back what's in tmp_info.

Tip: Useful command to learn more about the Project object.

IMPORTANT : For the following sections, you will need a testing project that you own and contains some dummy data which you can tinker with in this notebook.
If you don't have one already, please visit this repo before proceeding. Otherwise, please specify below the Group and Project labels.


Search the Project Container

This project variable will be used throughout the next few sections.


List Subjects

  1. List all Subjects that belong to the Project.
  1. List all of the Subjects that you have access to.
  1. List all of the Sessions belonging to Subject.

Add Subject

Create a new Subject with a desired label to the FW_PROJ.

Notes: The `subject.label` should be unique for the Project

Modify/Edit Subject metadata

Update the details for the new_subj.

Check whether the update went through.


Add Session

Here, you will be attaching a new Session container with label Session 01 to a Subject container. You will add this Session to the Subject you created earlier.

List Sessions

  1. List all of the Sessions that you have access to.
  1. List all of the Sessions belonging to the FW_PROJ.
  1. List all of the Sessions belonging to Subject.
  1. List all of the Acquisitions belonging to Session.


Add Acquisition

Create a new Acquisition with a label of Localizer, and upload a file.

Notes: You will be using the `new_session` that you created earlier.

List Acquisitions

List all of the Acqusitions that you have access to.

Notes:This will take a long time to run if you have accessed to a significant number of Acquisitions. Therefore, in this example, you will only get the first 10 Acquisitions.

List all of the files on an acquisition

Tip: Click here to learn more about different property in the file module.


List Analyses

List all of the Analyses which belong to the Project container

List all of the Analyses belong to the Session container

Use get_analyses function to get the nested analyses for a container

Jobs and Analyses

Get the details about a specific Gear in Flywheel

You can list of Gear that is available from this link https://flywheel.io/gear-exchange/

Utility Job Example