<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.ccn.ucla.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SRP+Wiki</id>
	<title>Center for Cognitive Neuroscience - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.ccn.ucla.edu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SRP+Wiki"/>
	<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php/Special:Contributions/SRP_Wiki"/>
	<updated>2026-05-06T17:27:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2791</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2791"/>
		<updated>2014-10-13T18:39:15Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Creating Segmentation Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of segmentation is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_InitVol&lt;br /&gt;
:::*This command will begin initializing the volume anatomy file.&lt;br /&gt;
::4. In the window that appears, navigate to the subject&#039;s &amp;quot;nii&amp;quot; directory of NIfTI volume image files and select the &amp;quot;hhr_struct&amp;quot; file.&lt;br /&gt;
::5. Another window with the image scan of the subject will appear. Begin drawing a rectangular box around the hippocampal region, covering both the left and right sides.&lt;br /&gt;
:::*Note: It is important to draw the rectangle with enough vertical space above and below the region to account for positional differences of the hippocampal region across different slides.&lt;br /&gt;
::6. Once the box has been drawn, double click inside the drawn region and Matlab will begin initializing the file.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2790</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2790"/>
		<updated>2014-10-13T18:38:11Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Segmentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of segmentation is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_InitVol&lt;br /&gt;
:::*This command will begin initializing the volume anatomy file.&lt;br /&gt;
::4. In the window that appears, navigate to the subject&#039;s &amp;quot;nii&amp;quot; directory of NIfTI volume image files and select the &amp;quot;hhr_struct&amp;quot; file.&lt;br /&gt;
::5. Another window with the image scan of the subject will appear. Begin drawing a rectangular box around the hippocampal region, covering both the left and right sides.&lt;br /&gt;
:::*Note: It is important to draw the rectangle with enough vertical space above and below the region to account for positional differences of the hippocampal region across different slides.&lt;br /&gt;
::6. Once the box has been drawn, double click inside the drawn region and Matlab will begin creating the file.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2789</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2789"/>
		<updated>2014-10-13T18:38:00Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Segmentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
Creating Segmentation files&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of segmentation is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_InitVol&lt;br /&gt;
:::*This command will begin initializing the volume anatomy file.&lt;br /&gt;
::4. In the window that appears, navigate to the subject&#039;s &amp;quot;nii&amp;quot; directory of NIfTI volume image files and select the &amp;quot;hhr_struct&amp;quot; file.&lt;br /&gt;
::5. Another window with the image scan of the subject will appear. Begin drawing a rectangular box around the hippocampal region, covering both the left and right sides.&lt;br /&gt;
:::*Note: It is important to draw the rectangle with enough vertical space above and below the region to account for positional differences of the hippocampal region across different slides.&lt;br /&gt;
::6. Once the box has been drawn, double click inside the drawn region and Matlab will begin creating the file.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2788</id>
		<title>Segmentation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2788"/>
		<updated>2014-10-13T18:34:43Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Creating Segmentation Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_InitVol&lt;br /&gt;
:::*This command will begin initializing the volume anatomy file.&lt;br /&gt;
::4. In the window that appears, navigate to the subject&#039;s &amp;quot;nii&amp;quot; directory of NIfTI volume image files and select the &amp;quot;hhr_struct&amp;quot; file.&lt;br /&gt;
::5. Another window with the image scan of the subject will appear. Begin drawing a rectangular box around the hippocampal region, covering both the left and right sides.&lt;br /&gt;
:::*Note: It is important to draw the rectangle with enough vertical space above and below the region to account for positional differences of the hippocampal region across different slides.&lt;br /&gt;
::6. Once the box has been drawn, double click inside the drawn region and Matlab will begin creating the file.&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2787</id>
		<title>Segmentation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2787"/>
		<updated>2014-10-13T18:33:40Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Creating Segmentation Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_InitVol&lt;br /&gt;
:::*This command will begin initializing the volume anatomy file.&lt;br /&gt;
::4. In the window that appears, navigate to the subject&#039;s &amp;quot;nii&amp;quot; directory of NIfTI volume image files and select the &amp;quot;hhr_struct&amp;quot; file.&lt;br /&gt;
::5. Another window with the image scan of the subject will appear. Begin drawing a rectangular box around the hippocampal region, covering both the left and right sides.&lt;br /&gt;
:::*Note: It is important to draw the rectangle with enough vertical space above and below the region to account for height changes in different slides.&lt;br /&gt;
::6. Once the box has been drawn, double click inside the drawn region and Matlab will begin creating the file.&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2756</id>
		<title>Segmentation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2756"/>
		<updated>2014-09-30T20:31:10Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Creating Segmentation Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. ls ../../../nii/&lt;br /&gt;
