Skip to content

Commit

Permalink
added advanced fmri tools page to workshop 7
Browse files Browse the repository at this point in the history
  • Loading branch information
sohaamir committed Jan 13, 2025
1 parent 436dfd1 commit 44ddcf3
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 35 deletions.
24 changes: 0 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ This README is primarily for students, and will help you navigate the course mat
## Table of contents

- [Course Overview](#course-overview)
- [Workshop Schedule](#-workshop-schedule)
- [Getting Started](#getting-started)
- [Support and Contact](#support-and-contact)
- [Course-related Issues](#-course-related-issues)
Expand All @@ -34,29 +33,6 @@ This README is primarily for students, and will help you navigate the course mat

The series of workshops collectively provide <b>a comprehensive introduction to Magnetic Resonance Imaging (MRI) techniques in cognitive neuroscience, including the analysis of diffusion and functional magnetic resonance imaging (fMRI) data</b>. In doing so, you will also learn how to access the BEAR Portal, BlueBEAR and basic programming skills required for working with neuroimaging data (e.g., Linux commands and bash scripting).

## 📅 Workshop Schedule

The MRICN course during Spring Term 2024-25 will have the following dates (subject to change):

<div align="center">

| **Week** | **Date** | **Workshop** |
|:--------:|:--------:|:------------:|
| Week 1 | TBD | No workshop |
| Week 2 | TBD | [Introduction to BlueBEAR and Linux](https://chbh-opensource.github.io/mri-on-bear-edu/workshop1/workshop1-intro/) |
| Week 3 | TBD | No workshop |
| Week 4 | TBD | [Basic MRI Skills](https://chbh-opensource.github.io/mri-on-bear-edu/workshop2/workshop2-intro/) |
| Week 5 | TBD | [Basic diffusion MRI analyses](https://chbh-opensource.github.io/mri-on-bear-edu/workshop3/workshop3-intro/) |
| Week 6 | TBD | MRI demo at the CHBH (optional) |
| Week 7 | TBD | [Advanced diffusion MRI analyses](https://chbh-opensource.github.io/mri-on-bear-edu/workshop4/workshop4-intro/) |
| Week 8 | TBD | [First-level fMRI analysis](https://chbh-opensource.github.io/mri-on-bear-edu/workshop5/workshop5-intro/) |
| Week 9 | TBD | No workshop (Reading Week) |
| Week 10 | TBD | [Bash scripting, submitting jobs, and containers](https://chbh-opensource.github.io/mri-on-bear-edu/workshop6/workshop6-intro/) |
| Week 11 | TBD | [Higher-level fMRI analysis](https://chbh-opensource.github.io/mri-on-bear-edu/workshop7/workshop7-intro/) |
| Week 12 | TBD | [Functional connectivity](https://chbh-opensource.github.io/mri-on-bear-edu/workshop8/functional-connectivity/) (optional) |

</div>

Workshops will be held at Computer Room G19, Gisbert Kapp, at the School of Psychology.

## Getting Started
Expand Down
Binary file added docs/assets/images/main_page/cc_by_sa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions docs/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ Many thanks to our contributors for creating and maintaining these resources!
<!-- ALL-CONTRIBUTORS-LIST:END -->

!!! success "Acknowledgements"
Thank you to Charnjit Sidhu for their help and support in developing these materials!

<h2>License</h2>
MRI on BEAR is hosted on [GitHub](/~https://github.com/chbh-opensource/mri-on-bear-edu). All content in this book (ie, any files and content in the `docs/` folder) is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)](https://creativecommons.org/licenses/by-sa/4.0/deed.en) license. Please see the `LICENSE` file in the GitHub repository for more details.
Thank you to Charnjit Sidhu for their help and support in developing these materials!
20 changes: 13 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This website contains workshop materials created for the MSc module 'Magnetic Re

<div style="margin-top: 30px;"></div>

[Magdalena Chechlacz](https://www.birmingham.ac.uk/staff/profiles/psychology/chechlacz-magda) is an Assistant Professor in Cognition and Ageing at the School of Psychology, University of Birmingham. She initially trained and carried out a doctorate in cellular and molecular biology (2002). After working as a biologist (Larry L. Hillblom Foundation Fellowship at the University of California, San Diego) she decided on a career change to a more human-oriented science and neuroimaging. In order to gain formal training in cognitive neuroscience and neuroimaging, she completed a second doctorate in psychology at the University of Birmingham under the supervision of Glyn Humphreys (2012). From 2013 to 2016, she held a British Academy Postdoctoral Fellowship and EPA Cephalosporin Junior Research Fellowship, Linacre College at the University of Oxford. In 2016, Dr Chechlacz returned to the School of Psychology, University of Birmingham as a Bridge Fellow.
[Magdalena Chechlacz](https://www.birmingham.ac.uk/staff/profiles/psychology/chechlacz-magda) is an Assistant Professor in Cognition and Ageing at the School of Psychology, University of Birmingham. She initially trained and carried out a doctorate in Cellular and Molecular Biology in 2002, and after working as a biologist at the University of California, San Diego, decided on a career change to a more human-oriented science and neuroimaging. She completed a second doctorate in psychology at the University of Birmingham under the supervision of Glyn Humphreys in 2012, and from 2013 to 2016, held a British Academy Postdoctoral Fellowship and EPA Cephalosporin Junior Research Fellowship at Linacre College, University of Oxford. In 2016, Dr Chechlacz returned to the School of Psychology, University of Birmingham as a Bridge Fellow.

<br>
<p>
Expand All @@ -63,18 +63,24 @@ This website contains workshop materials created for the MSc module 'Magnetic Re
| Workshop | Key Concepts/Tools |
|----------|-------------------|
| [Getting Started](https://chbh-opensource.github.io/mri-on-bear-edu/setting-up/) | BEAR Portal, BEAR Storage, BlueBEAR |
| [Workshop 1](https://chbh-opensource.github.io/mri-on-bear-edu/workshop1/workshop1-intro/) | BlueBEAR GUI, Linux commands, Terminal basics |
| [Workshop 2](https://chbh-opensource.github.io/mri-on-bear-edu/workshop2/workshop2-intro/) | NIFTI/DICOM format, FSLeyes viewer, MRI atlases |
| [Workshop 3](https://chbh-opensource.github.io/mri-on-bear-edu/workshop3/workshop3-intro/) | DTI preprocessing, DTIfit, TBSS, BET |
| [Workshop 1](https://chbh-opensource.github.io/mri-on-bear-edu/workshop1/workshop1-intro/) | BlueBEAR GUI, Linux commands |
| [Workshop 2](https://chbh-opensource.github.io/mri-on-bear-edu/workshop2/workshop2-intro/) | MRI data formats, FSLeyes, MRI atlases |
| [Workshop 3](https://chbh-opensource.github.io/mri-on-bear-edu/workshop3/workshop3-intro/) | DTIfit, TBSS, BET |
| [Workshop 4](https://chbh-opensource.github.io/mri-on-bear-edu/workshop4/workshop4-intro/) | Probabilistic tractography, BEDPOSTX, PROBTRACKX |
| [Workshop 5](https://chbh-opensource.github.io/mri-on-bear-edu/workshop5/workshop5-intro/) | Advanced BET, FEAT, First-level fMRI analysis |
| [Workshop 5](https://chbh-opensource.github.io/mri-on-bear-edu/workshop5/workshop5-intro/) | FEAT, First-level fMRI analysis |
| [Workshop 6](https://chbh-opensource.github.io/mri-on-bear-edu/workshop6/workshop6-intro) | Bash scripting, Submitting jobs, Containers |
| [Workshop 7](https://chbh-opensource.github.io/mri-on-bear-edu/workshop7/scripting-fsl/) | Group-level fMRI analysis, Fixed/Random effects |
| [Workshop 7](https://chbh-opensource.github.io/mri-on-bear-edu/workshop7/scripting-fsl/) | Higher-level fMRI analysis, FEATquery |
| [Workshop 8](https://chbh-opensource.github.io/mri-on-bear-edu/workshop8/functional-connectivity/) | Resting-state fMRI, Functional connectivity, Neurosynth |

<br>

!!! info "Accessing additional course materials"
If you are a CHBH member and would like access to additional course materials (lecture recordings etc.), please contact one of the teaching staff members listed above.

<br>
## License

MRI on BEAR is hosted on [GitHub](/~https://github.com/chbh-opensource/mri-on-bear-edu). All content in this book (i.e., any files and content in the `docs/` folder) is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)](https://creativecommons.org/licenses/by-sa/4.0/deed.en) license. Please see the `LICENSE` file in the GitHub repository for more details.

<p>
<img src="assets/images/main_page/cc_by_sa.png" alt="CC-BY-SA" width="100" height="200">
</p>
135 changes: 135 additions & 0 deletions docs/workshop7/advanced-fmri-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Advanced fMRI analysis tools

The materials included in this worksheet follows on from the previous two FSL-specific fMRI workshops: in the first workshop you ran first level fMRI analysis, whilst in the second workshop you combined the data across scans within each participant (second level analysis) and across the group (third level analysis) in a couple of different ways.

The information included in this page covers:

- The effect of changing threshold and correction methods
- T-tests vs F-tests
- Dealing with large motion artefacts (`fsl_motion_outliers`)
- How to extract ROI statistics from specific regions of interest (using FEATquery)

<b>As in the other materials we will not discuss in detail why you might choose certain parameters.</b> The aim is to familiarise you with some of the available analysis tools. This worksheet will take you, step by step, through these analyses using the FSL tools. You are encouraged to read the pop-up help throughout (hold your mouse arrow over the FSL gui buttons and menus), refer to your lecture notes lectures or resource list readings. You can also find more information on the [FSL website](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FEAT/UserGuide).

If you have correctly followed the instructions from the previous workshops, you should by now have 29 first-level FEAT directories for the analysis of each scan of each participant:

`/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/1/`

e.g. `/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/1/p01_s1.feat`

(1 feat analysis directory for participant 1, 1 for participant 2, 3 for participant 5, and 2 for everyone else).

At the second-level you should have 13 simple within-subjects fixed-effects directories:

`/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/2/`

e.g. `/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/ 2/p03.gfeat`

(one each for participants 3-15)

You should also have a directory:

`/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/2/level2all.gfeat` (for the all-participants-all-runs second level model)

Finally, you should have 2 third-level group analysis folders:

`/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/3/GroupAnalysis1.gfeat`

`/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/3/GroupAnalysis2.gfeat`

(containing the third level group analyses corresponding to the two different ways of combining data at third level)

## Testing the effects of different thresholds

<b>Try as many of the suggestions below as you have time for. I suggest trying 1 or 2 at the start of the session and returning to these later if you have time, or outside the workshop.</b> (You can load up an existing model by running FEAT and using the 'Load' button. The model file will be called `design.fsf` and can be found in the `.feat` or `.gfeat` directory of an existing analysis folder.)

1. <b>Ordinary Least Squares (OLS) vs FLAME:</b>
Repeat the third level group analyses from FSL Workshop 5, but on the 'Stats' tab select 'Mixed Effects: Simple OLS'

2. <b>Different correction for multiple comparisons:</b>
Repeat the third level group analyses from FSL Workshop 5, but on the 'Post-Stats' tab for 'Thresholding', use the pull down menu to select 'Voxel correction'.

3. <b>Different thresholds and correction for multiple comparisons:</b>
Repeat the third level group analyses from FSL Workshop 5, but on the 'Post-Stats' tab use 'Cluster Thresholding' but choose a different z-threshold.

!!! tip "Examining the results"
Look at the results from each method of correction. Use both the webpage output and FSLeyes to look at your data. Find the regions of significant activation. Try looking at a time series (see the 'Data Visualisation' workshop notes for help).

## T-test vs F-test

Start up a FEAT GUI, by opening a new terminal window and typing `fsl &`. Click on the 'Feat' button [or type `Feat &` in the terminal window to directly open the FEAT GUI].

Load up one of the third level analyses run in the last workshop (e.g., 'GroupAnalysis1' or 'GroupAnalysis2').

Now follow the instructions below:

<b>Data Tab</b>

- Change the 'Output' directory name to be something different, for example 'GroupAnalysis1_Ftest'

<p align="center">
<img src="../../assets/images/workshop7/higher-level-analysis/tests_tab.png" alt="Tests Tab" width="400" height="300">
</p>

<b>Stats Tab</b>

- Click on the 'Full model setup' button and select the 'Contrasts and F-tests' tab

- Change the number of 'F-tests' from 0 to 1. When you do this, the interface will update and a check box will appear on the right hand side of the group mean contrast. Select the check box (toggle it from off to on).

- Click the 'Done' button, check and dismiss the pop-up window and press the 'Go' button

<p align="center">
<img src="../../assets/images/workshop7/higher-level-analysis/tests_glm.png" alt="Tests GLM" width="200" height="300">
</p>

!!! example "Differences between t-test and F-test images"
Once it has run inspect the resulting output in a browser. How does the rendered stats image for the F-test (the `zfstat` image) differ from the t-stat image? Why are they different?

## Extracting information from Regions of Interest (ROIs) using FEATquery

[FEATquery](https://ftp.nmr.mgh.harvard.edu/pub/dist/freesurfer/tutorial_packages/centos6/fsl_507/doc/wiki/FEAT(2f)UserGuide.html#Featquery_-_FEAT_Results_Interrogation) is an FSL tool which allows you to explore FEAT results by <b>extracting information from regions of interests within specific (MNI) coordinates or using a mask.</b>

In the examples below we will get basic stats from two pre-prepared Regions of Interest (ROIs) using the first level models that you have run. You can also make your own ROIs using FSLeyes (you should remember how to create ROI masks from previous workshops).

To start FEATquery, you need to load FSL (see previous workshops), and either - in a terminal - type `Featquery &` or on the FSL GUI click the button on the bottom right labelled 'Misc' and select the menu option 'Featquery'.

In any case, when FEATQuery is open, following the instructions below:

<p align="center">
<img src="../../assets/images/workshop7/higher-level-analysis/featquery.png" alt="FEATquery" width="400" height="300">
</p>

<b>Input FEAT directories</b>

- Keep the 'Number of Feat Directories' set to 1.
- Click the 'Select' button next to it and choose one of your first-level analysis `.feat` directories (e.g. `/rds/projects/c/chechlmy-chbh-mricn/xxx/feat/1/p01_s1.feat`) and then click the 'OK' button

<b>Stats images of interest</b>

Once you have done that the GUI interface will update and you will see a list of possible statistics.

- Click the checkbox next to `stats/cope 1` and `stats/zstat 1` (and any others you would like to see summarised).

<b>Input ROI selection</b>

For the 'Mask image' entry select either one of the prepared masks.

Either:

`/rds/projects/c/chechlmy-chbh-mricn/module_data/masks/V1.nii.gz`

or

`/rds/projects/c/chechlmy-chbh-mricn/module_data/masks/Parietal.nii.gz`

<b>Output options</b>

- Click the checkbox next to 'Convert PE/Cope values to %'
- Make sure the check box next to 'Popup results in web browser' is checked on
- Change the 'Featquery output directory name' from the default to something meaningful and related to the mask name e.g. 'V1'

When ready, click the 'Go' button!

!!! example "Examining the FEATquery output"
Inspect the results by opening `report.html` inside the 'V1' folder. Do they make sense?
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ nav:
- Workshop 7 - Higher-level fMRI analysis:
- Workshop 7 - Aims and objectives: workshop7/workshop7-intro.md
- Running the higher-level analysis: workshop7/higher-level-analysis.md
- Advanced fMRI analysis tools: workshop7/advanced-fmri-tools.md
- Workshop 8 - Functional connectivity:
- Functional connectivity analysis of resting-state fMRI data using FSL: workshop8/functional-connectivity.md
- Additional Resources: resources.md
Expand Down

0 comments on commit 44ddcf3

Please sign in to comment.