psyc410_s2x:fmri_part1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
psyc410_s2x:fmri_part1 [2025/03/22 09:35] – [Laboratory Report] admin | psyc410_s2x:fmri_part1 [2025/03/22 11:06] (current) – removed admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <WRAP centeralign> | ||
- | <typo ff:' | ||
- | Lab 7: fMRI Part 1: Signal and Noise </ | ||
- | </ | ||
- | |||
- | ====== Information, | ||
- | |||
- | |||
- | Today we will begin a several part lab exercise series devoted to the analysis of functional MRI data. In our next session, we will use the FSL (__F__MRIB __S__oftware __L__ibrary) package created by the [[http:// | ||
- | ===== Assigned Readings / Videos: ===== | ||
- | |||
- | * {{ : | ||
- | |||
- | /* | ||
- | <WRAP centeralign>// | ||
- | |||
- | * {{ : | ||
- | */ | ||
- | ===== Goals for this lab: ===== | ||
- | |||
- | * Explore different fMRI data sets to observe how a simple task alters voxel intensity in a fMRI time series. | ||
- | * Visually inspect a data set to identify activated voxels. | ||
- | * Use a simple correlational approach to identify activated voxels using one or two templates. | ||
- | |||
- | |||
- | ===== Software introduced in this lab ===== | ||
- | |||
- | * n/a | ||
- | ===== Laboratory Report ===== | ||
- | <WRAP center round important 70%> | ||
- | <WRAP centeralign>< | ||
- | * Throughout this (and all) lab exercise pages you will find instructions for your lab reports within these boxes. | ||
- | |||
- | * For many of the figures you are asked to create for this lab report you are __not__ required to create high quality figures. A simple screen shot will suffice. However, it should be cropped so that it only depicts the relevant information. In each lab report box I indicate whether it requires high-quality figures or simple screenshots. | ||
- | </ | ||
- | |||
- | ===== Housekeeping ===== | ||
- | <WRAP center round todo 70%> | ||
- | |||
- | (remember to press RETURN after pasting commands into the '' | ||
- | |||
- | **1.** Create your output directory for tonight | ||
- | <code bash> | ||
- | rm -r / | ||
- | mkdir -p / | ||
- | </ | ||
- | |||
- | **2.** Download the analysis scripts for tonight' | ||
- | * Click on [[https:// | ||
- | * Download the zip file (click the download arrow, then select '' | ||
- | * If the zip file goes to your Downloads directory, then move it to your Desktop | ||
- | |||
- | **3.** Unzip the scripts and move them to your output directory | ||
- | <code bash> | ||
- | cd ~/Desktop | ||
- | unzip fmri_lab01.zip | ||
- | rm -rf __MACOSX | ||
- | </ | ||
- | |||
- | **4. ** Put fMRI scripts in relevant directories | ||
- | <code bash> | ||
- | mv ~/ | ||
- | rm ~/ | ||
- | mv ~/ | ||
- | rm -rf ~/ | ||
- | </ | ||
- | |||
- | **5. ** Add path to your MATLAB startup file | ||
- | * Open '' | ||
- | * Open your startup file for editing | ||
- | <code matlab> | ||
- | * Copy and paste the following text into the file. | ||
- | <code matlab> | ||
- | addpath / | ||
- | addpath / | ||
- | </ | ||
- | * Save and close the file '' | ||
- | * Run the file by typing the following in the command window | ||
- | <code matlab> | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== Data used in this lab ===== | ||
- | |||
- | We will use different datasets throughout the lab. They will be described in detail in the relevant parts of the lab. What they all have in common is that they are what we would call **Block designs**. | ||
- | |||
- | A **" | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ====== Part 1: Visual Inspection of High-Resolution Data ====== | ||
- | |||
- | We will start here by looking at a visual evoked response, followed by a motor task. Our goal for each task will be to find a voxel in the brain that is activated by a given task. | ||
- | |||
- | <WRAP center round info 100%> | ||
- | Note that this part is looking at **high-resolution fMRI data** (2mm x 2mm x 2mm), which is different from the data that you will be looking at in Part 2. In this section our data has sufficient anatomical detail (not great, but sufficient) for us to make out the different sulci and gyri. This higher resolution is thanks to recent advances in parallel imaging. Some of our datasets later on will not have this level of detail due to their acquisition with more conventional fMRI acquisition sequences | ||
- | </ | ||
- | |||
- | ===== Data for Part 1 ===== | ||
- | |||
- | Data for Part 1 of the lab can be found in ''/ | ||
- | * visual response task | ||
- | * motor task | ||
- | /* * and a biological motion perception task. */ | ||
- | | ||
- | ==== Task Design - Part 1 ==== | ||
- | Each of the tasks used a **block design** (see [[#Data used in this lab|above]]) that had the following common construction: | ||
- | * 115 volumes with TR = 2 sec | ||
- | * Each run of each task had the following construction | ||
- | * '' | ||
- | * Each '' | ||
- | * There were 7 blocks for each task for a total of 14 blocks | ||
- | |||
- | === Visual Response Task === | ||
- | * '' | ||
- | * '' | ||
- | |||
- | === Motor Task === | ||
- | * '' | ||
- | * '' | ||
- | |||
- | //Note:// These tasks are essential the same as those used in the three original 1992 fMRI papers. | ||
- | ===== Visual Task ===== | ||
- | |||
- | |||
- | ==== Read in and Display data ===== | ||
- | |||
- | **1.** Open '' | ||
- | |||
- | <code bash> cd ~/ | ||
- | |||
- | **2.** Open [[http:// | ||
- | |||
- | <code bash> | ||
- | fsleyes | ||
- | </ | ||
- | |||
- | **3.** Load the data file: | ||
- | * '' | ||
- | * select '' | ||
- | |||
- | <WRAP center round info 100%> | ||
- | We know right away that this is a T2 (actually, T2*) weighted image because the white matter is grey and the grey matter is white. As noted [[#Data for Part 1|above]] it is an EPI image at a resolution of 2 mm< | ||
- | |||
- | The dataset is 104 x 100 x 60 x 115. This means that we have 104 voxels in the x-dimension, | ||
- | |||
- | <WRAP center round tip 85%> | ||
- | You can jump to any of the locations in this 4D matrix using the '' | ||
- | |||
- | **Note:** '' | ||
- | |||
- | Many computer languages count from zero rather than one. That is, if you had three items in a list, you would count them as " | ||
- | |||
- | **Also note:** FSLeyes displays the brains in “radiological” convention. This means that the left hemisphere is displayed on the right of the screen, and vice-versa. | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | === Selecting time points === | ||
- | |||
- | By default, '' | ||
- | |||
- | **4. ** To appreciate that we now have a time dimension, let's watch a movie of the data. | ||
- | * Click on the '' | ||
- | * Slide the '' | ||
- | * This controls the speed at which the movie will play | ||
- | * Close the **View settings** window | ||
- | * Click on the '' | ||
- | * To have a better view, you might want to turn off the crosshairs by clicking on the '' | ||
- | |||
- | {{ : | ||
- | |||
- | |||
- | <WRAP center round tip 100%> | ||
- | Can you observe the motion of the subject' | ||
- | </ | ||
- | |||
- | **5. ** Click on a voxel somewhere in the [[https:// | ||
- | |||
- | Knowing what you know about the [[#Task Design - Part 1|task parameters]], | ||
- | |||
- | You might notice some pulsation going on but probably find //very// it difficult to pinpoint regions with task-related activity. This should give us a hint that the signal-to-noise ratio is not too favorable or given the massive amounts of different voxels - **we cannot easily detect a signal with the naked eye**. | ||
- | |||
- | **6. ** Stop movie mode by clicking on the '' | ||
- | |||
- | ==== Find a Highly Responsive Voxel ==== | ||
- | |||
- | A moment ago you viewed a movie of the signal in each voxel (brightness) changing over time. Here, we will instead look at the **time-series** from specific voxels. A time-series for this study would simply be a list of 115 values. At each voxel, we'd have a signal intensity for each of the 115 volumes. We actually have 624,000 separate time-series; | ||
- | |||
- | |||
- | If we found a responsive voxel-one that reflected a response to the task-what do you think its time-series would look like? Remember that each hemifield is stimulated in 12-second blocks. What part of the brain do you expect to respond to this stimulation? | ||
- | |||
- | **7. ** Let's look at the time-series data from individual voxels | ||
- | * '' | ||
- | * You'll be doing this a lot tonight, so you might want to remember the keyboard shortcut to open a timeseries: '' | ||
- | |||
- | You should now have a new window at the bottom of the screen that displays the voxel time-series. The y-axis represents the intensity of the BOLD signal and the x-axis represents the different time-points. | ||
- | |||
- | <WRAP center round info 65%> | ||
- | The change in signal intensity across time depicted as a time waveform is the very same signal variation that was depicted as changes in gray scale intensity when we viewed the movie mode (but for the selected voxel only). | ||
- | </ | ||
- | |||
- | |||
- | **8.** Now click around in the visual cortex until you find a really nice looking time-series. **You might consider focusing your search in and around the [[https:// | ||
- | |||
- | <WRAP center round tip 100%> | ||
- | Once you're in the right " | ||
- | |||
- | However, don't drive yourself nuts trying to find the //very best// voxel activated by the task. Your goal now is to get familiar with the data, viewing time-series, | ||
- | |||
- | If you've spent **__at least__ several minutes** minutes looking and have been unable to find a responsive voxel, then you can cheat. If you highlight the text below it will reveal good voxel coordinates. But I'll be sad if all of your lab reports show these same voxels. You don't want to make me sad...do you? | ||
- | |||
- | Highlight below if you're a cheating cheater: \\ | ||
- | <fc # | ||
- | <fc # | ||
- | <fc # | ||
- | </ | ||
- | |||
- | |||
- | ===== LAB REPORT Part 1 #1 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 1 #1 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Create a figure depicting the time-series from a responsive voxel in the right hemisphere //and// a responsive voxel in the left hemisphere. | ||
- | * For these screenshots you do __not__ need to create " | ||
- | * Compare the two time-series. | ||
- | * Are they the same/ | ||
- | * Why? | ||
- | </ | ||
- | ===== Motor Task ===== | ||
- | |||
- | In this task, participants were asked to squeeze their hands at particular times. Thus, we should find particular regions in the brain (e.g., motor regions) that will show increases in brain activity when the participant is squeezing their hand. | ||
- | |||
- | **9.** Load the data file: | ||
- | * '' | ||
- | * Select '' | ||
- | * Make the checkerboard data invisible by clicking on the blue eye in the **Overlay list**. Alternatively, | ||
- | |||
- | ==== Finding the Motor Cortex ==== | ||
- | |||
- | You can focus your search for a good-looking time-series to the [[https:// | ||
- | |||
- | I'm afraid that finding the hand area of motor cortex will be a bit harder than finding the early visual areas in the previous part of the lab. Below are some MRI images indicating the location of this region (click to embiggify). Note: most of these images are 1 mm< | ||
- | |||
- | {{: | ||
- | {{ : | ||
- | {{ : | ||
- | |||
- | Another hint to finding the hand area is to first find the superior frontal sulcus, which runs anterior-posterior, | ||
- | |||
- | {{ : | ||
- | |||
- | Even after finding the correct brain region, you might have some trouble finding a good voxel. At this point, I would suggest you use the keyboard arrow keys to move the crosshair by one voxel in a systematic way. | ||
- | |||
- | <WRAP center round tip 100%> | ||
- | You might remember the motor cortex from the DTI lab. The [[https:// | ||
- | </ | ||
- | |||
- | Here's a slice that includes the hand-area...can you spot the motor cortex hand region? | ||
- | |||
- | {{ : | ||
- | |||
- | |||
- | <WRAP center round tip 100%> | ||
- | |||
- | If you're unable to find a good voxel despite making an an honest __**good effort**__, and if you're still a cheating cheater.... | ||
- | |||
- | Highlight here if you think you'll be able to sleep at night: \\ | ||
- | <fc # | ||
- | <fc # | ||
- | <fc # | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ===== LAB REPORT Part 1 #2 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 1 #2 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Create a figure depicting the time-series from a responsive voxel in the right hemisphere //and// a responsive voxel in the left hemisphere. | ||
- | * For these screenshots you do __not__ need to create " | ||
- | * Compare the two time-series. | ||
- | * Are they the same/ | ||
- | * Why? | ||
- | |||
- | </ | ||
- | |||
- | /* | ||
- | ===== Biological Motion Task (Optional) ===== | ||
- | |||
- | In this task, participants saw dots randomly moving on the screen. At certain points in time, the dots displayed coherent motion in a particular direction. | ||
- | |||
- | **10.** Load the data file: | ||
- | * '' | ||
- | * select '' | ||
- | * Make the checkerboard data invisible by clicking on the blue eye in the **Overlay list** | ||
- | |||
- | You might consider looking at early visual areas or area MT, which is sensitive to motion. See the image below for its location shown in green: | ||
- | |||
- | {{ : | ||
- | */ | ||
- | |||
- | |||
- | |||
- | ====== Part 2: Visual inspection of the data ====== | ||
- | |||
- | Here you will try to find task-activated voxels in the functional MRI data assigned to you. | ||
- | |||
- | ===== Data for Part 2 and beyond ===== | ||
- | |||
- | Over the course of the next several exercises, you will work with the data from the same localizer experiment. | ||
- | |||
- | <WRAP center round info 80%> | ||
- | **//WHAT IS A LOCALIZER?// | ||
- | |||
- | A “localizer” task is an fMRI paradigm that has been designed to reliably activate a particular functional region. For instance, a face localizer is designed to reliably activate the regions of the brain involved in face perception. A language localizer would be designed to reliably activate language areas of the brain. In lecture, we will discuss how these localizers can be used to ask interesting questions. But for the purposes of the lab, they are used because they will yield strong activations. | ||
- | </ | ||
- | |||
- | ==== Data Acquisition Parameters ==== | ||
- | |||
- | ^Parameter^Value^ | ||
- | |Field Strength|3.0 T| | ||
- | |Head Coil|12-channel| | ||
- | |Sequence|Echo Planar Imaging| | ||
- | |Martix|64 x 64| | ||
- | |Slices|37| | ||
- | |Field of View|22.4 cm| | ||
- | |Voxel size (x,y,z)|3.5 mm 3.5 mm 3.5 mm| | ||
- | |Orientation|Axial| | ||
- | |TR|2000 ms| | ||
- | |TE|25 ms| | ||
- | |Flip angle|90°| | ||
- | |Slice order|1, | ||
- | |||
- | ==== Data File Names and Locations ==== | ||
- | * The data are located in this directory: | ||
- | ''/ | ||
- | * There are 17 subdirectories within this '' | ||
- | '' | ||
- | * Within each of these 17 subdirectories are data for as many as four localizer tasks. We will only be using the first two: a face localizer ('' | ||
- | * **the //face// task: viewing pictures of scenes (houses) vs. pictures of faces** | ||
- | * **the //motor// task: left vs. right hand movement** | ||
- | |||
- | /* | ||
- | * the // | ||
- | * the // | ||
- | */ | ||
- | |||
- | <WRAP center round info 65%> | ||
- | A **run** refers to a continues period of data acquisition. Let's say you want to acquire data for a study that takes a total of 30 minutes. In order to give your participant breaks, you might break the 30 minutes into 6 runs of 5-minutes each. | ||
- | </ | ||
- | |||
- | * For each of these localizer tasks and subjects, there were 2 or 3 runs. For example, subject '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * //note//, All subjects only have two '' | ||
- | |||
- | === Your Assigned Subject === | ||
- | |||
- | ^ Name ^ Task ^ Subject ID ^ | ||
- | | Ronan | Motor | 2552 | | ||
- | | Stuart | ||
- | | Mallory | ||
- | | Norah | Motor | 2767 | | ||
- | | Blythe | ||
- | | Hollen | ||
- | | Vaso | Face | 2553 | | ||
- | | Angelia | ||
- | | Benji | Face | 2767 | | ||
- | | Paula | Face | 2814 | | ||
- | | Natalie | ||
- | |||
- | |||
- | |||
- | ==== Task Design - Part 2 ==== | ||
- | Each of the // | ||
- | * 150 volumes with TR = 2 sec | ||
- | * 153 volumes were initially collected, but the first 3 volumes were deleted to allow the spins to reach a steady-state magnetization. | ||
- | * Each run of each task had the following construction | ||
- | * '' | ||
- | * Each '' | ||
- | * In each run, there were | ||
- | * 6 '' | ||
- | * 6 '' | ||
- | * 12 intervening '' | ||
- | * '' | ||
- | |||
- | |||
- | /* | ||
- | **NOTE:** This is different for the '' | ||
- | */ | ||
- | |||
- | |||
- | |||
- | === Motor Task === | ||
- | * Subjects were shown a visual display consisting of one of the following three symbols | ||
- | * ''<<<<'' | ||
- | * '' | ||
- | * ''>>>>'' | ||
- | * ''<<<<'' | ||
- | * '' | ||
- | * ''>>>>'' | ||
- | |||
- | === Face Task === | ||
- | * '' | ||
- | * '' | ||
- | * Rest consisted of a fixation cross on a gray background. | ||
- | * For both '' | ||
- | * Subjects reported their total count of repetitions at the conclusion of the run. | ||
- | * The purpose of this task was simply to ensure that participants continued to pay attention to the pictures. | ||
- | |||
- | /* | ||
- | === Biological Motion Task === | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * For both biological and non-biological motion blocks, subjects covertly counted the number of times the point-light figure did not move - i.e., a static light display lasting 2 secs. Subjects reported their total count of repetitions at the conclusion of the run. | ||
- | * '' | ||
- | |||
- | */ | ||
- | |||
- | <WRAP center round info 100%> | ||
- | Let's review some things about the task design that you should know: | ||
- | * You will have alternating **12 seconds of task** and **12 seconds of rest** (except for the first and last rest periods - see below) | ||
- | * For every 2 seconds, we get one time-point or volume | ||
- | * This means you get alternating **6 time-points/ | ||
- | * For every task, the first task ('' | ||
- | |||
- | <WRAP center round alert 65%> | ||
- | This is similar, but not identical to the task design we used in Part 1. It is a bit more complicated as we now have rest blocks and there is a 6 second delay before the start of the first task. Take a minute or two to make sure you feel confident that you understand this design. | ||
- | </ | ||
- | |||
- | /* | ||
- | * For the biological motion task, the first task (Task A) started **after 12 seconds** or **at time-point 7**. | ||
- | */ | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== Loading your own assigned data ==== | ||
- | |||
- | <WRAP center round info 90%> | ||
- | * Whenever you see '' | ||
- | * Whenever you see '' | ||
- | </ | ||
- | |||
- | **1. ** Use the steps above (see [[# | ||
- | * You might want to close '' | ||
- | * You can look at run1, run2, or run3 (if it exists) for these first analyses. | ||
- | |||
- | **2. **Knowing what you know about the [[#Task Design - Part 2|task and its temporal structure]] (i.e., when blocks come on and off) - try to locate individual voxels whose time courses vary with the task timing. Think about where a motor or face task should activate the brain. | ||
- | |||
- | <WRAP center round tip 70%> | ||
- | You've already had some experience with finding the [[# | ||
- | |||
- | {{ : | ||
- | </ | ||
- | |||
- | I can assure you that there are voxels that clearly show task variation, and you may be amazed when you find them. However, <wrap em> | ||
- | |||
- | **3. ** If you find a voxel or voxels that appear to be activated by the task, //call me over and show it to me//. | ||
- | |||
- | ===== LAB REPORT Part 2 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 2 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Nothing needs to be submitted for this part of the lab report. | ||
- | |||
- | </ | ||
- | |||
- | |||
- | |||
- | ====== Part 3: Finding the activation using simple statistics ====== | ||
- | |||
- | ===== Statistical Mapping: Getting Started ===== | ||
- | |||
- | You should now have a pretty good idea that it is //not// easy to locate a functional MRI activation by simply eye-balling the data. The change in the raw MR intensity for active voxels (the ' | ||
- | |||
- | <WRAP center round info 100%> | ||
- | |||
- | One way of finding signal in noise is to calculate how well our **expected signal** '' | ||
- | |||
- | **// | ||
- | <WRAP centeralign> | ||
- | |||
- | **// | ||
- | |||
- | **// | ||
- | |||
- | We are now going to search for the activation by correlating our expected signal with the raw signal. This is done on a voxel by voxel basis. In other words, we run this correlation analysis for each voxel independently. There are about 152,000 voxels, so we run 152,000 independent correlations. In practice, we'll analyze around 25,000 voxels because we'll exclude voxels that are outside of the brain. | ||
- | |||
- | <WRAP center round tip 100%> | ||
- | Do you know how I know there are 152,000 voxels? I promise I did not count them. //Hint//: have a look back [[#Data Acquisition Parameters|here]]. | ||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | We will use a MATLAB script, '' | ||
- | |||
- | **1. ** Edit this script using the following command in '' | ||
- | |||
- | <code matlab> | ||
- | edit '/ | ||
- | </ | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | **Look carefully at the script.** It is annotated so that you can easily see what it is doing (lines of documentation are in green text preceded by a '' | ||
- | </ | ||
- | |||
- | ===== Modeling our expected brain signal ===== | ||
- | |||
- | What do we expect as our **// | ||
- | |||
- | Inside your script is a variable called **'' | ||
- | |||
- | **2. ** Create an expected waveform for your task using 1's and 0's. Put a '' | ||
- | |||
- | You may also note that I put the lines together in such a way to facilitate your task. The first and last line of '' | ||
- | |||
- | //To complete the template below, think about// | ||
- | - the duration each block of '' | ||
- | - during which of those block periods we might expect brain activity? | ||
- | - For now, let's just discriminate between **Task** and **Rest**. That is, don't worry about treating **Task A** and **Task B** differently; | ||
- | |||
- | The initial template should look like this. Fill in the '' | ||
- | <code matlab> | ||
- | template = [0 0 0,... % Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B - Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B - Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B - Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B - Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B - Rest | ||
- | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,... % Task A - Rest - Task B | ||
- | 0 0 0]; % Rest | ||
- | </ | ||
- | |||
- | <WRAP center round tip 100%> | ||
- | You might want to fill in the template for one line and if you think it is the same for some of the other lines then just copy and paste. **As you edit the template, remember that the number of elements in the template must always remain at 150.** | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | /* | ||
- | <WRAP center round alert 90%> | ||
- | **Do NOT run the script immediately after you change the template. Save your changes and read the section below first (you will actually need to run the script through the MATLAB command-line and NOT through the editor).** | ||
- | </ | ||
- | === Understanding the script === | ||
- | |||
- | Look carefully at the script to see what it does. The heart of the script is the following code snippet. | ||
- | |||
- | * Extract the time series for a single voxel from the func.data array. (The squeeze function removes singleton dimensions). | ||
- | * Use the Matlab ' | ||
- | * The ' | ||
- | * Store these in a 3D volume, which we will display overlaid upon a brain image to see if we can find the active voxels. | ||
- | |||
- | <code matlab> | ||
- | timeseries = squeeze(func.data(x, | ||
- | [r,p] = corr(template, | ||
- | output_corr.data(x, | ||
- | output_prob.data(x, | ||
- | </ | ||
- | */ | ||
- | |||
- | |||
- | ===== Statistical Mapping: Running our model ===== | ||
- | |||
- | **3. ** Run the script by calling the function from the MATLAB command line | ||
- | |||
- | <code matlab> | ||
- | fmri_lab_script2_2025(' | ||
- | </ | ||
- | |||
- | <WRAP center round info 70%> | ||
- | * Note the single quotes around '' | ||
- | * If your subject is '' | ||
- | < | ||
- | fmri_lab_script2_2025(' | ||
- | </ | ||
- | |||
- | * The '' | ||
- | * Set this to whatever run you'd like to look at. | ||
- | </ | ||
- | |||
- | <WRAP center round alert 60%> Be patient, it takes several seconds to run. As we move through the lab and add to our analysis, these scripts will take 2-3 minutes to run. | ||
- | </ | ||
- | |||
- | The script will produce useful output: | ||
- | |||
- | * In your MATLAB command window you will see the '' | ||
- | * This is a very rough indication of how many voxels were ' | ||
- | * '' | ||
- | * You'll probably want to press '' | ||
- | * The contrast limits are set to .3 to .8 with a red-yellow color map. This means that voxels in which the // | ||
- | * By default, the cursor will be placed on the voxel that had the strongest correlation with your template. | ||
- | |||
- | Your display should look something like this: | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round tip 90%> | ||
- | If your brains are cutoff in the display, press the button to the right of the '' | ||
- | </ | ||
- | |||
- | |||
- | Let's take a closer look at the relationship between the // | ||
- | |||
- | **4. ** Plot the time-series | ||
- | * Make sure to highlight the functional MRI data in the **Overlay list** (this is the file that does **<fc # | ||
- | * Press '' | ||
- | * Change the **Plotting Mode** to '' | ||
- | * See the red arrow two figures down | ||
- | |||
- | Now you should see the time-series from the voxel plotted at the bottom of the screen. The y-axis represents the intensity of the BOLD signal and the x-axis represents different time-points: | ||
- | |||
- | {{ : | ||
- | |||
- | You can probably see that the signal goes up and down in time with the task. But we can compare this more directly by overlaying your template. | ||
- | |||
- | {{ : | ||
- | |||
- | **5. ** Overlay your model. | ||
- | * Press the button to **Import data series from a text file** | ||
- | * See the green arrow in the figure above | ||
- | * Select the text file you just created with your MATLAB script. | ||
- | * It will be in your data directory and named '' | ||
- | * Click '' | ||
- | |||
- | You should now see your model (the template you created) and the actual time-series, | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round help 70%> | ||
- | When you generate the output, ask yourself: | ||
- | * Does the 'best fitting' | ||
- | * Are the peaks and troughs closely aligned temporally? | ||
- | * How many voxels are activated (see the output in the Matlab command window)? | ||
- | * Are the activated voxels in areas that we might expect? | ||
- | * Click around to see how well (or poorly) other voxels correlate with you model. | ||
- | </ | ||
- | |||
- | ===== LAB REPORT Part 3 #1 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 3 #1 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Include a screenshot of your time-series with the overlaid template. | ||
- | * For this screenshot you do __not__ need to create a " | ||
- | * Report how many voxels had //r// > .30 (remember, this is printed out to your MATLAB command window) | ||
- | |||
- | </ | ||
- | |||
- | Your results probably look pretty good, but not great. Let's think about how we can improve things ... | ||
- | |||
- | ===== Refining your model of the expected brain signal ===== | ||
- | |||
- | We created a template that faithfully represented the timing of the task, so our results may not be optimal. One reason is that there is a ~4-8 sec lag between the onset of the task and the onset of this slow blood flow related response. You can account for the // | ||
- | |||
- | **6. ** Account for the hemodynamic lag by shifting the template to the right or left by adding and removing zeros from the beginning and end of the vector (again, this shifts it in time). | ||
- | |||
- | <WRAP center round info 80%> | ||
- | Think through how best to do this. You do not want to try and trial-and-error your way through it. | ||
- | </ | ||
- | |||
- | * Rerun the analysis with the new model (aka template) | ||
- | * Observe how this changes the number of activated voxels. | ||
- | |||
- | As you probably (should have) observed, the statistics are VERY sensitive to getting the expected stimulus waveform right and for accounting for the hemodynamic delay. | ||
- | |||
- | Now examine the results with the results that generated the largest number of activated voxels. | ||
- | |||
- | <WRAP center round help 70%> | ||
- | *Can you now readily detect the activated voxels? | ||
- | *Look at the time series for the voxels with high and low correlation values. | ||
- | *Look throughout the brain and note the regions where activation is obtained. I know this is difficult when done on a low resolution image - but can you tell what brain areas are activated? Try to identify these areas | ||
- | *Try adjusting the range of your r statistic (the min and max values) to look for additional activations. | ||
- | {{ : | ||
- | </ | ||
- | |||
- | <WRAP center round alert 90%> | ||
- | Adjusting your model for the hemodynamic delay is an important step and a **critical thing for you to understand**. Be sure you understand what you did in this step and why you did it before proceeding. | ||
- | </ | ||
- | |||
- | ===== LAB REPORT Part 3 #2 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 3 #2 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Include a screenshot of your time-series with the overlaid template. | ||
- | * For this screenshot you do __not__ need to create a " | ||
- | * Report how many voxels had //r// > .30 (remember, this is printed out to your MATLAB command window) | ||
- | |||
- | |||
- | </ | ||
- | |||
- | ===== Improving your detection of activation by temporal smoothing (filtering) ===== | ||
- | |||
- | Have you noticed how noisy some of the raw time waveforms appear - even when coming from " | ||
- | |||
- | <WRAP center round info 100%> | ||
- | What I wrote above is more simple than it probably sounds. Imposing a low-pass filter in time smoothes out data so that rapid changes become less apparent than slow changes. Let's say I wanted to track the temperature in Gambier over the course of one year. I sit here writing this on a day that is 20-30 degrees colder than the day before (Seriously.Ohio " | ||
- | |||
- | Imagine the that blue line represents our actual data. We observe there are a lot of high-frequency fluctuations. After low-pass filtering (the red line) the data looks much smoother. | ||
- | |||
- | {{ : | ||
- | |||
- | </ | ||
- | |||
- | ** 7.** Included in your script is a bit of code that applies a very simple moving average filter. The actual operation is the line in which we calculate the mean of the time-series over time points j-len to j+len; where len = length of kernel. | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | A moving average is a very simple low-pass filter. Each data point is replaced by the average of that data point and some of its neighbors. | ||
- | </ | ||
- | |||
- | |||
- | <code matlab> | ||
- | timeseries = squeeze(func.data(x, | ||
- | if(mean(timeseries) > threshold) | ||
- | if(movavg ~= 0) | ||
- | temp = timeseries; | ||
- | for j = len+1: | ||
- | temp(j) = mean(timeseries(j-len: | ||
- | end | ||
- | timeseries(len+1: | ||
- | end | ||
- | </ | ||
- | |||
- | Rather than create a new script to implement this moving average filter, we can modify a variable at the top of the script called **'' | ||
- | * If movavg = 0 (' | ||
- | * If movavg = 1 (' | ||
- | |||
- | Try setting movavg = 1 and then save your script (see image below). Then run the script to visualize the effect of smoothing. | ||
- | |||
- | {{course: | ||
- | |||
- | This may take a minute or two. Look at the bottom left-hand corner of the MATLAB window (near “Start”) to see if it says “Busy.” If so, it's still computing… | ||
- | |||
- | ===== LAB REPORT Part 3 #3 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 3 #3 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Include a screenshot of your time-series with the overlaid template. | ||
- | * For this screenshot you do __not__ need to create a " | ||
- | * Report how many voxels had //r// > .30 (remember, this is printed out to your MATLAB command window) | ||
- | |||
- | </ | ||
- | ====== Part 4: Discriminating among activations with two templates ====== | ||
- | |||
- | In fMRI studies, we are usually interested in comparing the activations evoked by different tasks - something that cannot be done with a single template like the one we've been using. In this section, you will use **'' | ||
- | |||
- | **1.** Edit '' | ||
- | |||
- | **2.** Then run the script on the same data as you did [[# | ||
- | |||
- | **3 ** Plot the time-series | ||
- | * Make sure to highlight the functional MRI data in the **Overlay list** (this is the file that does **not** have '' | ||
- | * Press '' | ||
- | * Change the **Plotting Mode** to '' | ||
- | |||
- | **4. ** Overlay your models (Load '' | ||
- | * Press the button to **Import data series from a text file** | ||
- | * Select the text file you just created with your MATLAB script. | ||
- | * It will be in your data directory and named '' | ||
- | * Click '' | ||
- | |||
- | * Note that the activations identified by template1 and template2 are color-coded in the final output. | ||
- | * Voxels that correlated with template1 (**Task A**) are red-yellow, whereas those that correlated with template2 (**Task B**) are blue-lightblue. | ||
- | |||
- | ===== LAB REPORT Part 4 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 4 | ||
- | </ | ||
- | </ | ||
- | |||
- | //For the requested figures below:// | ||
- | * //You __do__ need to create high quality figures for __depicting the brain__.// | ||
- | * //You __do not__ need to create high quality figures for __depicting the time series__.// | ||
- | |||
- | * Do you now see differences between the Task A and Task B blocks of your experiment? That is, do you observe the different timing associated with the different blocks? | ||
- | * How many voxels exceeded //r// = .30 for your two tasks? | ||
- | * **Motor study analysts**: | ||
- | * Did you find activation in the primary motor cortices and cerebellum? | ||
- | * Include a figure depicting motor cortex activation for each task. | ||
- | * How does the hemisphere of peak activation match the hand of movement in motor cortex and cerebellum? | ||
- | * **Face-Scene study analysts**: | ||
- | * Did you find activation in the the [[https:// | ||
- | * //Hint//: You'll probably find better activation in the right hemisphere. | ||
- | * Include a figure depicting FFA and PPA activation for the face and scene task, respectively. | ||
- | |||
- | |||
- | </ | ||
- | |||
- | |||
- | ====== Part 5: Averaging across runs ====== | ||
- | |||
- | The motor task was run twice and the face task was usually run three times in each subject. This was done to increase the sample size and thus increase signal-to-noise. The figure below shows the time-series from a single voxel for run1 (red), run2 (blue), run3 (green), and the average all three (black). You can see that the addition of two runs helps smooth out the data and increase SNR. | ||
- | |||
- | {{ : | ||
- | |||
- | **1.** As our final exercise, use **'' | ||
- | * You can simply copy and paste the ideal templates (template1 and template2) from fmri_lab_script3_2025.m into fmri_lab_script5_2025.m. | ||
- | * **Don' | ||
- | |||
- | <code matlab> | ||
- | fmri_lab_scripts5_2025(' | ||
- | </ | ||
- | |||
- | <WRAP center round help 90%> | ||
- | |||
- | * How does the number of activated voxels compare for the run-averaged data compared to the analysis of the individual runs? | ||
- | * Does your pattern of activations appear more spatially extensive and ' | ||
- | * How do the waveforms look - are they cleaner for the run-averaged data than for the individual runs? | ||
- | </ | ||
- | |||
- | ===== LAB REPORT Part 5 ===== | ||
- | |||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 5 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Include screenshots of your time-series overlaid with your templates from good voxels from each Task. | ||
- | * For these screenshots you do __not__ need to create " | ||
- | * How many voxels exceeded //r// = .30 for your two tasks? | ||
- | |||
- | </ | ||
- | ====== Part 6: A preview of a problem - multiple comparisons ====== | ||
- | |||
- | <WRAP center round box 100%> | ||
- | |||
- | Are all of the voxels that exceed p<.01 //really// significant? | ||
- | |||
- | Null hypothesis testing gives us a p-value that indicates how likely our results would be assuming that the null hypothesis were true. For example, if you contrast face activations and house activations and find a voxel with p<.05, you know that if face and house activation **did not differ in reality** there would be less than a 5% chance of getting your results. | ||
- | |||
- | But this necessarily means that if you run enough tests you **will have false positives** (i.e., instances where you see a difference, but that difference is just due to random variability). For example, if you calculate 100 correlations between pairs of samples from a random number generator, __and__ if you set your significance level to p<.05, you would expect to observe 5 ' | ||
- | |||
- | One way to correct against false positives is to use a Bonferroni correction. With this method, an adjusted p-value threshold is computed that compensates for the number of comparisons. | ||
- | |||
- | corrected p value = nominal p value / number of comparisons | ||
- | |||
- | So in our example above, we would adjust our p-value to compensate for running 100 tests. Our // | ||
- | |||
- | p<.005 = .05 / 100 | ||
- | |||
- | The brain has tens of thousands of voxels, which means there will be __lots__ of false positives. If there are 20,000 voxels in the brain, and you want a p < .01 significance threshold | ||
- | |||
- | corrected p value = 0.01 / 20000 | ||
- | corrected p value = .0000005; (or, .9999995) | ||
- | |||
- | The Bonferroni correction is overly conservative for imaging data. This is because the voxels within an image are correlated (the signal from two neighboring voxels doesn' | ||
- | |||
- | {{ http:// | ||
- | </ | ||
- | |||
- | ===== LAB REPORT Part 6 ===== | ||
- | <WRAP center round important 100%> | ||
- | <WRAP centeralign> | ||
- | <WRAP centeralign> | ||
- | <typo fs:x-large; fc:purple; fw:bold; text-shadow: | ||
- | LAB REPORT Part 6 | ||
- | </ | ||
- | </ | ||
- | |||
- | * Nothing needs to be turned-in for this part of the lab. | ||
- | |||
- | </ | ||
psyc410_s2x/fmri_part1.1742654102.txt.gz · Last modified: 2025/03/22 09:35 by admin