User Tools

Site Tools


psyc410_s2x:brain_extraction_segmentation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
psyc410_s2x:brain_extraction_segmentation [2025/02/01 10:55] – [Inspect FAST Output] adminpsyc410_s2x:brain_extraction_segmentation [2025/02/01 11:24] (current) – removed admin
Line 1: Line 1:
-<WRAP centeralign> 
-<typo ff:'Georgia'; fs:36px; fc:purple; fw: bold; fv:small-caps; ls:1px; lh:1.1> 
-Lab 4: Brain Extraction & Segmentation </typo> 
-</WRAP> 
- 
-====== Information, Preparation, Resources, Etc. ====== 
- 
- 
-===== Assigned Readings / Videos: ===== 
- 
-  * {{ :psyc410:documents:07.0_pp_53_69_spatial_normalization.pdf | Spatial Normalization}} 
- 
-===== Goals for this lab: ===== 
- 
-  * You will gain familiarity with image viewers and other software tools we will use throughout the semester. 
-  * You will learn to use software that masks the brain and strips the skull. 
-  * You will understand how the intensity of voxels can be related to different brain tissue types. 
-  * You will examine brain images in 2 dimensional views and create 3 dimensional volume renderings. 
-  * You will search for anatomical brain regions using these software tools. 
- 
- 
-===== Software introduced in this lab ===== 
-  * [[https://www.nitrc.org/projects/mricrogl|MRIcroGL]] for volume rendering. 
-  * [[https://open.win.ox.ac.uk/pages/fsl/fsleyes/fsleyes/userdoc/|FSLeyes]] 
-  * FSL and the [[https://fsl.fmrib.ox.ac.uk/fsl/docs/#/structural/bet|BET skull-stripping]] tool. 
-  * FSL and the [[https://fsl.fmrib.ox.ac.uk/fsl/docs/#/structural/fast?id=fast|FAST tissue segmentation]] tool. 
- 
- 
-===== Laboratory Report ===== 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign>This lab report will be [[psyc410_s2x:syllabus#Lab Reports|due]] on Wednesday, Feb 5th by 7pm</WRAP> 
-</WRAP> 
- 
-===== Housekeeping ===== 
-<WRAP center round info 90%> 
-The data that we will use throughout the semester is located in a directory on your Desktop: ''/Users/hnl/Desktop/class/input'' 
-    * <wrap em>Do not write output to the /Users/hnl/Desktop/class/input directory or any of its sub-directories!</wrap> 
-</WRAP> 
- 
-**1.** Create the output directory for tonight's lab. 
-<code bash> 
-mkdir ~/Desktop/output/lab04 
-</code> 
- 
-<WRAP center round alert 90%> 
-It is important that you adhere to an organized system of directories and sub-directories for the labs. We will be creating lots and lots of files. Without an effort to keep organized you will quickly create a chaotic mess of files and have trouble finding and using what you need. 
- 
-  * Your results should be stored in **~/Desktop/class/output/lab04** (or, lab05, lab06, etc.) 
-  * Use meaningful names for your directories //and// files! 
-  * You can create other subdirectories within each lab directory to keep your labs organized 
-    * e.g., ''mkdir /class/output/lab04/segment'' 
-</WRAP> 
- 
-/* 
-**1.** In our [[psyc410_s2x:sci_prog_signal_decomp#housekeeping|first lab meeting]] you were asked to make sure that your dock contained the shortcuts for ''Terminal'', ''MATLAB'', and ''BBEdit''. Now do the same for ''MRIcroGL'' (see the icon below), which can be found in ''/Applications''. (I have no doubt that you all followed instructions and did so, but on the off chance you might not have, do so now.) 
- 
-{{:psyc410:images:mricrogl_icon.png?100|}} 
- 
-**2.** Modify your hidden bash files. 
-  * It's okay if you don't know what this means, just copy and paste the entire block of code below into your Terminal and press ''return''. 
- 
-<code> 
-cat <<EOT >> ~/.bashrc 
-### FSL STUFF ### 
-FSLDIR=/usr/local/fsl 
-. ${FSLDIR}/etc/fslconf/fsl.sh 
-PATH=${FSLDIR}/bin:${PATH} 
-export FSLDIR PATH 
-EOT 
-</code> 
- 
-  * Then do it again with the this block of code 
- 
-<code> 
-cat <<EOT >> ~/.bash_profile 
-# FSL Setup 
-FSLDIR=/usr/local/fsl 
-PATH=${FSLDIR}/bin:${PATH} 
-export FSLDIR PATH 
-. ${FSLDIR}/etc/fslconf/fsl.sh 
-EOT 
-</code> 
- 
-**3.** The data that we will use throughout the semester is located in a directory on your Desktop; ''/Users/hnl/Desktop/class/input'' 
-    * <wrap em>Do not write output to the /Users/hnl/Desktop/class/input directory or any of its sub-directories.</wrap> 
- 
-<WRAP center round alert 80%> 
-It is important that you adhere to an organized system of directories and sub-directories for the labs. We will be creating lots and lots of files. Without an effort to keep organized you will quickly create a chaotic mess of files and have trouble finding and using what you need. 
- 
-  * Your results should be stored in **~/Desktop/class/output/lab03** (or, lab04, lab05, etc.) 
-  * Use meaningful names for your directories //and// files! 
-  * You can create other subdirectories within each lab directory to keep your labs organized 
-    * e.g., mkdir /class/output/lab03/segment 
-</WRAP> 
- 
-<WRAP center round tip 80%> 
-The unix (or OS X) file system uses the tilde character ''~'' as shortcut for your home directory. Entering ''~/Desktop/class/input'' is exactly the same as entering ''/Users/hnl/Desktop/class/input''. 
-</WRAP> 
- 
- 
-**2a.** [Do this step only if you __do__have the directory ''~/Desktop/class/output''] 
-Delete the contents of ''/Users/hnl/Desktop/class/output'' (if it exists). There are two ways you can do this: 
-  * 1) the point-and-click way. Simply double click on ''class'', then on ''output'', and then drag everything in that directory to the ''Trash'' bin. 
-  * 2) The Unix way. **If you want to do things this way, please call me over to your computer so that I can ensure things looks correct //before// you hit ''return''**. 
-    * In your ''Terminal'', navigate to //within// the ''output'' directory. Use ''pwd'' to confirm that you are in ''/Users/class/output'', then enter '' rm -rf *''. It is critical that you are in the cright location when you do this, lest you end up deleting lots of things you don't want deleted (remember: there is no way to recover files that were deleted from the terminal).  
- 
-**2b.** [Do this step if you __do not__ have the directory ''~/Desktop/class/output''] 
- 
-  * 1) Create your output directory 
-<code bash> 
-mkdir ~/Desktop/class/output 
-</code> 
- 
- 
-**4** Create the output directory for tonight's lab. 
-<code bash> 
-mkdir ~/Desktop/output/lab03 
-</code> 
- 
- 
-**2.** Download and install [[https://www.mccauslandcenter.sc.edu/mricrogl/home|MRIcroGL]] 
-  * Go to the [[https://www.nitrc.org/frs/?group_id=889|download page]]. 
-  * Click on ''MRIcroGL_macOS.dmg''  
-  * Click on ''I Agree'' 
-  * The file will download into your ''Downloads'' directory 
-  * Double click on the ''MRIcroGL_macOS.dmg'' file in your ''Downloads'' directory. 
-  * Drag and drop the ''MRIcroGL'' directory in ''/Applications''. 
-    * Alternatively, you could put the following command into the terminal 
-      * ''mv ~/Downloads/MRIcroGL /Applications'' 
- 
-**3.** Download and install ''X11'' (the version currently installed is not compatible with the software we'll be using) 
-    * Download software [[https://dl.dropboxusercontent.com/u/2827408/PSYC410/XQuartz-2.7.8.dmg|here]] 
-    * Double-click on the downloaded file ''XQuarts-2.7.8.dmg'' 
-    * Double-click on the open box icon of ''XQuartz.pkg'' 
-      * ''Continue'' 
-      * ''Continue'' 
-      * ''Agree'' 
-      * ''Install'' 
-      * Enter the HNL password and click ''Install Software'' 
-*/ 
- 
- 
- 
- 
- 
-===== Data used in this lab ===== 
-  * MRI brain data is located in ''/Users/hnl/Desktop/class/input/mri/mri_retest'' 
-  * For parts of the lab you will each work on a different brain. When I refer to your "assigned brain" I am referring to those listed below. 
- 
-^  Neuro Methods Neophyte  ^  Assigned Brain   ^ 
-| Angelia                  | subj05_1A.nii.gz  | 
-| Benji                    | subj06_1A.nii.gz  | 
-| Blythe                   | subj07_1A.nii.gz  | 
-| Hollen                   | subj08_1A.nii.gz  | 
-| Mallory                  | subj25_1A.nii.gz  | 
-| Natalie                  | subj10_1A.nii.gz  | 
-| Norah                    | subj12_1A.nii.gz  | 
-| Paula                    | subj13_1A.nii.gz  | 
-| Ronan                    | subj21_1A.nii.gz  | 
-| Stuart                   | subj14_1A.nii.gz  | 
-| Vaso                     | subj19_1A.nii.gz  | 
- 
-<WRAP center round tip 70%> 
-<WRAP centeralign>These brains should be pretty good, but if you have one that seems ugly or low quality, **let me know and we'll assign you a different one**.</WRAP> 
-</WRAP> 
- 
- 
- 
-====== Part 1: Viewing MRI images in FSLeyes ====== 
- 
-There are lots of different MRI viewer programs available. As you might expect they all have their own strengths and weaknesses. We will primarily be using the viewer that is built into the ''FSL'' software package; ''FSLeyes''. In this section of the lab I just want you to get familiar with the this viewer and play around with some of the options. 
- 
-<WRAP center round info 70%> 
-[[http://fsl.fmrib.ox.ac.uk/fsl/fslwiki//|FSL]] is a library of tools for analyzing MRI, DTI, and fMRI data. It is very popular due to the fact that it is both flexible, powerful, and relatively easy to use.  
-</WRAP> 
- 
-<WRAP center round tip 70%> 
-The online manual for FSLeyes can be found [[https://open.win.ox.ac.uk/pages/fsl/fsleyes/fsleyes/userdoc/|here]]. 
-</WRAP> 
-===== Opening FSL ===== 
- 
-FSL can be executed using a graphical user interface (a GUI) or by typing commands to the terminal. We will use the GUI for most of our exercises, but you should be aware that the command line interface is helpful when writing your own analysis scripts.  
- 
-<WRAP center round info 80%> 
-You must use the command line to start FSL. Open a [[:psyc410_s25:sci_prog#part_1os_x_terminal| terminal window]] and type ''fsl &''. 
-</WRAP> 
- 
- 
-<WRAP center round tip 80%> 
-When running a program from the command line it is helpful to type ''&'' at the end.  This will run the program in the background.  Otherwise, the terminal window will be 'locked up' while the program runs. 
-</WRAP> 
- 
-The FSL GUI should appear after a few moments. For today's exercises we will use FSLeyes, BET, and the FAST segmentation tool. 
- 
-{{ :psyc410:images:fsl_menu.png?150 }} 
- 
- 
- 
-===== Open FSLeyes ===== 
- 
-**1.** Click on the ''FSLeyes'' button at the bottom of the FSL menu.You should see the following window. 
- 
- 
-{{ :psyc410:images:fsl_eyes.png?600 }} 
- 
-===== Open Standard Brain ===== 
- 
-To familiarize yourself with the viewer: 
- 
-**1.** Click on ''File'' -> ''Add Standard'' 
- 
-{{  :psyc410:images:fsleyes_addstandard.png?300  }} 
- 
-**2.** Select the **'MNI152_T1_1mm.nii.gz'** image. Feel to choose any other brain image too. Note that 'MNI152_T1_1mm.nii.gz' includes both the brain and skull, whereas 'MNI152_T1_1mm_brain.nii.gz' is only the brain (the skull has been removed from the image). 
- 
-{{  :psyc410:images:fslview_standard_fileselect.png?600  }} 
- 
-<WRAP center round info 80%> 
-If your standard brain is fuzzier looking than the person next to you, you have likely opened up 'MNI152<wrap em>lin</wrap>_T1_1mm.nii.gz'. Go back to step 1 and open up the correct file. 
-</WRAP> 
- 
-<WRAP center round info 80%> 
-MNI stands for the Montreal Neurological Institute. 152 brains were collected at the MNI and averaged together with a resolution of 1 mm. Since everyone has a different brain, we usually transform each person's brain into a standard brain image (like the MNI one) to allow us to present and compare results across studies. 
- 
-For more information on the current usage of the MNI brain, [[http://www.bic.mni.mcgill.ca/ServicesAtlases/ICBM152NLin2009|see here]]. </WRAP> 
- 
- 
-**3.** Play around with this standard brain. 
- 
-{{  :psyc410:images:fsleyes_standard.png?500  }} 
- 
-**Location and Intensity**. As you click around, observe the values in the lower-right corner of the screen (see image below). 
-  * In the ''Location'' box, each voxel is identified in a three-dimensional space by its ''x'', ''y'', and ''z'' position. 
-  * in the window to the right, the intensity of the selected voxel is displayed next to the coordinates. 
-    * This intensity is reported as an arbitrary unit (i.e., the number itself is meaningless) 
-    * Sometimes, the value represents a meaningful statistics such as a z-score. 
- 
-{{  :psyc410:images:fsleyes_locationpanel.png?600  }} 
- 
- 
-**4.** Continue to play with different options to see what they do (you won't break anything). See the FSLeyes [[https://open.win.ox.ac.uk/pages/fsl/fsleyes/fsleyes/userdoc/quick_start.html|quick start page]] to learn what different buttons do. 
- 
- 
-**5.** Close this file when you are done having fun and feel comfortable navigating around in FSLeyes (you are having fun...aren't you!?) 
- 
-{{  :psyc410:images:fsleyes_close.png?250  }} 
-===== Open Your Assigned Brain ===== 
- 
-**1.** Click on ''File'' -> ''Add from file'' 
- 
-{{  :psyc410:images:fsleyes_addoverlay.png?250  }} 
- 
-**2.** The file selection window will default to a directory that we don't want. Jump to your desktop by selecting ''Desktop'' in the left panel of the window (in the list of "Favorites:). Then click on the ''class'' --> ''input'' --> ''mri'' --> ''mri_retest'' directories and select your assigned file. 
- 
-**3.** Select your [[#Data used in this lab|assigned brain]] from the list and click open 
- 
-**4.** In [[#Part 3: Skull stripping your test brain using FSL/BET|Part 3]] of this lab We will remove teh skull ("skull strip") this brain using the BET program. After we do, we'll want to use FSLeyes to compare our skull-stripped brain to the original brain, **so you can minimize the window, but keep your assigned brain loaded in FSLeyes.** 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign><wrap em>LAB REPORT Part 1</wrap></WRAP> 
-There are no questions for Part 1 of this lab 
-</WRAP> 
-====== Part 2: Viewing MRI images in MRIcroGL ====== 
- 
-As noted above, different viewers have different strengths and weaknesses. In the last part you used FSLeyes to view the MNI standard brain and your assigned brain in 2D. MRIcroGL is particularly good at quickly rendering the brain in 3D. So let's use it to take a quick look at our assigned brain before we continue on to skull-stripping. 
- 
-===== MRIcroGL 2D ===== 
- 
- 
-**1.** Open the MRIcroGL program by clicking on the icon in your dock. 
- 
-{{:psyc410:images:mricrogl_icon.png?50|}}. 
- 
-  * You should see something like the image below. (If instead you see a big block of Swiss cheese or a lego brick, don't worry) 
- 
-{{  :psyc410:images:mricrongl_window.png?600  }} 
- 
-**2.** Open your assigned brain by selecting ''File'' --> ''Open'' 
-  * You should see your brain displayed in 2D similar to what we saw with FSLeyes. 
-===== MRIcroGL 3D ===== 
- 
-**3.** Let's now view this brain rendered in 3D. To do so, select ''Display'' --> ''Render'' from the menu bar. 
- 
-**4.** Let's play around with MRIcroGL to get a feel for interacting with a brain rendered in 3D. 
-  * If you click on the brain and drag your mouse around you'll be able to rotate the brain. 
-  * You can zoom in and out by dragging your mouse while holding the right-click. 
-  * Try to make ''Cutout'' in the brain by manipulating the ''x'', ''y'', and ''z'' sliders in the ''cutout'' section (you'll need to press ''Near'' to get started.)  
- 
-{{  :psyc410:images:mricrogl_cutout.png?200  }} 
- 
-This 3D rendering is pretty cool. But one thing that you undoubtedly noticed is that the presence of the skull, scalp, and other non-brain tissue obscures the cortical surface of the brain. Indeed, many viewers (including FSLeyes) would render a useless blob if given a brain like this. So in the next section we'll improve things by stripping away all the non-brain stuff. 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign><wrap em>LAB REPORT Part 2</wrap></WRAP> 
-There are no questions for Part 2 of this lab 
-</WRAP> 
- 
- 
-====== Part 3: Skull stripping your test brain using FSL/BET ====== 
- 
-When rendering a brain volume, the skull, and neck make it difficult to see brain anatomy in 3D. As we will learn, these brain coverings also make it difficult to coregister brains into a common coordinate system. Consequently, removing the skull from the brain is an important first step in many analyses. In this section we will use the FSL __**B**__rain __**E**__xtraction __**T**__ool (BET) program to accomplish this. 
- 
- 
- 
- 
-<WRAP center round info 70%> 
-If you previously closed FSL, [[#Opening FSL|reopen it]] to start a new session before continuing. 
-</WRAP> 
- 
-===== BET - brain extraction tool ===== 
- 
-<WRAP center round tip 60%> 
-The online manual for the Brain Extraction Tool can be found [[https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/BET|here]]. 
-</WRAP> 
- 
-===== Skull Strip Your Brain ===== 
- 
-**1.** Launch BET by selecting the ''BET brain extraction'' button on the FSL menu. You should now see the following window: 
- 
-{{  :psyc410:images:fsl_bet_input.png?400  }} 
- 
-**2.** Your ''Input image'' should be the same assigned brain you used in the previous section. 
-  * Click on the folder icon at the end of the ''Input image'' line and use the file selection box to navigate to the file. Select the file and press ''Ok'' 
-      * To go up on level in the directory hierarchy, double-click on the ''..'' under "Directories:" 
- 
-**3.** You will also need to specify an ''Output image'' 
- 
-<WRAP center round alert 80%> 
-FSL will automatically generate an output filepath and filename for you after you select your input image, but you **do NOT** want to use this default.</WRAP> 
- 
-  * Click on the folder icon at the end of the Output Image line and navigate to the ''/Users/hnl/Desktop/class/output/lab04'' folder and select ''Ok''. 
-  * In the ''Output image'' line add your filename to the end of the path. 
- 
-<WRAP center round tip 100%> 
-It's often easiest to simply append "_brain" to the end of the original file (but in front of the ''nii.gz'' file extension. 
- 
-So if my assigned brain were ''prof_mri_01A.nii.gz'', then my output filename would be ''prof_mri_01A_brain.nii.gz''. 
- 
-But remember to specify the correct directory too. So the ''Output Image'' would be ''~/Desktop/class/output/lab04/prof_mri_01A_brain.nii.gz'' 
-</WRAP> 
- 
-<WRAP center round alert 90%> 
-As I previously stated, it is important that you use sensical and consistent filenames and directories. If you do not stay organized you will quickly find yourself struggling to make sense of a chaotic mess of files! 
-</WRAP> 
- 
- 
-There are MANY options for skull stripping. You are encouraged to experiment with the different settings to achieve the best brain extraction. However, you may want to start by choosing the '**Robust brain centre estimation** (iterates BET several times)' option on the first drop down menu.  
- 
-{{ :psyc410:images:fsl_bet_robust.png?400 }} 
- 
-**4.** Click ''Go'' and BET will start stripping. This usually takes a minute or two. You know you are done when the depressed ''Go'' button pops out again. **Don't be impatient and keep pressing ''Go'', as FSL will dutifully run another instance of the program.** 
- 
-<WRAP center round tip 80%> 
-Rather than selecting ''Exit'' after BET is done running, you should keep the window open. In the next section you will inspect your skull stripped brain and you might find that you need to run BET again with slightly different settings. Leaving the window open will just make it a little easier on you because your Input and Output images are already selected. 
-</WRAP> 
- 
-===== Load Your Skull Stripped Brain ===== 
- 
-We will now view the skull stripped brain by superimposing it onto the non-stripped version that you already have loaded into FSLeyes from [[#Open Your Assigned Brain|this earlier section of the lab]].  
- 
-**1.** In the FSLeyes window select ''File'' --> ''Add from file'' and then navigate to and select your skull stripped brain you just created. 
- 
-<WRAP center round alert 90%> 
-When you go to add your skull stripped brain, FSLeyes might default to the ''input'' directory of your unstripped brain. There might be a stripped brain in that same directory with the filename you just used. But this is not yours! Be sure you load the file that you created in ''~/Desktop/class/output/lab04''. 
-</WRAP> 
- 
- 
-<WRAP center round info 90%> 
-You can load many different brains into FSLeyes simultaneously (as long as they're the same dimensions). The ''Overlay list'' window in the bottom left corner shows you all the files that you currently have loaded. 
- 
-{{ :psyc410:images:fsl_overlaylist.png?600 | Overlay list menu}} 
- 
- 
-The order of the brains in the overlay list is also the order that the brains are stacked on each other in the viewer. By default, the most recent brain that was loaded will be the one on top, but you can use the arrow button in the overlay list to rearrange them. You can also click on the eyeball icon to toggle whether a particular brain is displayed. 
- 
-Before proceeding, make sure that you have both your original. brain and your skull stripped brain load. The skull stripped version should be on to of the original, and both should be visible (the eyeball icon should be blue). 
-</WRAP> 
- 
- 
-**2.** Your skull stripped brain is now being displayed stacked on top of your original brain. But it's nearly impossible to tell them apart. To make it easier to distinguish between them, we'll colorize the skull stripped brain. 
-  * In Overlay list, click on your skull stripped brain so that the filename is highlighted. 
-  * Change the colorscale dropdown menu (the menu is pointed out between the arrows in the image below) from ''Greyscale'' to ''Green'' (or any other color you'd like!) 
- 
- 
-{{  :psyc410:images:fsleyes_colorscale.png?500  }} 
- 
-  * Now you can see your original MRI in greyscale, and the skull stripped version of that same MRI overlaid on top and colored Green (or whatever color you chose.) 
- 
-{{  :psyc410:images:fsleyes_brainoverlay.png?500  }} 
- 
-===== Inspect the Quality of Your Skull Stripped Brain ===== 
- 
-High quality skull stripping is defined as successfully **removing all of the non-brain features (e.g,. skull), //while// preserving all of the brain tissue**. In other words, if you are too aggressive then you will successfully get rid of all the non-brain, but you'll also throw out some brain. If you are too conservative then you will retain all of the brain, but you'll also keep bits of non-brain. The goal is to be a neuroscience Goldilocks; you don't want to remove too much, you don't want to remove too little, you want to remove the amount that's just right. 
- 
-**1.** Closely examine your skull stripped brain - does it conform to the edges of your original brain? That is, did the skull stripping **remove everything outside of the brain** while **preserving the entire brain itself**? Make sure to move your cursor around and inspect lots of different regions and boundaries of the brain. 
- 
-<WRAP center round tip 80%> 
-Remember, you can click the 'eyeball' icon to turn a specific overlay on or off. In this way, you can look at your skull stripped brain in isolation, or superimposed upon the original brain. 
-</WRAP> 
- 
-  * If you observe that some of the brain was cut away along with the skull, then your skull stripping was too aggressive. If you can still see parts of the skull or other non-brain tissue (e.g., meninges) then your skull stripping was too conservative. We can adjust this by manipulating the <wrap em>Fractional intensity threshold</wrap> option on the BET GUI. 
-    * Larger numbers cut away more brain. 
-    * Smaller numbers cut away less brain. 
- 
- 
-  * In the examples below I would **//not//** be satisfied with the results. (Remember, you can click on the images to see larger versions) 
-    * The image on the left (red overlay) was too aggressive and removed parts of the brain, specifically a large chunk of the frontal lobe. 
-      * I would therefore determine that the fractional intensity was too high, and run it again with a lower value. 
-    * The image on the left (blue overlay) was too conservative and left in areas outside of the brain. 
-      * I would therefore determine that the fractional intensity was too low, and run it again with a higher value. 
- 
-{{:psyc410:images:fsleyes_fibrain_7.png?400 }} 
-{{ :psyc410:images:fsleyes_fibrain_05.png?400 }} 
- 
-**2.** Rerun BET with a different ''Fractional intensity threshold'' and then inspect the new results. Iterate this process until you are happy with your results. //Tip//: First try a large change in the Fractional intensity threshold, examine your result, and then split your original change in half, examine the new result, rinse and repeat. 
-  
-<WRAP center round tip 100%> 
-When you change the FIT value, make sure to **change your output filename**. If you run ''subj99_1A_brain'' with a new fractional intensity threshold of .3, then name the output ''subj99_1A_brain_fit3''. 
-</WRAP> 
- 
- 
-<WRAP center round alert 80%> 
-Remember the name you gave to your best skull-stripped brain, as we will use this for the next part. 
-</WRAP> 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign><wrap em>LAB REPORT Part 2</wrap></WRAP> 
-  * Create a figure showing your best brain extraction overlaid on your original brain. 
-    * Report the fractional intensity threshold that you used. 
-  * Create a second figure showing this same brain in MRIcroGL. 
-</WRAP> 
-====== Part 4: Segmenting your skull-stripped brain automatically using FSL/FAST. ====== 
- 
-Segmentation is the process of segmenting different anatomical features (i.e., separating them), including grey matter, white matter, and cerebral spinal fluid. __**F**__SL's __**A**__utomated __**S**__egmentation __**T**__ool (FAST) is a program that attempts to do this automatically. 
- 
-<WRAP center round tip 60%> 
-The online manual for the FSL FAST tool can be found [[https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FAST|here]]. 
-</WRAP> 
- 
-===== Setup FAST ===== 
- 
-**1.** Go back to the FSL GUI and select FAST. 
- 
-**2.** This will bring up another GUI in which you provide the name of **your skull stripped brain** as the Input Image (using the File Selection box as you've done before). 
- 
-<WRAP center round tip 100%> 
-I recommend first entering the folder in which your skull stripped brain lives (''/Users/hnl/Desktop/class/output/lab04'') and then clicking the folder icon to select the specific file. 
-</WRAP> 
- 
-{{  :psyc410:images:fsl_fast.png?400  }} 
- 
-**3.** You need to provide an ''output basename''. The default is the name of your skull stripped brain - which is usually appropriate. (In a [[#Skull Strip Your Brain|prior section]] I told you not to use the default name generated by FSL, but in this case it's fine to do so) 
- 
-**4.**You should also choose the ''Estimated Bias Field'' option by clicking on its box. 
- 
-<WRAP center round help 100%> 
-<WRAP centeralign><fs large>**Estimated Bias Field**</fs></WRAP> 
- 
-Inhomogeneity of the magnetic field causes intensity variations across space (see the image from FSL below). This can screw up segmentation because the voxel intensities for different tissues will vary across the brain. For example, white matter in one regions will be "brighter" than white matter in another region. This is a problem because FAST is relying on regularities in voxel intensities to segment the brain. 
- 
-In the image on the left, compare the intensity of the white matter in the posterior region of the brain to the intensity of the white matter in the anterior region of the brain. The ''Estimated bias field'' option attempts to correct for this prior to tissue segmentation. 
- 
-{{  :psyc410:images:fsl_biasfield.png?600  }} 
-</WRAP> 
- 
-===== Run FAST ===== 
- 
-**5.** Start your segmentation by clicking ''Go'' 
- 
-<WRAP center round alert 100%> 
-Tissue classification is an iterative, computer intensive process that takes several minutes to complete. You will know it has completed once the ''Go'' button no longer appears depressed. You could also look in your Terminal window for it to say "FINISHED". 
- 
-While you wait you should start to familiarize yourself with some of the [[:kpnl:brain_atlases|brain atlases]] and anatomy that you will need to complete the last section of this lab (right-click on the link and open in a separate tab so that you don't leave this wiki page).  
-</WRAP> 
- 
-===== Inspect FAST Output ===== 
-Once FAST is complete, you will have several (seven, in fact) additional files in your output folder. These include individual partial volume estimates for each tissue type where the voxel intensities represent the estimated amount of each tissue type in each voxel on a scale of 0 to 1. 
- 
- 
-^  File suffix  ^  Tissue type  ^ 
-|  pve_0  |  CSF  | 
-|  pve_1  |  grey matter  | 
-|  pve_2  |  white matter  | 
- 
-<WRAP center round tip 80%> 
-Let's imagine a voxel in which we had gray matter (50%), white matter (20%), and CSF (30%). The partial volume estimates for this voxel would be \\ 
-pve_0 = .3 \\ 
-pve_1 = .5 \\ 
-pve_2 = .2  
-</WRAP> 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign><wrap em>LAB REPORT Part 3</wrap></WRAP> 
-  * Overlay each of these segmentation files onto your skull-stripped brain and assign them each a different color. 
-    * After doing so you should see all three tissue types superimposed on the same brain. 
-    * Refer back to the [[#Load Your Skull Stripped Brain|earlier section]] of the lab if you forgot how to do this. 
-  * Include this image in your lab report and include a key detailing which tissue type is represented by each color. 
-</WRAP> 
- 
-FAST also creates 'hard' segmentations (the file with ''_seg'' in the file name) where each voxel is labeled by predominate tissue type. 
- 
-<WRAP center round tip 60%> 
-Think back to the voxel in which we had gray matter (50%), white matter (20%), and CSF (30%). The ''_seg'' file would assign this voxel a value of ''1'', because it has more grey matter than white matter or CSF.  
-</WRAP> 
- 
-In the example below I have loaded all three partial segmentation files as well as the hard segmentation file. Note the voxel values in the ''Location'' window. 
-  * The ''seg_pve_0'' file = ''0.0'' indicating that FAST estimated the voxel indicated by the crosshairs does not include any CSF. 
-  * The ''seg_pve_1'' file = ''0.48'' indicating that FAST estimated the voxel indicated by the crosshairs includes 48% grey matter. 
-  * The ''seg_pve_2'' file = ''0.52'' indicating that FAST estimated the voxel indicated by the crosshairs includes 52% white matter. 
-  * The ''_seg'' = 2 indicating that the //predominant// tissue type in that voxel is greay matter.  
- 
-<WRAP center round info 80%> 
-You're right, this is confusing. Why would the hard segmentation indicate the voxel is grey matter if the program estimates that 52% is white matter? This type of inconsistency occasionally arrises because the ''partial volume'' estimates and the ''hard'' segmentation estimates rely on different algorithms. The hard segmentation takes into account the neighboring voxels. In this case most of them are grey matter, so the voxel is assigned as grey matter, even though the partial volume estimate is that it is only 48% grey matter. 
-</WRAP> 
- 
-  
-Experiment with overlaying these results upon your original and skull stripped brain in FSLeyes. 
- 
-^  Voxel intensity value  ^  Tissue type  ^ 
-|  0  |  Out of brain  | 
-|  1  |  Cerebrospinal fluid  | 
-|  2  |  Grey matter  | 
-|  3  |  White Matter  | 
- 
-{{  :psyc410:images:fsleyes_segmentation.png?800  }} 
- 
-====== Part 5: Identify neuroanatomy using FSLeyes and MRIcroGL ====== 
- 
-We now have a pretty skull-stripped brain and two viewers to investigate them; [[#Part 1a: Viewing MRI images in FSLeyes|FSLeyes]] for 2D "slices" and [[#Part 1b: Viewing MRI images in MRIcroGL|MRIcroGL]] for 3D renderings. Your final task is to use these tools to find several anatomical structures. 
- 
-<WRAP center round important 100%> 
-<WRAP centeralign><wrap em>LAB REPORT Part 4</wrap></WRAP> 
-  * Use a combination of 2D and 3D views, find the following structures listed below. Use the view that you think works best for the particular structure. But don't choose arbitrarily; some structures are easy to see in 2D, whereas others are better viewed in 3D. 
-  * You only need a 2D **or** a 3D view for each structure 
-    * But include at least three 2D and at least three 3D images 
-  * Include a clearly labeled screenshot of each structure. 
- 
-  - Hippocampus 
-  - Amygdala 
-  - Head of caudate 
-  - Thalamus 
-  - Orbital frontal cortex 
-  - Superior frontal gyrus 
-  - Middle temporal gyrus 
-  - Superior colliculi 
-  - Splenium of the corpus callosum 
-  - Pons 
- 
-//**Tip: If you're not sure where these areas are in the brain you should take advantage of some online neuroanatomy atlases that can be found [[:kpnl:brain_atlases|here]]. Feel free to exploit any resource you'd like to find the location of these structures.**// 
-</WRAP> 
  
psyc410_s2x/brain_extraction_segmentation.1738425334.txt.gz · Last modified: 2025/02/01 10:55 by admin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki