Importing DICOM Files Using the Flywheel CLI
Introduction
If you have existing DICOM data you would like to add to Flywheel you can use the Flywheel CLI. The Flywheel CLI reads through directories of files and uses the DICOM header information to group them into the correct Acquisitions, Sessions, and Subjects in Flywheel.
This article explains how to use two commands to import DICOM images: ingest dicom.
Before You Begin
Ensure you have:
CLI Setup:
- Flywheel CLI installed on your computer
- Valid API key and authenticated CLI - verify with
fw status - Stable internet connection for data upload
Permissions:
You need the following project-level permissions in the target group/project:
- Single File Upload/Create or Bulk File Upload - Required for CLI ingest commands
- Create Container - Required if creating new subjects, sessions, or acquisitions
To check your permissions, navigate to the project in the web UI and check your role. Learn more about user roles and permissions.
Data Requirements:
- DICOM files with one of these extensions:
.dcm,.dcm.gz,.dicom,.dicom.gz,.ima, or.ima.gz - Files should contain standard DICOM tags:
PatientID(for subject label) andStudyDescription(for session label)- If these tags are missing, you'll need to provide
--subjectand--sessionflags
- If these tags are missing, you'll need to provide
For PHI/Sensitive Data:
If your DICOM files contain Protected Health Information (PHI), configure de-identification before upload:
- Create a de-identification profile to remove PHI during import
- Test your profile with
fw deid testbefore uploading - Use the
--de-identifyflag with your ingest command to apply the profile
For Automated Processing (Optional):
To automatically process data as it arrives, set up gear rules before uploading:
- Configure gear rules to run analysis automatically on new data
- Test rules on a small dataset first to verify they work as expected
For Cloud Storage Imports:
If importing from S3, Google Cloud, or Azure, configure your cloud credentials first:
Limitations & Considerations
- If using the
ingestcommand, DICOM data must have one of the following file extensions:.dcm,.dcm.gz,.dicom,.dicom.gz,.ima, or.ima.gz.
See our other import options if you have non-DICOM files.
- Verify you have Read-Write permissions to the Group and Project you are importing the data to.
Instruction Steps
Ingest DICOM
To use the ingest DICOM command to upload data from your computer or from an cloud storage bucket:
Upload Data from your Computer
- Follow these instructions to download and sign in to the Flywheel CLI If you cannot download the Flywheel CLI to your computer, you can upload smaller batches of DICOM files using your web browser.
- Open Terminal or Windows Command Prompt.
- Note the location of the parent folder containing the DICOM files you are importing.
-
The Flywheel CLI allows you to either create a new Flywheel Group and Project on import or use a Group and Project that already exists.
- To create a new Group or Project: Enter a new Group ID and Project Label in the command below.
-
To get information for an existing Group and Project:
- Sign in to your Flywheel account.
- Select the project where you would like to import the DICOM data.
- At the top of the project page, copy the Group ID and Project label.

-
In Terminal or Windows Command Prompt, start with the following command, which includes all of the required information to import the folder:
fw ingest dicom <optional flags> <SRC:path to DICOM folder> <group_ID> <project_label>For example:
fw ingest dicom --verbose ~/Desktop/flywheel psychology "Anxiety Study"Note
If your project label includes spaces, place quotes around it when entering the command.*
-
Review the hierarchy and scan summary to make sure it matches what you expect.

