Tutorial: Import Your First Dataset
This tutorial walks you through importing your first dataset into Flywheel using the CLI, from installation to verification. You'll learn the complete workflow and gain confidence using the CLI.
Time to complete: 20-30 minutes
What you'll learn:
- Install and set up the Flywheel CLI
- Authenticate with your Flywheel site
- Prepare DICOM data for import
- Run your first import command
- Verify the import was successful
- View your data in Flywheel
Prerequisites
Before starting this tutorial, ensure you have:
- Flywheel account with access to your organization's Flywheel site
- Permissions to upload data to at least one group
- Sample DICOM data (10-20 files recommended for this tutorial)
- If you don't have DICOM data, you can download sample datasets from public repositories
- Basic command line knowledge (navigating directories, running commands)
- New to command line? See Codecademy's Command Line Introduction
Step 1: Install the Flywheel CLI
Download the CLI
- Log in to your Flywheel site in a web browser
- Click your profile icon in the upper-right corner
- Select Profile
- Scroll to the Download Flywheel CLI section
- Click the download link for your operating system (Windows, macOS, or Linux)
A zip file will download to your computer.
Extract and Locate the CLI
Windows:
- Double-click the downloaded zip file to extract it
- Find the
fw.exefile inside - Note the location (e.g.,
C:\Users\YourName\Downloads\windows_amd64)
macOS:
- Double-click the downloaded zip file to extract it
- Find the
fwapplication - If using macOS 10.15 Catalina or later:
- Right-click on
fwand select Open - Click Open in the security warning
- Note the location (e.g.,
~/Downloads/darwin_amd64)
Linux:
- Extract the zip file:
unzip fw-linux_amd64.zip - Find the
fwexecutable - Note the location (e.g.,
~/Downloads/linux_amd64)
Test the CLI
Open Terminal (Mac/Linux) or Command Prompt (Windows) and navigate to the CLI location:
Run the version command to verify the CLI works:
You should see output like:
Success! The CLI is installed and working.
Step 2: Get Your API Key
The API key allows the CLI to authenticate with your Flywheel site.
- In your web browser, go back to your Flywheel Profile page
- Scroll to the API Keys section
- Click Generate API Key
- Copy the generated key (you'll need this in the next step)
Keep Your API Key Secret
Your API key provides access to your Flywheel account. Never share it or commit it to version control.
Step 3: Login to Flywheel
In your terminal, run the login command with your API key:
Replace YOUR_API_KEY_HERE with the API key you copied.
Expected output:
Verify Authentication
Check your login status:
Expected output:
Success! You're now authenticated.
Step 4: Prepare Your Data
For this tutorial, we'll use DICOM files. Let's organize and inspect them.
Organize Your DICOM Files
- Create a folder for this tutorial:
- Copy your sample DICOM files into this folder:
- Verify the files are there:
You should see your DICOM files listed.
Check DICOM File Extensions
The CLI looks for specific DICOM file extensions. Verify your files have one of these:
.dcm.dcm.gz.dicom.dicom.gz.ima.ima.gz
If your DICOM files have no extension or a different extension, you'll need to use the --force-scan flag later.
Step 5: Find Your Target Group and Project
You need to know where in Flywheel you want to import the data.
List Available Groups
Example output:
This shows your permission level and group names. Choose a group where you have admin or write permissions.
List Projects in a Group
Let's say you chose the psychology group:
Example output:
You can either:
- Use an existing project (e.g.,
AnxietyStudy) - Let the CLI create a new project during import
For this tutorial, we'll create a new project called TutorialImport.
Step 6: Run Your First Import
Now for the exciting part - importing your data!
The Import Command
We'll use fw ingest dicom to import DICOM files. Here's the basic structure:
Execute the Import
Run this command (adjust paths and names as needed):
What Happens Next
- Scanning: The CLI scans your DICOM files and reads metadata
- Hierarchy Preview: You'll see how the CLI plans to organize the data:
- Confirmation Prompt: The CLI asks you to confirm:
-
Type
yesand press Enter -
Upload Progress: You'll see progress as files upload:
Congratulations! You just imported your first dataset.
Step 7: Verify the Import
Let's confirm everything worked correctly.
Check with the CLI
List the contents of your new project:
Expected output:
Look deeper to see sessions:
Expected output:
Check in the Web UI
- Open your Flywheel site in a web browser
- Navigate to Projects in the left sidebar
- Filter or search for the TutorialImport project
- Click on the project to open it
- You should see:
- Subject:
sub-001 - Session:
ses-01 -
Acquisition with your DICOM files (usually named after SeriesDescription)
-
Click on an acquisition to view:
- DICOM files (shown as
.dicom.zip) - Metadata extracted from DICOM headers
- Preview images (if available)
Success! Your data is in Flywheel and ready for analysis.
Step 8: What's Next?
Now that you've completed your first import, here's what you can do:
Explore Your Data
- Browse the hierarchy: Use
fw lsto explore your data structure - Download files: Try
fw download psychology/TutorialImport/sub-001 - View metadata: Check the web UI to see what metadata was extracted
Import More Data
- Import additional subjects: Run the import command again with different data
- Use advanced options:
--de-identifyto remove PHI during import--detect-duplicatesto prevent duplicate uploads--verboseto see detailed import progress
Run Analysis
- Configure gear rules: Set up automatic processing for new data
- Run gears manually: Process your data with Flywheel gears
- Export results: Download processed data for further analysis
Learn More
- DICOM Import Reference - Full command options
- BIDS Import Guide - Import BIDS datasets
- Template Import Guide - Handle non-standard folder structures
- CLI Examples - More CLI usage examples
Troubleshooting
"No DICOM files found"
Problem: The CLI can't find any DICOM files.
Solution:
- Verify files have correct extensions (
.dcm,.dicom, etc.) - Try adding
--force-scanflag to scan all files - Check the source path is correct
"Permission denied: Cannot create project"
Problem: You don't have permissions to create projects in the group.
Solution:
- Use an existing project instead of creating a new one
- Contact your Flywheel administrator to grant you permissions
- Try a different group where you have admin permissions
"Invalid DICOM - missing UID tag"
Problem: DICOM files are missing required metadata tags.
Solution:
- Verify files are valid DICOM using a DICOM viewer
- Check if files were properly exported from imaging equipment
- Try different sample DICOM data for this tutorial
Files uploaded but showing wrong labels
Problem: Subject/session names don't match what you expected.
Solution:
- The CLI uses DICOM tags for labels (PatientID → subject, StudyDescription → session)
- Use
--subjectand--sessionflags to override:
For more help, see:
Summary
Congratulations on completing your first Flywheel CLI import! You've learned how to:
✅ Install and set up the Flywheel CLI ✅ Authenticate with your Flywheel site ✅ Prepare and organize DICOM data ✅ Run an import command ✅ Verify the import succeeded ✅ View your data in Flywheel
You now have the foundation to import and manage your research data using the Flywheel CLI. Happy importing!