TITLE: Creating Diffusion Tensor Images (DTI)
AUTHORS: Laurel Dieckhaus

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">This procedure describes the steps required to create diffusion tensor images (DTI) from data from the MRI scanner. </div><div class = "text-block"><span style = "font-weight:bold;">The following programs are required to go through the protocol:</span></div><div class = "text-block"><ul style = "list-style-type:disc;"><li style = "counter-reset:ol0;list-style-type:disc;">MRtrix3 </li><li style = "counter-reset:ol0;list-style-type:disc;">TORTOISE</li><li style = "counter-reset:ol0;list-style-type:disc;">ITKsnap</li></ul></div><div class = "text-block"><span style = "font-weight:bold;">Note:</span><span> If you are working from a Windows computer, you will need to follow X2Go Client Set-Up (</span><a href="https://dx.doi.org/10.17504/protocols.io.6tvhen6" style = "text-decoration:underline;color:blue;cursor:pointer;"><span style = ":;">dx.doi.org/10.17504/protocols.io.6tvhen6</span></a><span>) before you can begin this protocol. </span></div></div>

[STEPS]
?. [Set Up Directory with Required Files]
Open a new terminal.
?. [Set Up Directory with Required Files]
Create a directory to place data. (If not already created.)
?. [Set Up Directory with Required Files]
Go to the directory that you plan to use.
?. [Set Up Directory with Required Files]
Copy directory where your raw data files that will be acquistioned, reside in. You will need the following file types:BvalsBvecsdata.img data.hdr* - (may not need this in all cases - used for FOV origin)
?. [Set Up Directory with Required Files]
Find where the files you plan to copy are located. Make sure to use the original root i.e /home/... as you will get an error if you start from another location.
?. [Set Up Directory with Required Files]
Copy the specific files that you need. Alternatively, you can use . to specify the current directory you are in.
?. [Set Up Directory with Required Files]
Perform conversion between different file types.
?. [Set Up Directory with Required Files]
Import data from nifti format to TORTOISE list file format. A new directory will be created and the folder will be labeled ____proc.Example:
?. [Set Up Directory with Required Files]
Go to the new directory that was created from the previous step.
?. [Set Up Directory with Required Files]
Correct motion. Use DIFFPREP command. (This is a command from TOROISE). Note: This step is time & core consuming. Also, this step removes Gibbs ringing and noise
?. [Create Mask and Segmentation]
Open one of the populated files using ITKsnap.
?. [Create Mask and Segmentation]
Within ITKsnap, select Active Contour (aka Snake) Segmentation Mode from the toolbar.
?. [Create Mask and Segmentation]
A new side window will appear. Select Segment 3D.
?. [Create Mask and Segmentation]
Toggle the thresholds (lower & upper) so that the blue mask covers the region you want repelled. (Regions that are empty space or not the brain of interest should have this mask). Note: Try not to change the defaults.
?. [Create Mask and Segmentation]
When the thresholds have been finalized, select Next.
?. [Create Mask and Segmentation]
Set the cursor in the relative center of your object of interest. Select Add bubble at cursor. A red circle(seed/bubble) will be placed at the location. Note: You may need to repeat this if you have multiple objects of interest.
?. [Create Mask and Segmentation]
When the bubbles have been set and you have no more to add, select Next.
?. [Create Mask and Segmentation]
Press the play buton to have the seed grow within the mask that was set-up in a previous step. Note: Red should propagate and fill the entire region(s) of interest. This may require viewing the images from the different planes to confirm.
?. [Create Mask and Segmentation]
Once the region(s) of interest are completely filled, select Finish.
?. [Create Mask and Segmentation]
Press Update in the lower left corner of the ITKsnap interface to view the new 3D segmentation image.
?. [Create Mask and Segmentation]
Select Segmentation and Save As from the drop-down menu. You will be prompted to save your file as a __.nii.gz file type.  It is recommended you name your file __mask to clarify segmentation has already been performed.
?. [Set Up Directory with Required Files]
Confirm what directory you are currently in.
?. [Create Mask and Segmentation]
Close out of ITKsnap.
?. [Create Mask and Segmentation]
Estimate diffusion tensor and Bo amplitude. This command will generate 2 files:___N1_DT.nii (diffusion tensor)___DT_AM.nii (B0 amplitude)
?. [Create Mask and Segmentation]
In an open terminal, unzip the ___.nii.gz file that was segmented in the previous step.
?. [Create Mask and Segmentation]
Compute all tensor maps on the ___N1_DTI.nii output file from the previous step.
?. [Create Mask and Segmentation]
Open the ___DEC.nii output file in ITKsnap to view the primary eigenvector map.
?. [Create Mask and Segmentation]
Within  ITKsnap, select Layer Inspector.
?. [Create Mask and Segmentation]
From the Layer Inspector window, select the Display mode drop-down menu and select RGB Display.
?. [Create Mask and Segmentation]
The final result will show a colorized image of your region of interest that allows a visual guide that estimates location, orientation, and anisotropy of the brain's white matter tracts based on the diffusion of water molecules.
?. [Create Mask and Segmentation]
Press Update in the lower left corner of the ITKsnap interface to view the image in the new display mode.