Tip
To view where in the Flywheel hierarchy the data will be imported, use the
--verboseflag. This also displays if Flywheel will create a new group, project, subject, session, or acquisition container or if it will upload the data to an existing container. -
Enter yes to begin importing.
The Flywheel CLI displays its import progress.
-
Once complete, sign in to Flywheel, and view your data.
From a Cloud Storage Bucket
Follow these instructions to upload data from AWS, Google, or Azure to Flywheel.
-
Configure the credentials for your bucket. The Flywheel CLI uses these credentials to access data in the storage bucket, so you must configure them before running the ingest command. The Flywheel CLI does not support passing credential parameters to it. Make sure that the user has read/write access to data in the bucket.
- AWS: See Amazon's documentation on how to use the configure command to set up your credentials or learn more about creating a shared credentials file or using environmental variables to set up credentials
- Azure: See Microsoft's documentation on how to use the Azure CLI login command to set up your credentials
- Google Cloud: See Google's documentation on how to use the gcloud auth login command to set up your credentials or learn more about using the other authentication options.
-
Start with the following command:
fw ingest dicom <optional flags> <SRC:path to DICOM folder> <group_ID> <project_label>Populate the relevant information for your data and environment, and add any optional flags. Use the following format for buckets:
- S3:
s3://bucket-name/key-name - Google Cloud:
gs://BUCKET_NAME1/ - Azure:
https://myaccount.blob.core.windows.net/mycontainer/myblob
For example:
fw ingest dicom s3://MyStudy/DataForUpload psychology "Anxiety Study"Note
If you are using the config file to de-id data, you must include the
--de-identifyflag.See the ingest template reference guide for more information on the optional flags.
If you have a have the cluster feature turned on in your Flywheel environment, and the cluster can access your s3 storage, you can use the
--cluster <cluster URL>optional flag. This will use the cluster's resources to upload data faster. If you do not have cluster ingest enabled, continue to the next step.The cluster URL for your Flywheel environment uses this format:
https://yourflywheelURL.com/ingests.For example:
fw ingest dicom --cluster https://university.flywheel.io/ingests s3://MyStudy/DataForUpload psychology "Anxiety Study" - S3:
-
Copy and paste your command into Terminal or Windows Command prompt, and hit enter. Flywheel CLI displays the data it has found.

-
Review the hierarchy and scan summary to make sure it matches what you expect.
-
Enter yes to begin importing. The Flywheel CLI displays its import progress.
-
Once complete, sign in to Flywheel and view your data.
Verify Success
After the ingest completes, verify your data was imported correctly:
1. Check the CLI Output
Look for confirmation messages in the terminal:
- Number of files processed
- Containers created (subjects, sessions, acquisitions)
- Upload completion status
2. View Data in Flywheel Web UI
- Sign in to your Flywheel site
- Navigate to your project: Groups → [Your Group] → [Your Project]
- Verify:
- Subjects were created with correct labels (from
PatientIDDICOM tag) - Sessions exist under each subject (from
StudyDescriptionDICOM tag) - Acquisitions contain your DICOM files (usually as
.dicom.zipfiles) - File counts match what you uploaded
3. Check Acquisition Details
Click on an acquisition to verify:
- DICOM metadata was extracted correctly
- File type is set to "dicom"
- Preview images are generated (if applicable)
4. Review Audit Logs (if enabled)
If you used the --save-audit-logs flag, review the audit log file to:
- Confirm all files were processed
- Check for any errors or warnings
- Verify duplicate detection results (if
--detect-duplicateswas used)
Next Steps
After successfully importing your DICOM data:
- Run analysis gears to process your data
- Download or export data for external analysis
- Export data in BIDS format if you need standardized neuroimaging structure
Additional Examples and Troubleshooting
De-identify Data Prior To Entering Flywheel
If your data has not already been de-identified, you can use the default de-id option in the CLI. This flag removes the DICOM tags PatientID, PatientName, and PatientBirthDate.
An example command:
fw import dicom <DICOM_Folder_Location> <group_ID> <project_label>
The Flywheel CLI also gives you the option to create custom de-identification configurations. See the article to learn more about how to create a customized de-ID profile.
Troubleshooting
Use the debug flag to see which data is not being imported. For example:
fw import dicom <DICOM Folder Location> <group_ID> <project_label> --debug
For example, the following output shows that some of the DICOM files are zipped, so the import dicom command cannot import the files: