Flywheel Tutorial
Date: February 24, 2025 3:56 PM
FLYWHEEL LINK: https://cahbir-flywheel.rutgers.edu/#/projects
Table of Contents
- Flywheel Tutorial
- High level process
- How to change file names (if necessary):
- Ignoring Files
- Download Files
- Add Files to Projects/Sessions/Subjects
- Flywheel Storage & Pipeline Rules
- BIDS process
- fMRIPrep process
- Misc
- Command Line
- Add Additional Documents
- Flywheel Storage & Pipeline - only put active CAHBIR center data
- Data-Viewer
High level process
- Download data to amarel
- Multi-echo multi-band Convert using Jeff custom method
- reproIn
- this assigns echo1 echo2 echo3 to the bids name
- then it does the dcm2niix
- Then the MRI Tech uploads the data to flywheel
- Then you send to BIDS Curation
- then you send to fMRIPrep
- Then download subject to box OR open flywheel on Amarel desktop and download to amarel, or use custom python script to download to Amarel
- Then share
How to change file names (if necessary):
Tutorial by flywheel devs: https://docs.flywheel.io/Developer_Guides/dev_bids_curation_2_precuration/
- Go to your Project tab
- click on Subjects tab and select the subject you’d like to run
- Go to Analysis tab
- Click Run analysis gear
- Click “Bids Pre-Curation” or “relabel container” (they’re equivalent)
- put in no inputs, leave everything blank
- run gear
- Go to subjects tab
- to go “provenance” tab in subject to see the job running
- refresh for new update— not live view
- if fails, click on the “View Log” button
- read the error log to figure out
- ask Wil if need be
- When finished, go to “analysis” tab at the TOP (not within “Subject”)
- click on the job Bids pre-curate
For the files, if you need to make edits, press on the 3 dots and then press “Download”
acquisitions.csv
sessions.csv
subjects.csv
- make the edits in excel
- in flywheel, in the project tab, press “information” tab
- press ‘upload’
- upload the .csv that you made edits to
- This keeps the version history of all the prior csv versions— so if you upload a document that is wrong, you can just restore an old version
Ignoring Files
If you need to ignore 1-3 images into .bidsignore…
Flywheel Tutorial: Ignoring Certain Images in Bids
- Go to your Project tab
- click on Subjects tab and select the subject you’d like to run
- go to Sessions tab
- make sure you’re on “Acquisitions” tab
- optional: Turn on “BIDS View”
- click on the 3 dots to the right of the “Run Gear’ button
- click on the on-switch for “BIDS View”
- click on the file you want to ignore
- in the popup, go to “Information” tab
- scroll down to the small section which says “BIDS” and has a carrot “^”
- Press on the carrot to expant the BIDS information
- Scroll down to the line “ignore []” and check the box
- Press “save” on the popup
- Repeat steps 6-11 for any files you want to ignore
If you need to ignore many images based on rules…
- click on your project tab
- Go to “Information”
- In files find template nordic_extension_template.json If it’s not already uploaded, upload into the project files nordic_extension_template.json, by clicking on: - Project Name (in side navigation bar) - Information tab - Attachments box - ‘Upload’ button
- Click on the 3 dots in the template row and click “Download”
- Open file in an editor
- in the “initializers:” section, paste in your code
for example, this skips any files which start with “fmap_” or “fmap-” and end with “SBRef” or “Pha”, and skips any files which end with “_e2” or “_e3”
{
"rule": "reproin_fieldmap_file",
"where": {
"acquisition.label": {
"$regex": "fmap(-|_).*(SBRef|Pha)+$"
}
},
"initialize": {
"ignore": true
}
},
{
"rule": "reproin_fieldmap_file",
"where": {
"file.name": {
"$regex": "_e(2|3)\\.(nii(\\.gz|)|json)$"
},
"acquisition.label": {
"$regex": "fmap(-|_)"
}
},
"initialize": {
"Suffix": "echo",
"ignore": true
}
},
Download Files
The command line is where you can download BIDS files to Amarel/local computers, as well as download individual subjects or acquisitions quickly.
See how to set up and use it on the Flywheel CLI Tutorial.
Add Files to Projects/Sessions/Subjects
Flywheel allows ‘ad-hoc’ upload, so you can add any type of file to a dataset.
For project-level (templates, etc): Click on: - Project Name (in side navigation bar) - Information tab - Attachments box - ‘Upload’ button
For acquisition or subject files: Click on: - Project Name (in side navigation bar) - ‘…’ vertical dot menu - ‘Imports’ - ‘Add Data’
Flywheel Storage & Pipeline Rules
- No restrictions for the amount of data
- But we’re charged for the data since it’s stored in google cloud
- In general it won’t cause a problem
- Can keep all your scanning data on flywheel
- More likely to stay stable than stuff you take off and put on amarel
- After every session of fMRI scanning at CAHBIR the scan tech is going to automatically send data from the scanner to flywheel
- multi-band multi-echo will go up but will go up a little later since Jeff has to do another step
- compress-sensing MP2Rage
- Double check that the information you want in flywheel is being transferred after the data is put into flywheel
- You should definitely do a test or two with your pipeline
BIDS process
- click on the project you want to look at (ie ConteCenter, PCX)
- click on ”Sessions” tab
- Make sure you’re on “Acquisitions” tab
- Click ‘Run Gear’
- Select ‘Analysis Gear’
- Select ‘BIDS Curation’
- Click on the project name
- ‘Inputs’ tab:
- click on “template”
- click on ConteCenter or your project name (in the folder path)
- select the nordic_extension_template.json
- locates and assigns the echoes their proper echo name
- ignores single band reference images and phase images for fieldmaps
- If it’s not already there, upload it to the project files by clicking on:
- Project Name (in side navigation bar)
- Information tab
- Attachments box
- ‘Upload’ button
- ‘Configuration’ tab:
- First: you need to specify the regexes in pairs, each element separated by a space.
- To attach all fmap to their relevant BOLD images:
fmap-.* .*bold.nii.gz
You have to match the fmap container to the functional images containers. Our containers for Conte/PCX are (both AP and PA):fmap-epi_dir-AP_BOLD_NORDIC_run-01
fmap-fieldmap_acq-B0
fmap-phasediff_dir-AP
Our functional images are
- func-epi_task-
_BOLD_NORDIC_run-01
So to map (fill intendedFor field) every fmap to the functional images, use
fmap-.* .*bold.nii.gz
EX: To just map epi fmaps to the functional images, usefmap-epi_.* .*bold.nii.gz
- To attach all fmap to their relevant BOLD images:
- Reset: YES
- Ignore Config File: YES
- Save idecar as Metadata: NO
- the JSON sidecars of the data to fill in the configuration, but you can add additional stuff in the tab that isn’t in the sidecars
- First: you need to specify the regexes in pairs, each element separated by a space.
- Go to jobs log tab to track usage or errors
- Select subject/job
- Select ‘log’ tab
- Refresh to see current— not in real time
Getting BIDS to work on Flywheel
fMRIPrep process
- ‘Run gear’
- ‘run analysis gear’
- NOT ‘fMRIPREP: A robust…”
- Select “BIDS Apps: BIDS fMRIPrep” to run
- Input
- Add in your FreeSurfer license file freesurfer_license_jun2024.txt
- way1: copy contents of text file > configuration > ‘gear FREESURFER LICENSE’
- way2: Information > Attachments > Attach freesurfer license .txt
way3: Information > Custom Information > ‘+’ called FREESURFER_LICENSE > copy paste the .txt file into there
# my freesurfer license: josskaley@gmail.com 76240 *CV/FoHsRCHG2 FSog2TzUed5Oc /acN2e0Wjauej8YOxxyyIFs1Jqd30/Kl3WV41M3fnfQ=
- Add in your FreeSurfer license file freesurfer_license_jun2024.txt
- Job Tags: ‘extra-large’
- Configuration -
- most recent is 1.5.1_24.0.0, but can choose your version
- bids_app_command for PCR:
Finally, press ‘Run Gear’
Wait 12-24 hours
Getting fMRIPrep to work on Flywheel
Misc
Command Line
- set up a command line interface
- initials > profile > flywheel CLI Classic > download Classic CLI > setup API key (copy it while it’s there, it will never be visible again) > use command line to export your project in bids format
- you can do this on amarel and export directly to amarel
Add Additional Documents
- ‘ad-hoc’ upload
- can add any type of file to a dataset
Flywheel Storage & Pipeline - only put active CAHBIR center data
- no restrictions for the amount of data
- but we’re charged for the data since it’s stored in google cloud
- but in general it won’t cause a problem
- Can keep all your data on flywheel
- more likely to stay stable than stuff you take off and put on amarel
- After every session of fMRI scanning at CAHBIR the scan tech is going to automatically send data from the scanner to flywheel
- multi-band multi-echo will go up but will go up a little later since Jeff has to do another step
- compress-sensing MP2Rage
- Double check that the information you want in flywheel is being transferred after the data is put into flywheel
- You should definitely do a test or two with your pipeline
Data-Viewer
- little picture icon on the right of the dicom
- can also double check that your files are right
Gear Exchange
- flywheel.io/gear-exchange/
- if there’s any there you want and aren’t currently installed on our flywheel, let Wil / CAHBIR-support know, and they’ll ask flywheel to add it
- You can also make requests for flywheel to make a gear, though we don’t know how quickly that might happen
Other
- Wil custom python script
- will unzip and grab specific files and put them where you want them to be
Questions
- Flywheel has robust documentation
- or email flywheel directly with ‘give us feedback’ (opens up a ticket)
Data-Viewer
- little picture icon on the right of the dicom
- can also double check that your files are right
Gear Exchange
- flywheel.io/gear-exchange/
- if there’s any there you want and aren’t currently installed on our flywheel, let Wil / CAHBIR-support know, and they’ll ask flywheel to add it
- You can also make requests for flywheel to make a gear, though we don’t know how quickly that might happen
Other
- Wil custom python script
- will unzip and grab specific files and put them where you want them to be
- Questions
- Flywheel has robust documentation
- or email flywheel directly with ‘give us feedback’ (opens up a ticket)