William Strawson
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # fMRI Lab for 23th Feb 2023 ###### With me (Will), Christina and George --- ### Aim: To get acquainted with the tools needed to generate fMRI results --- # Plan #### 1. Tools #### 2. Introduce experiment #### 3. View the raw data #### 4. Explore the design file #### 5. Preprocessing #### 6. Modelling task events #### 7. View the results #### 8. Multi-subject analysis and automation --- ![](https://i.imgur.com/BkC4dKZ.png) ---- ### Tools for neuroimaging ![](https://i.imgur.com/NPktz6w.png =400x) ###### FSL (FMRIB Software Library) is a free suite of applications from Oxford's Functional Magnetic Resonance Imaging of the Brain (FMRIB) laboratory. ###### http://mriquestions.com/best-fmri-software.html ---- ![](https://i.imgur.com/qU8ivws.png) ###### FEAT (FLAME), BET, FSLeyes ###### https://fsl.fmrib.ox.ac.uk/fsl/fslwiki --- # The Experiment Before looking at the data we will describe the experiment. ### Aim: To find the neural correlates of word-generation ###### Data and more info: https://www.fmrib.ox.ac.uk/primers/intro_primer/ExBox11/IntroBox11.html ---- This dataset is from an event-related language experiment and has three different types of events: ---- ###### - Word-generation events (WG): Here the subject is presented with a noun, say for example "car" and his/her task is to come up with a pertinent verb (for example "drive") and then "think that word in his/her head". The subject was explicitly instructed never to say or even mouth a word to prevent movement artefacts. ###### - Word-shadowing events (WS): Here the subject is presented with a verb and is instructed to simply "think that word in his/her head". ###### - Null-events (N): These are events where nothing happens, i.e. the cross-hair remains on the screen and no word is presented. The purpose of these "events" is to supply a baseline against which the other two event types can be compared. ---- ##### Within one session, the events were presented at a constant ISI (Inter Stimulus Interval) of 6 seconds. For example, the first 72 seconds (twelve events) in this session may have looked like: ### N-WS-N-WS-N-WS-N-WG-N-WS-WG-N --- ## The Data ---- # Structural MRI #### Structural images provide information about the anatomy of what's being imaged by showing differences between different kinds of tissues (Grey Matter vs White Matter vs CSF) #### Structural MRI provides high spatial resolution (0.8mm x 0.8mm x 0.8mm) images. --- # Voxels ![](https://i.imgur.com/qH5ykJi.png =400x) ---- ## Over to you (Viewing a structural image) 1. Open (type) fsleyes 2. File -> Add from file -> fsl_course_data/ExBox11/structural.nii.gz 3. Increase brightness + contrast ---- ![](https://i.imgur.com/qH5ykJi.png =150x) ##### _Voxels_: Volumetric Pixel - the basic unit of measurement. Each voxel has a coordinate in the volume ##### _Slice_: all voxels in 2D plane. ##### _Volume_: The entire 3-D grid covering the space imaged in the MRI scanner. Volume is composed of voxels ##### _TR_: One volume scanned every TR - basic time measurement in MRI --- # What about the 'f' in fMRI? ### We want to map _function_ to _structure_. ### But how do we quantify neuronal activation using non-invasive MRI? --- ## BOLD fMRI! ### _BOLD_ = Blood Oxygenation Level Dependent #### We measure the level of blood oxygenation throughout different cortical regions, and infer neuronal activation from that. ##### Based on the premise that increased blood oxygenation = increased neuronal activation. --- # Time ![](https://i.imgur.com/x506oIm.png) ### Each voxel has an associated time-series of BOLD activation. --- ![](https://i.imgur.com/qH5ykJi.png =200x) ![](https://i.imgur.com/jdPAXVB.png =400x) ###### We have measurment of BOLD for each voxel across time --- ## The raw fMRI data ![](https://i.imgur.com/uK1LbPE.png =400x) - Let's view the raw 4D data for the subject ---- #### - `home/fsluser/fsl_course_data/ExBox11` - Navigate to this directory, using the `Terminal` (or using the `files` GUI) - use `cd your_path` to change working directory - use `ls` to list files in working directory - keep this terminal window open for later ---- 1. Open program 'FSLEyes' ###### - Type `fsleyes` in Terminal/Command Line and press enter ###### - Or, open it from the FSL GUI 2. Add functional data ###### - `file` -> `add from file` -> Find: `/fsl_course_data/ExBox11/fmri.nii.gz` 3. View in Movie Mode --- ## The Analysis - To get from this raw data to the results, an analysis was conducted using `FEAT`. - We will look at the details of this analysis now. ---- ## Analysis with FEAT #### 1. Open FEAT GUI ###### - Type `fsl` in terminal & `Enter` -> Click FEAT button #### 2. Load the design file (`.fsf`) ###### - `Load` -> `/fsl_course_data/ExBox11/fmri.feat/design.fsf` ---- ##### You can think of the design file as a recipe that turns your ingredients (raw Nifti data) into a full meal (results). Having this recipe saved is useful because it means you can fully reproduce the meal again. ###### Because this dataset has already been analyzed with FEAT, a design file already exists - but for your experiments, you will need to create one yourself using this software. ##### So, let's explore the design file tab by tab. ---- ## `Data` ![](https://i.imgur.com/OBmJLA1.png =500x) ---- ## `Misc` ![](https://i.imgur.com/w0gwpKl.png =500x) - Use `Baloon help` if you want to find info on parameters ---- ## `Pre-stats` ![](https://i.imgur.com/ZqXX98Q.png =500x) - Many preprocessing options available - e.g. highpass filtering ---- ## High-pass filtering ![](https://i.imgur.com/QgXZXaX.png =500x) - Remove low-frequency (slow, < 100s) signal changes - Important due to _scanner drift_ - Let's look at the effect of HPF ---- 1. Open `FSLEyes` 2. Add `fmri.feat/filtered_func_data.nii.gz` 3. View the two time series ###### - View -> Timeseries ###### - Click `Plotting mode` drop-down -> `Demeaned` 4. Find example of high-pass filtering ###### - e.g., voxel coordinate `24,33,15` starts low and drifts upwards in unfiltered image ---- ## `Registration` ![](https://i.imgur.com/nDcYWPB.png =500x) ---- ## `Stats` ![](https://i.imgur.com/2bugX3q.png =500x) 1. Go to `Full model setup` ---- ## Model Set up ### `Explanatory Variables (EVs)` ![](https://i.imgur.com/I5EY4Fi.png =400x) ###### - Each EV models a different effect ---- ![](https://i.imgur.com/I5EY4Fi.png =200x) - View contents of these 3 column .txt files 1. Open previous terminal window 2. Type `ls` and Enter to view files in working directory 3. Type `cat word_generation.txt` and `Enter` (`cat` will print the contents of the txt file) ---- - 1st column = start time of stimulus (s) - 2nd column = duration (s) - 3rd column = intensity (1 = on) ---- ![](https://i.imgur.com/mm0rjem.png =400x) - Do the same for `word_shadowing.txt` ##### These 3 column txt files contain all the information about the timing of events in the scanner ---- ### Convolving ![](https://i.imgur.com/EKJe2AN.png =700x) ---- ### Contrasts ##### Contrasts are the way in which we express questions (alternative hypotheses). - For example, the question of whether a positive effect exists (that's associated with an EV called β1) can be expressed as β1 > 0. - Or to test if the effect size associated with one explanatory variable/IV/Predictor is larger than another can be expressed as β1 > β2. ---- ### Contrasts & F-tests ![](https://i.imgur.com/gjqJDda.png =500x) - Question: What do you think each 5 contrasts are testing? - Tip: EV1 = word generation & EV2 = word shadowing ---- #### Contrast Meanings ##### - `Generation`: this tests for when there was greater activation during word generation compared to baseline. ##### - `Shadowing`: this tests for when there was greater activation during word shadowing compared to baseline. ##### - `Mean`: this tests for when the average activation during generation and shadowing was greater than baseline. ##### - `Shad > Gen`: this tests for when there was greater activation during word shadowing compared to word generation. ##### - `Gen > Shad`: this tests for when there was greater activation during word generation compared to word shadowing. ---- ### `View design` ![](https://i.imgur.com/Lb20xsY.png =400x) ###### (If error occurs on class laptops, refer to the above picture) ---- ![](https://i.imgur.com/Lb20xsY.png =300x) ###### - After all that set-up, FEAT is now able to create a model of predicted activity for each explanatory variable (i.e. word generation / shadowing) across time. ###### - GLM will compare this model to actual BOLD activity and reveal those voxels whose activity is well explained by model i.e involved in word generation and/or shadowing. ---- - ##### We fit a model (predicted activity) to each voxel's BOLD respose (actual activity) ![](https://i.imgur.com/S4rJpKF.png =300x) ---- ![](https://i.imgur.com/S4rJpKF.png =300x) - ##### This model is built for each task event and it's goodness of fit (how well we predict the actual data) is assessed for each voxel ---- ### THIS IS THE GENERAL LINEAR MODEL ![](https://i.imgur.com/S4rJpKF.png =300x) ---- ### `Contrasts & F-tests` ![](https://i.imgur.com/gjqJDda.png =500x) ---- ## `Post-stats (thresholding)` ![](https://i.imgur.com/tTgiLWa.png =500x) - Important for controlling false positives --- ### Running the analysis #### 2 Options: - Simply press `Go` - Or, type `feat <design.fsf>` in to command line. - ...or view ready-made results! --- ## Viewing the results ![](https://i.imgur.com/u7Jm2Tf.png =500x) ---- ## Viewing the results 1. View results directory ##### - `Applications` -> `Files` -> `fsl_course_data/ExBox11/fmri.feat` 2. View results report (`report.html`) 3. See the report on registration, pre-stats and stats - these are good sanity checks ---- ## Post-stats ###### - `Post-stats` is where the real results are 1. What contrasts show significant efffect? ###### - Each contrast has an associated results image 2. View cluster based statistics ###### - Click on any contrast image --- ### Let's look at the last two results (contrasts Shad>Gen; Gen>Shad) in 3D using FSLeyes ---- ### Viewing the results in 3D 1. Open an anatomical image on which to overlay functional results ###### - Add `fmri.feat/example_func.nii.gz` 2. Overlay statistical map of contrast 4 (`fmri.feat/thresh_zstat4; Shad > Gen`) and contrast 5 (`fmri.feat/thresh_zstat5; Gen > Shad`) 3. Apply different colour maps to each ###### - To change a maps colour, select it in the overlay list and then change the colour map at the top ---- 4. Load unthresholded versions - Add `fmri.feat/stats/zstat5` - not all significant but still potentially useful --- ## Automating this process - This was a single subject analysis - imagine doing this for 50+ participants - We can use the command line for more than file navigation - We can use it to automate this process - Our design file - `design.fsf` - is simply a text file - lot's of potential --- # Summary - Hopefully now be acquainted with: 1. Bash commands in Terminal 2. fMRI analysis software FEAT 3. fMRI data/results visualization with FSLEyes - Code is Key! ---- # fMRI Analysis Resources ---- ## Ginette Mumford's FSL FEAT youtube tutorials https://www.youtube.com/watch?v=lCwewJJPd5U&list=PLB2iAtgpI4YHlH4sno3i3CUjCofI38a-3&ab_channel=mumfordbrainstats - This is a great series which takes you from start to finish of a task-based fMRI analysis using FSL's FEAT software ---- ## Andrew Jahn's FSL videos https://www.youtube.com/watch?v=9ionYVXUQn8&list=PLOPaMln1VugP5sSKaa_KMmrrVXMJTMrLi&ab_channel=AndrewJahn - More examples of scripting + FSL ---- ## MIT General Linear Model for fMRI - 3 part lecture series that explains the general linear model nicely. These were the videos that made the GLM and task-design click. - Theoretical understanding of the principles of the method ---- ## FSL's FEAT tutorial https://www.fmrib.ox.ac.uk/primers/intro_primer/ExBox11/IntroBox11.html - Example data here https://fsl.fmrib.ox.ac.uk/fslcourse/lectures/practicals/feat1/index.html - More explation here ---- https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FEAT/UserGuide - The master guide to FEAT ---- ## GLM Hanbook https://www.fmrib.ox.ac.uk/primers/appendices/glm.pdf --- Attendence sheet

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully