TITLE: DIFFPREP for DTI Processing and Corrections
AUTHORS: Courtney Comrie

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">This protocol will provide a basic guide to utilizing the DIFFPREP tool in TORTIOSE.</div><div class = "text-block">Note: Steps may vary based upon image.</div></div>

[STEPS]
?. [Introduction]
DIFFPREP is a distortion and motion correction module in TORTOISE. When processing MR images you will commonly start with DIFFPREP for corrections.
?. [Beginning Steps]
Build your directory in the terminal, and make sure to use copied raw data for processing
?. [Beginning Steps]
In the terminal go to your new directory with the data
?. [Import DTI Data]
Type the following command in your terminal to read information and options available:Type the following command to import your blip_up and blip_down data:
?. [Import DTI Data]
Blip up is the forward phase encoding of a scan while blip down is the same exact scan but with reversed phase encoding.You may not always will have both blip up and blip down, but for the purpose of this protocol both will be shown.
?. [Viewing DTI Images]
Change directories to the containers.
?. [Viewing DTI Images]
Load the singularity containers
?. [Viewing DTI Images]
You should be able to see the contents of the container.
?. [Viewing DTI Images]
Start by loading ITKSNAP and looking at the orientation of your imageNote: You can also use MIPAV and MRtrix (mrview) to view your imags
?. [Viewing DTI Images]
Type:
?. [Viewing DTI Images]
On the ITKSNAP GUI, scroll over to file and import your DTI NIFTI file.
?. [Viewing DTI Images]
View the raw data image, and make note of the orientation of the blip down image.This will become important in step 8.(Note: The image should naturally be in RPS, and for our purposes of DTI images you want LPS)Here are a couple sources for understanding orientation.https://www.slicer.org/wiki/Coordinate_systemshttp://www.grahamwideman.com/gw/brain/orientation/orientterms.htm
?. [ImportNIFTI]
This step is crucial for obtaining the .list file which will be used in DIFFPREP and DRBUDDIType the following to get information and options of the command.
?. [ImportNIFTI]
The general full command is the following:Note:directory: where your NIFTI file is storedphase_direction: can either be vertical or horizontal based upon what your phase encoding direction isoutput_folder: where you want your data to be stored when it's done importing
?. [Reorient DTI Images]
In the terminal type:This will give you information about the command, and the different options available.
?. [Reorient DTI Images]
Type:
?. [Reorient DTI Images]
Note: This should be done with the list file in your proc folder.
?. [Reorient DTI Images]
Note: You only need to reorient the blip down data. The blip down data is inverse when it is acquired form the scanner, changing the orientation of the image.
?. [Extract DTI Images]
To check your reoriented image use the following command to extract from 4D image.This will give you information about the command, and the different options available.Yo
?. [Extract DTI Images]
Type:
?. [Extract DTI Images]
You can view and edit your extracted image on ITKSNAP.
?. [Edit Settings File]
Before you run DIFFPREP, you must make sure your settings file is Compatible with size and resolution of your dataIn your user's directoryWill give you the corrections needed in DIFFPREP
?. [Edit Settings File]
In your user's directory make a folder titled "DIFF_PREP_WORK". By doing it in the file browser GUI or by navigating in your terminal and typing:
?. [Edit Settings File]
Copy the setting templates to YOUR OWN DIFF_PREP_WORK
?. [Edit Settings File]
Only need to make the directory and copy the settings file if you haven't done it alreadyThere are multiple settings.dmc templates on the HPC, it would be a good idea to copy all of them to your DIFF_PREP_WORK directory
?. [Edit Settings File]
In your home DIFF_PREP_WORK directory, right click on the IVmouse_2D.dmc and select Open With > gedit
?. [Edit Settings File]
You should see a bunch of text like the following:The DARK BLUE text tells you information about the sections and options you can use, the BLACK text is what you can edit.Correction ModeChange to the registration to rigidEPI CorrectionMake sure it is turned off. Only turn it on if you don't plan on using DRBUDDI later.Gibbs Ringing CorrectiononDenoisingfor_finalHumanity0Basically is asking if your brain is human or notUpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.EPI CorrectionMake sure it is turned off. Only turn it on if you don't plan on using DRBUDDI later.Gibbs Ringing CorrectiononDenoisingfor_finalHumanity0Basically is asking if your brain is human or notUpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Gibbs Ringing CorrectiononDenoisingfor_finalHumanity0Basically is asking if your brain is human or notUpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Denoisingfor_finalHumanity0Basically is asking if your brain is human or notUpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Humanity0Basically is asking if your brain is human or notUpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.UpsamplingallHigh B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.High B-value RegistrationYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Enter your three valuesPre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.Pre-Smoothing  Turn off!!! Very important!FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.FOVYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionYou need to know the 3 values for the scan you are processing. If you don't know it, you can find it in the methods file.ResolutionThese are the main settings you will need to change on a scan to scan basis, but keep in mind you may change other settings not mentioned here or will need different inputs than what are mentioned above.
?. [DIFFPREP]
Type in terminal:The specific settings.dmc file will change based upon the animal and type of image you are processing. This specific .dmc file is for ferrets, but be aware mice will use a different settings file.
?. [Import DTI Data]
Note:Sometimes your blip up and blip down data will be split across four scans (two blip up scans and two blip down scans). If that is the case, simply make a new folders and move the all the blip up raw data into one folder, rename the first blip up raw folder as 01, and the second as 02. Do the same for the blip down data.In other words you should have two folders (one for blip up and down) each with two sub-folders labeled as 01 and 02 corresponding to their scan order.For the ImportBruker command, you only need to input UP to the blip up/down folder containing the subfolders for the path.
?. [Import DTI Data]
Note:If you want to control where InputBruker puts the output proc folder, use -o with the desired directory.
?. [Get .bval and .bvec]
Type the following command to get your bval and bvec files.
?. [Get .bval and .bvec]
Note: The blip down and blip up should have matching bmatrix files, so this command only needs to be done once.
?. [Viewing DTI Images]
If desired, to use MIPAV Or type the following command to access mrview.