If you have existing DICOM data you would like to migrate to Flywheel you can use the Flywheel CLI. The import DICOM option 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 the Flywheel CLI to import DICOM data.
For an explanation of the optional arguments for the command, see the reference guide.
Before you begin
- 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.
- Verify that the data you want to import meets the following requirements:
- Data is DICOM files. See our other import options if you have non-DICOM files.
- Files are in a folder. The parent folder can include child folders.
- Verify you have Read-Write permissions to the Group and Project.
Import DICOM files
To import DICOM files:
- 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 exist.
- 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:
- Open Chrome, and 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, enter the following command to import the folder:
fw import dicom <DICOM_Folder_Location> <group_ID> <project_label>
For example: fw import dicom ~/Desktop/flywheel psychology "Anxiety Study"
Note: If your project label includes spaces, place quotes around it when entering the command.
- Flywheel CLI displays the data it has found and notes where it will import the files. It also notes if the Flywheel CLI will create a new container or use an existing container for the files.
- Review the hierarchy and scan summary as shown above to make sure it matches what you expect.
Where are my DICOM files?
The Flywheel CLI takes the related DICOM files and groups them in to single a zip file with the extension dicom.zip. In the scan summary, this is called a packfile. The Flywheel CLI imports the dicom.zip file to the Acquisitions tab.
- Enter yes to begin importing. The Flywheel CLI displays its import progress.
- Once complete, sign in to Flywheel, and view your data.
De-identify data before it enters Flywheel
If your data hasn't 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 --de-id <DICOM_Folder_Location> <group_ID> <project_label>
The Flywheel CLI also gives you the option to create custom de-identification configurations. See our article for more information.
Use the debug flag to see what data isn't being imported. For example:
$ fw import dicom --debug <DICOM Folder Location> <group_ID> <project_label>
For example, the following output shows that some of the DICOM files are zipped, so the Flywheel CLI can't import the files:
DEBUG: CLI Version: 8.7.0
DEBUG: CLI Args: ['/Users/exampleUser/.cache/flywheel/python-3.6.6/lib/python3.6/site-packages/flywheel_cli/main.pyc', 'import', 'dicom', '--debug', '--audit-log-path', '/Users/exampleUser/Documents/AuditLogs/AuditLog', '/Users/exampleUser/Documents/SampleData', 'example', 'project']
DEBUG: Platform: Darwin-18.7.0-x86_64-i386-64bit
DEBUG: System Encoding: UTF-8
DEBUG: Python Version: 3.6.6 (default, Jul 17 2018, 08:21:56)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
DEBUG: SDK Version: 8.2.0
DEBUG: Flywheel Site URL: https://dev.flywheel.io:443/api
DEBUG: Using source filesystem: osfs:///Users/exampleUser/Documents/SampleData
DEBUG: Ignoring non-DICOM file: Flywheel/fwtest/AmygdalaStructure/amyg_s4/amyg_s4_amyg_sess1_pcolA/DTI 2mm 30dir 2x b1000_0/8892_14_1_dti.dcm.zip
DEBUG: Ignoring non-DICOM file: Flywheel/fwtest/AmygdalaStructure/amyg_s11/amyg_s11_amyg_sess2_pcolA/test/10+cmrr_mbepi_task-spatialfrequency_s6_2mm_66sl_PA_TR1.0.dicom.zip
DEBUG: Ignoring non-DICOM file: Flywheel/psychology/Anxiety Study/anx_s2/anx_s2_anx_ses1_protA/DTI 2mm 30dir 2x b1000/8892_14_1_dti.dcm.zip
DEBUG: Ignoring non-DICOM file: Flywheel/psychology/Anxiety Study/anx_s4/anx_s4_anx_ses1_protA/DTI 2mm 30dir 2x b1000/8892_14_1_dti.dcm.zip