:::*This command will list the NIfTI volume image files for the particular subject while remaining in the subject&#039;s unfold directory.&lt;br /&gt;
::4. Find the file that has &amp;quot;hhr_struct&amp;quot; in its name and copy the whole NAME&lt;br /&gt;
::5. NLF_InitVol(&amp;quot;,&#039;../../../nii/NAME&#039;);&lt;br /&gt;
:::*The file name that you copied should be in place of NAME. This command will&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2755</id>
		<title>Segmentation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2755"/>
		<updated>2014-09-30T20:29:58Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Creating Segmentation Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. ls ../../../nii/&lt;br /&gt;
:::*This command will list the NIfTI volume image files for the particular subject&#039;s while remaining in the unfold directory.&lt;br /&gt;
::4. Find the file that has &amp;quot;hhr_struct&amp;quot; in its name and copy the whole NAME&lt;br /&gt;
::5. NLF_InitVol(&amp;quot;,&#039;../../../nii/NAME&#039;);&lt;br /&gt;
:::*The file name that you copied should be in place of NAME. This command will&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2754</id>
		<title>Segmentation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Segmentation&amp;diff=2754"/>
		<updated>2014-09-30T20:29:28Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: Created page with &amp;quot;===Creating Segmentation Files===  Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. O...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Creating Segmentation Files===&lt;br /&gt;
&lt;br /&gt;
Segmentation files are created by first creating vAnatomy.dat files in Matlab. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create the vAnatomy.dat file and prepare the high resolution T2 images, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. ls ../../../nii/&lt;br /&gt;
:::*This command will list the NIfTI volume image files for the particular subject&#039;s while remaining in the unfold directory.&lt;br /&gt;
::4. Find the file that has &amp;quot;hhr_struct&amp;quot; in its name and copy the whole NAME&lt;br /&gt;
::5. NLF_InitVol(&#039;&#039;,&#039;../../../nii/NAME&#039;);&lt;br /&gt;
:::*The file name that you copied should be in place of NAME. This command will&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2753</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2753"/>
		<updated>2014-09-30T20:10:19Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Segmentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
Creating Segmentation files&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of [[segmentation]] is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2752</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2752"/>
		<updated>2014-09-30T20:09:56Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Segmentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
Creating /* Segmentation */ files&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of [[segmentation]] is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2751</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2751"/>
		<updated>2014-09-30T20:09:26Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Segmentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
Creating Segmentation files&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of [[segmentation]] is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2746</id>
		<title>Unfolding</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Unfolding&amp;diff=2746"/>
		<updated>2014-09-12T17:19:16Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* Interpolation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several steps to successfully unfolding the high resolution scans of the hippocampus. The details for this section fall into the broad categories of segmentation, interpolation, demarcations, and calculating thickness. A knowledge of command line is necessary, as well as obtaining the tools for each step.&lt;br /&gt;
&lt;br /&gt;
==Tools Required==&lt;br /&gt;
*A copy of Windows&lt;br /&gt;
*A virtual machine emulator &lt;br /&gt;
*A command line interface to connect to [[Hoffman2|hoffman]]&lt;br /&gt;
*MrGray (Windows only)&lt;br /&gt;
*Matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Segmentation==&lt;br /&gt;
===Overview===&lt;br /&gt;
The goal of [[segmentation]] is to create a strip of gray matter in the hippocampus by locating the boundaries of the hippocampus in the brain. Using FMRI technology, the brain is sliced anteriorly to posteriorly to obtain slices of all parts of the hippocampus, creating a 2D version of the 3D hippocampus that can be mapped and analyzed. After opening [[VirtualBox]], we run a computer program, [[MrGray Segmentation software for Windows]], where we can view and find all the slices of the brain that show a portion of the hippocampus. On these slices,the hippocampal gray matter is surrounded by white matter and cerebral spinal fluid (CSF). We must mark the surrounding white matter and CSF respectively to obtain our strip of gray matter in between. The CSF material is the strip of atrophy on the interior of the gray matter, which begins at the hippocampal fissure, follows down to the collateral sulcus, and finishes after the second sulcus. The white matter is the material on the exterior portion of the gray matter. It is important to note that the shape of the hippocampal head changes from anterior to posterior in the brain. On the anterior slices, the hippocampal head has a long, oval shape. In the posterior slices, the hippocampal head has a round, almond shape. On the anterior slices, the CSF matter comes up to meet the white matter at the hippocampus head and also continues through the second sulcus through the gray matter to close off our strip. In the posterior slices, the CSF still continues through the second sulcus to the gray matter to close off the strip, but the white matter comes down to the CSF at the hippocampal fissure on the hippocampal head.&lt;br /&gt;
&lt;br /&gt;
===Getting Started: The Initial Segmentation Checklist===&lt;br /&gt;
#Export all of your vAnatomyCrop.dat files to a PC (ftp using binary).&lt;br /&gt;
#Run the program mrGray&lt;br /&gt;
#Create a new project and name it after your subject. Use the following nomenclature:&lt;br /&gt;
::AD_#####&lt;br /&gt;
:::ex. AD_12345&lt;br /&gt;
&lt;br /&gt;
For a subject with the Small ID 12345, who was scanned on May 25th, 2012, the following would be the subject entry in /u/home/data/sbook/data/AD/subjects:&lt;br /&gt;
::subj ID: AD_12345&lt;br /&gt;
::date: 20120525 (yyyymmdd)&lt;br /&gt;
::And it would be in the following path:&lt;br /&gt;
:::/u/home/sbook/data/AD/subjects/AD_12345/20120525/... etc etc.&lt;br /&gt;
&lt;br /&gt;
Subjects file names should look like:&lt;br /&gt;
::subject ID: AD_12345&lt;br /&gt;
::subject scan date: 20120525&lt;br /&gt;
::segmentation: AD_12345_seg&lt;br /&gt;
::interpolation: AD_12345_interpright or AD_12345_interpleft&lt;br /&gt;
&lt;br /&gt;
Once you have completed the segmentation session make sure to update our filemaker tab in objective fitness spreadsheet&lt;br /&gt;
::Select name for new project in AD/subjects/AD_XXXXX/SCANDATE/analysis/structural/unfold/segmentation&lt;br /&gt;
:::Select vAnatomyCrop.dat&lt;br /&gt;
:::Figure out which slices to segment based on anatomical guidelines.&lt;br /&gt;
::::*Anteriorly, choosing the last slice in which hippocampal head is visible is a consistent start point we&#039;ve used&lt;br /&gt;
&lt;br /&gt;
::Below are anatomical diagrams of the hippocampus and what to look for:&lt;br /&gt;
[[File:unfolding-Anat.png]]&lt;br /&gt;
:::Figure 1. Anatomical diagram, with an inferior view of the whole brain at the left, an inferior view of the temporal lobe 	at the center, and coronal sections from the two indicated slices at the right. A: Anterior slice through entorhinal 	cortex. B: Posterior slice 	through parahippocampal cortex. ERC, entorhinal cortex; PRC, perirhinal cortex; PHC, 	parahippocampal cortex; FG, fusiform gyrus; Sub, subiculum; CA 1,cornu ammonis 1; CA 2,3, CA fields 2 and 3; 	DG, dentate gyrus; CoS, collateral sulcus.&lt;br /&gt;
[[File:unfolding-Hipp.png]]&lt;br /&gt;
:::Figure 2. Coronal view of right side of the hippocampus. In the coronal plane the hippocampus and parahippocampal gyrus form an S-shaped configuration. The hippocampus itself consists of two interlocking C-shaped structures: the cornu ammonis and the dentate gyrus. Histologically, the hippocampus is further divided into 4 sections CA1 to CA4.&lt;br /&gt;
&lt;br /&gt;
Once file is created, you may begin segmentation process:&lt;br /&gt;
#Segment the white matter 1st (colored in beige) (red in our lab), using a pixel size of 3 pixels minimum&lt;br /&gt;
#Select white matter with the checkbox at the right&lt;br /&gt;
#Another checkbox indicates the highlight size (use 3)&lt;br /&gt;
#The left mouse button highlights a pixel, and the right mouse button deselects pixels&lt;br /&gt;
#Then, segment the CSF (colored in yellow) (blue in our lab), imposing a thin boundary on the segmentation. (You want it thin because you will expand it after the interpolation step).&lt;br /&gt;
#Save the segmentation (File -&amp;gt; Classification -&amp;gt; Save as with the above nomenclature).&lt;br /&gt;
::*&#039;&#039;&#039;Save early, save often.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here is an example of an initial segmentation: Starting anteriorly and ending posteriorly:&lt;br /&gt;
&lt;br /&gt;
:[[File:unfolding-Seg_P1.png]]&lt;br /&gt;
:[[File:unfolding-Seg_P2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Interpolation==&lt;br /&gt;
Explain [[Interpolation]] here.&lt;br /&gt;
&lt;br /&gt;
To load an existing project, when you&#039;re in MrGray, you&#039;ll click on Load project and you can select any .mrp file.&lt;br /&gt;
These will be named AD_1XXXX_interpleft or _interpright. It will then appear and you should be able to see the CSF&lt;br /&gt;
and white matter masks if they are selected in the toolbar.&lt;br /&gt;
&lt;br /&gt;
Create a new interpolation file; these are the steps you will take:&lt;br /&gt;
&lt;br /&gt;
# Open the menu and select File &amp;gt; New Project&lt;br /&gt;
# In the first window go to the subject&#039;s unfold directory (ie. ...AD/subjects/AD_1XXXX/2012####/analysis/structural/unfold/interpolation)&lt;br /&gt;
# Name the project AD_1XXXX_interpleft or AD_1XXXX_interpright and hit enter&lt;br /&gt;
# In the second window select the Volume anatomy file for the interpolation file (vAnatInterp.dat file) and hit enter&lt;br /&gt;
# When the image displays, you will now go to the File menu again and then to &amp;quot;Classification&amp;quot;. Then click &amp;quot;load classification file&amp;quot;.&lt;br /&gt;
# The window that pops up will ask you to select a class file. This will be AD_1XXXX_interpright or interpleft that already exists in the directory. Select the side for which you created and hit enter. &lt;br /&gt;
# Check to make sure the masks align correctly.&lt;br /&gt;
&lt;br /&gt;
==Demarcations==&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
After segmentation and interpolation, [[demarcations]] create the boundaries for the different region of the hippocampus. These boundaries can be conveniently drawn using FSLview. Open your hire structural image. Be sure this is the same brain that you used for the unfolding process. It is important to note that these images are in radiological convention, so if you&#039;re drawing on the right side of the screen, this is actually the left hemisphere. Look at your notes to determine which slices were segmented and used for unfolding; only draw boundaries on the slices that have been segmented. To create a new boundary, go to the file menu and select &amp;quot;Create Mask.&amp;quot; In the lower left corner, you&#039;ll see a blue &amp;quot;i&amp;quot;; click on this to re-name your boundary as needed, and to select the color you&#039;d like to draw with. To zoom in on the MTL, first go to View/Single, and then expland the coronal image. Use the zoom tool to magnify the MTL. Click on the pencil tool, and make adjustments as desired. A brightness with typically a max of 1 and a small pencil size work best. If using a mouse, the left button draws the boundary and the ctrl+ left button erases. When saving, be sure to save to your Demarcations directory, and to use the proper naming convention. It is best to complete one boundary at a time across all slices, and then move on to the next boundary.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
Before starting to draw, you want to first identify the slice where the hippocampal head begins. It is important to note that where the hippocampal head &amp;quot;begins&amp;quot; means where it begins when going in the Posterior to Anterior direction. This slice, which will be called the &#039;&#039;&#039;hippocampal head slice&#039;&#039;&#039; throughout the rest of these instructions is where the anterior structures will start. Also, drawing shorter/smaller boundaries will reduce variability once projected onto the flat maps, giving you a straighter line. In general, boundary doesn&#039;t need to cross the entire gray matter area; keep the boundary towards the medial or superior side of things, as appropriate.&lt;br /&gt;
&lt;br /&gt;
===Naming Convention===&lt;br /&gt;
Boundaries drawn on all the slices:&lt;br /&gt;
*&#039;&#039;&#039;Fus&#039;&#039;&#039;(Fusiform)&lt;br /&gt;
* &#039;&#039;&#039;CollSul&#039;&#039;&#039;(Collateral Sulcus) &lt;br /&gt;
*&#039;&#039;&#039;SubCA1&#039;&#039;&#039;(Subiculum-CA1)&lt;br /&gt;
* &#039;&#039;&#039;CA1CA23DG&#039;&#039;&#039;(CA1-CA23DG) &lt;br /&gt;
Boundaries drawn on anterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;ERCSub&#039;&#039;&#039; (Entorhinal Coral- Subiculum)&lt;br /&gt;
*&#039;&#039;&#039;PRCERC&#039;&#039;&#039; (Perirhinal Cortex- Entorhinal Cortex) &lt;br /&gt;
*&#039;&#039;&#039;AntCADG&#039;&#039;&#039; (Anterior portion of CA fields and Dentate Gyrus)&lt;br /&gt;
* &#039;&#039;&#039;ERCPRCPHC&#039;&#039;&#039; (Boundary between anterior structures Entorhinal/Perirhinal Cortices and the posterior structure Parahippocampal Cortex)&lt;br /&gt;
Boundaries drawn on the posterior slices only: &lt;br /&gt;
*&#039;&#039;&#039;PHCSub&#039;&#039;&#039; (Parahippocampal Cortex- Subiculum)&lt;br /&gt;
&lt;br /&gt;
===Individual Boundaries===&lt;br /&gt;
On each of the slices that were segmented, we must determine which boundaries to mark. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fusiform (Fus)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-Fus.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the lateral side of the collateral sulcus (on the side closer to the second sulcus)&lt;br /&gt;
::*Outline of collateral sulcul shown in red; boundary between sulcus and fusiform gyrus shown in yellow&lt;br /&gt;
::*Fusiform is lateral to the boundary&lt;br /&gt;
&#039;&#039;&#039;Collateral Sulcus (CollSul)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CollSul.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend in the superior tip of the collateral sulcus&lt;br /&gt;
::*Outline of collateral sulcus shown in yellow; boundary shown in red&lt;br /&gt;
&#039;&#039;&#039;Separating PHC from Subiculum (PHCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PHCSub.jpg]]&lt;br /&gt;
::*Posterior slices only &lt;br /&gt;
::*Begin drawing on the first slice posterior to the hippocampal head slice, and continue to draw on the remainder of the posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon approximately 50% of the way up the bend&lt;br /&gt;
::*Bend shown in red, boundary between subiculum and PHC shown in green&lt;br /&gt;
::*Subiculum is superior to boundary&lt;br /&gt;
&#039;&#039;&#039;Separating Subiculum from CA1 (SubCA1)&#039;&#039;&#039;&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*&#039;&#039;Anterior&#039;&#039;: boundary more lateral; draw boundary underneath &amp;quot;bump&amp;quot; where the curve of the hippocampus comes in, bisecting it&lt;br /&gt;
:::* Bump shown in red, boundary between Sub and CA1 shown in blue&lt;br /&gt;
:::* Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
::: [[File:unfolding-SubCA1_Anterior.jpg]]&lt;br /&gt;
::*&#039;&#039;Posterior&#039;&#039;: boundary more medial; draw boundary where the hippocampus pinches off into a tear-drop shape, or folds into itself&lt;br /&gt;
:::*Teardrop shown in red, boundary between Sub and CA1 shown in blue &lt;br /&gt;
:::*Sub is medial to the boundary, CA1 is lateral&lt;br /&gt;
:::[[File:unfolding-SubCA1_Posterior.jpg]]&lt;br /&gt;
&#039;&#039;&#039;Separating CA1 from CA23DG (CA1CA23DG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-CA1CA23DG.jpg]]&lt;br /&gt;
::*Both anterior and posterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the bend (on the path where the hippocampal fissure would extend to in the hippocampal head)&lt;br /&gt;
::*Bend shown in red; boundary between CA1CA23DG shown in green&lt;br /&gt;
&#039;&#039;&#039;Separating ERC from Subiculum (ERCSub)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCSub.jpg]]&lt;br /&gt;
::*Anterior slices only&lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*If you were to continue the lateral boundary of the hippocampus inwards medially, it would divide the hippocampus and the ERC&lt;br /&gt;
::*Draw boundary along this divide, perpendicular to gray matter ribbon&lt;br /&gt;
::*Lateral boundary shown in red, boundary between ERC and Sub shown in yellow&lt;br /&gt;
&#039;&#039;&#039;Separating PRC from ERC (PRCERC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-PRCERC.jpg]]&lt;br /&gt;
::*Anterior slices only &lt;br /&gt;
::*Begin drawing on hippocampal head slice, and continue to draw on the remainder of the anterior slices&lt;br /&gt;
::*Draw boundary perpendicular to the gray matter ribbon at the &amp;quot;elbow&amp;quot; of the medial side of the collateral sulcus (the side of the collateral sulcus closer to the hippocampal head)&lt;br /&gt;
::*Collateral sulcus outlined in yellow, boundary between PRC and ERC in green&lt;br /&gt;
::*ERC medial to boundary, PRC lateral&lt;br /&gt;
&#039;&#039;&#039;Anterior CA fields and Dentate Gyrus (AntCADG)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-AntCADG.jpg]]&lt;br /&gt;
::*Only one slice: draw on the first slice anterior to the hippocampal head slice (this should be the slice where you first see undulations going in the Posterior to Anterior direction)&lt;br /&gt;
::*Draw boundary straight through middle of CADG area, and extend all the way laterally to the CA1CA23DG boundary (go through the middle of the hippocampal head between the fissure and the top of the head)&lt;br /&gt;
::*Undulations highlighted in red; CA1CA23DG boundary in green; AntCADG boundary in white&lt;br /&gt;
&#039;&#039;&#039;Creating A/P boundary (ERCPRCPHC)&#039;&#039;&#039;&lt;br /&gt;
::[[File:unfolding-ERCPRCPHC.jpg]]&lt;br /&gt;
::*Only one slice: draw on the hippocampal head slice&lt;br /&gt;
::*Starting at the ERCSub boundary, draw a line in the middle of the gray matter ribbon up and over the collateral sulcus, all the way out to the Fus boundary&lt;br /&gt;
::* ERCSub and Fus boundaries shown in yellow&lt;br /&gt;
::* ERCPRCPHC boundary shown in white&lt;br /&gt;
&lt;br /&gt;
===Directory Outline: How to Open FSLView Through Terminal===&lt;br /&gt;
:Below is an outline for the directory path. In order to open files for segmentation, interpolation, and demarcation in the unfolding process, you must be able to navigate the Terminal. &lt;br /&gt;
&lt;br /&gt;
::[[File:unfolding-Dir_Route.png]]&lt;br /&gt;
&lt;br /&gt;
The best way to open FSLview in order to do demarcations is through the FSLview path in &#039;&#039;Terminal&#039;&#039;. Below are the following steps to open a file for demarcations.&lt;br /&gt;
 &lt;br /&gt;
#ssh -X johnsmith@hoffman2.idre.ucla.edu&lt;br /&gt;
: This is your login. You must have a &#039;&#039;&#039;hoffman&#039;&#039;&#039; account to access &#039;&#039;Terminal&#039;&#039;&lt;br /&gt;
#/u/home/FMRI/sbook/data/AD/subjects &lt;br /&gt;
: This is your homebase directory. Once logged into hoffman, you will be able to access the path of directories seen above. &lt;br /&gt;
::For each subject, there is a &#039;&#039;&#039;nii&#039;&#039;&#039; directory and a &#039;&#039;&#039;analysis&#039;&#039;&#039; directory, which contain information used for demarcations.&lt;br /&gt;
:::The &#039;&#039;&#039;nii&#039;&#039;&#039; directory contains the image files for the brain scans.&lt;br /&gt;
:::The &#039;&#039;&#039;analysis&#039;&#039;&#039; directory contains the subdirectories &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and &#039;&#039;&#039;structural&#039;&#039;&#039;.&lt;br /&gt;
::::The preprocessing directory may also contain the hhr structural image file, as seen in the nii directory .&lt;br /&gt;
::::The structural directory contains the &#039;&#039;&#039;unfold&#039;&#039;&#039; directory which contains folders for &#039;&#039;segmentation&#039;&#039;, &#039;&#039;interpolation&#039;&#039;, and &#039;&#039;demarcations&#039;&#039;. &lt;br /&gt;
#cd AD_10210/2008XXXX/analysis/structural/unfold&lt;br /&gt;
:In this unfold directory, you can check if the hhr image file is already in preprocessing. If the hhr image file is already in the preprocessing directory, it can be opened directly in FSL view. &lt;br /&gt;
#fslview hhr_struct_6.nii.gz&lt;br /&gt;
: If the hhr image is not in the preprocessing directory, you can copy the image from the &#039;&#039;&#039;nii&#039;&#039;&#039; directory into the &#039;&#039;&#039;preprocessing&#039;&#039;&#039; and then open it in FSL view.&lt;br /&gt;
#cd ../../../subjects/AD_1XXXXX&lt;br /&gt;
#cd nii &lt;br /&gt;
#cp nii/hhr_struct_6.nii.gz   ../analysis/preprocessing/hhr_struct_6.nii.gz&lt;br /&gt;
##fslview hhr_struct_6.nii.gz (check if this step is fslview analysis/preprocessing/hhr_struct_6.nii.gz)&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://www.virtualbox.org/ Virtual Box: Virtual machine software]&lt;br /&gt;
*[http://white.stanford.edu/~brian/mri/segmentUnfold.htm MrGray Segmentation software for Windows]&lt;br /&gt;
*[http://www.cygwin.com/ Cygwin Command-line interface for Windows]&lt;br /&gt;
*[http://www.ats.ucla.edu/clusters/hoffman2/ Hoffman2 Home Page]&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Interpolation&amp;diff=2745</id>
		<title>Interpolation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Interpolation&amp;diff=2745"/>
		<updated>2014-09-12T06:33:12Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: /* General Tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Interpolation==&lt;br /&gt;
===Creating Interpolation Files===&lt;br /&gt;
&lt;br /&gt;
In Matlab, interpolation files are created by an algorithm that generates slices in between the segmentation images. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create a new interpolation project, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_WhiteMatterCsfInterpolate&lt;br /&gt;
:::*&#039;&#039;&#039;IMPORTANT: This command will automatically generate the interpolation file for the LEFT side of the subject&#039;s segmentation image. Reminder that this orientation is radiological, meaning when you are looking at segmentation images that run posterior to anterior it will be the RIGHT side. To generate the interpolation for the radiological RIGHT side use the command: NLF_WhiteMatterCsfInterpolate(&#039;right&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once the command has been run, a window with the subject&#039;s segmented slices will appear. Scroll through by clicking on the left and right arrows to confirm if the orientation matches with your segmentation file in MrGray.&lt;br /&gt;
&lt;br /&gt;
After confirming, click the &amp;quot;Select ROI (Only one anatomical side)&amp;quot; button and draw a box around the &#039;&#039;&#039;correct side&#039;&#039;&#039; of the segmentation image (if NLF_WhiteMatterCsfInterpolate you will draw around and select what you see on the RIGHT side). When drawing, &#039;&#039;&#039;make sure there is a considerable amount of empty space around the segmented region while the edges of box do NOT touch the edge of the blue window. Do NOT overlap with the unselected segmented region.&#039;&#039;&#039; After drawing, double click on the selected region.&lt;br /&gt;
&lt;br /&gt;
Another window with the interpolation slices will appear. You can scroll by clicking on the left and right arrows to go through the slices and click the up and down arrows to alter the threshold of how much CSF or White Matter is filled. Select the &amp;quot;Write mrGray File and Render 3D&amp;quot; button. A final window of a segmented 3D region in gray and white will appear.&lt;br /&gt;
&lt;br /&gt;
===Instructions===&lt;br /&gt;
The goal of interpolation is to create the smoothest transitions of segmented gray matter by editing the 6 new slices between each segmentation image created by the algorithm in Matlab. The segmentation images are all the edited slices with numbers divisible by 7. They should serve as &amp;quot;goal posts&amp;quot; to smoothly transition one segmentation image to the next.&lt;br /&gt;
&lt;br /&gt;
There are several things to keep in mind:&lt;br /&gt;
&lt;br /&gt;
::1. There should be no significant &amp;quot;jumps&amp;quot; of white matter or CSF between each slice.&lt;br /&gt;
::2. Because the segmentation images were used as templates to generate the interpolation slices, do not edit the segmentation slices.&lt;br /&gt;
::3. Towards the anterior slices, there is a dark region at the top hippocampal head known as the fimbria, that can be mistaken for white matter. Be careful not to pixelate over possible hippocampal gray matter that is located above this dark region.&lt;br /&gt;
::4. Be aware of having one voxel projecting from the rest of the white matter or CSF. The smoothest transitions also include uniform movement between slices.&lt;br /&gt;
&lt;br /&gt;
Once interpolation has been completed, the center point for both the left and right side can be found by going to the middle slice and placing the position crossbars on the center of the gray matter between the tip of the CSF of the collateral sulcus and white matter. Input the values for X, Y, Z into the spreadsheet for the subject. &lt;br /&gt;
&lt;br /&gt;
To create gray matter for the finished interpolation subject:&lt;br /&gt;
&lt;br /&gt;
::1. Open the menu and select Classification &amp;gt; Gray Layers&lt;br /&gt;
::2. In the window that appears uncheck Gray contention and click OK&lt;br /&gt;
::3. Go to the menu again and select Classification &amp;gt; Grow Gray Matter&lt;br /&gt;
::4. Close the window after it is complete&lt;br /&gt;
&lt;br /&gt;
To save gray matter, hold Control on the keyboard and click on the gray matter. This will select the green gray matter, changing its color to blue. Go to the menu and select File &amp;gt; Save selected gray.&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
	<entry>
		<id>https://www.ccn.ucla.edu/wiki/index.php?title=Interpolation&amp;diff=2744</id>
		<title>Interpolation</title>
		<link rel="alternate" type="text/html" href="https://www.ccn.ucla.edu/wiki/index.php?title=Interpolation&amp;diff=2744"/>
		<updated>2014-09-12T06:29:52Z</updated>

		<summary type="html">&lt;p&gt;SRP Wiki: Created page with &amp;quot;==Interpolation== ===Creating Interpolation Files===  In Matlab, interpolation files are created by an algorithm that generates slices in between the segmentation images. To o...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Interpolation==&lt;br /&gt;
===Creating Interpolation Files===&lt;br /&gt;
&lt;br /&gt;
In Matlab, interpolation files are created by an algorithm that generates slices in between the segmentation images. To open Matlab in Terminal you must be logged into hoffman. Once you are logged on, you will run these commands in Terminal:&lt;br /&gt;
&lt;br /&gt;
::1. qrsh -l i,h_rt=5:00:00,h_data=4G&lt;br /&gt;
:::*The &amp;quot;5:00:00&amp;quot; indicates that Matlab will run for 5 hours.&lt;br /&gt;
::2. module load matlab/7.14&lt;br /&gt;
::3. matlab&lt;br /&gt;
&lt;br /&gt;
To create a new interpolation project, you will run these following commands in Matlab:&lt;br /&gt;
&lt;br /&gt;
::1. addpath(genpath(&#039;/u/home/FMRI/apps/unfolding/current/&#039;));&lt;br /&gt;
:::*Note: The warning message can be ignored.&lt;br /&gt;
::2. cd /u/project/sbook/data/AD/subjects/AD_1XXXX/20######/analysis/structural/unfold &lt;br /&gt;
:::*X&#039;s denote the subject number and # indicates scan date. Running this command will take you to the subject&#039;s unfold directory.&lt;br /&gt;
::3. NLF_WhiteMatterCsfInterpolate&lt;br /&gt;
:::*&#039;&#039;&#039;IMPORTANT: This command will automatically generate the interpolation file for the LEFT side of the subject&#039;s segmentation image. Reminder that this orientation is radiological, meaning when you are looking at segmentation images that run posterior to anterior it will be the RIGHT side. To generate the interpolation for the radiological RIGHT side use the command: NLF_WhiteMatterCsfInterpolate(&#039;right&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once the command has been run, a window with the subject&#039;s segmented slices will appear. Scroll through by clicking on the left and right arrows to confirm if the orientation matches with your segmentation file in MrGray.&lt;br /&gt;
&lt;br /&gt;
After confirming, click the &amp;quot;Select ROI (Only one anatomical side)&amp;quot; button and draw a box around the &#039;&#039;&#039;correct side&#039;&#039;&#039; of the segmentation image (if NLF_WhiteMatterCsfInterpolate you will draw around and select what you see on the RIGHT side). When drawing, &#039;&#039;&#039;make sure there is a considerable amount of empty space around the segmented region while the edges of box do NOT touch the edge of the blue window. Do NOT overlap with the unselected segmented region.&#039;&#039;&#039; After drawing, double click on the selected region.&lt;br /&gt;
&lt;br /&gt;
Another window with the interpolation slices will appear. You can scroll by clicking on the left and right arrows to go through the slices and click the up and down arrows to alter the threshold of how much CSF or White Matter is filled. Select the &amp;quot;Write mrGray File and Render 3D&amp;quot; button. A final window of a segmented 3D region in gray and white will appear.&lt;br /&gt;
&lt;br /&gt;
===General Tips===&lt;br /&gt;
The goal of interpolation is to create the smoothest transitions of segmented gray matter by editing the 6 new slices between each segmentation image created by the algorithm in Matlab. The segmentation images are all the edited slices with numbers divisible by 7. They should serve as &amp;quot;goal posts&amp;quot; to smoothly transition one segmentation image to the next.&lt;br /&gt;
&lt;br /&gt;
There are several things to keep in mind:&lt;br /&gt;
&lt;br /&gt;
::1. There should be no significant &amp;quot;jumps&amp;quot; of white matter or CSF between each slice.&lt;br /&gt;
::2. Because the segmentation images were used as templates to generate the interpolation slices, do not edit the segmentation slices.&lt;br /&gt;
::3. Towards the anterior slices, there is a dark region at the top hippocampal head known as the fimbria, that can be mistaken for white matter. Be careful not to pixelate over possible hippocampal gray matter that is located above this dark region.&lt;br /&gt;
::4. Be aware of having one voxel projecting from the rest of the white matter or CSF. The smoothest transitions also include uniform movement between slices.&lt;br /&gt;
&lt;br /&gt;
Once interpolation has been completed, the center point for both the left and right side can be found by going to the middle slice and placing the position crossbars on the center of the gray matter between the tip of the CSF of the collateral sulcus and white matter. Input the values for X, Y, Z into the spreadsheet for the subject. &lt;br /&gt;
&lt;br /&gt;
To create gray matter for the finished interpolation subject:&lt;br /&gt;
&lt;br /&gt;
::1. Open the menu and select Classification &amp;gt; Gray Layers&lt;br /&gt;
::2. In the window that appears uncheck Gray contention and click OK&lt;br /&gt;
::3. Go to the menu again and select Classification &amp;gt; Grow Gray Matter&lt;br /&gt;
::4. Close the window after it is complete&lt;br /&gt;
&lt;br /&gt;
To save gray matter, hold Control on the keyboard and click on the gray matter. This will select the green gray matter, changing its color to blue. Go to the menu and select File &amp;gt; Save selected gray.&lt;/div&gt;</summary>
		<author><name>SRP Wiki</name></author>
	</entry>
</feed>