Good news!!! DIFFCALC is now entirely command line.

Please check the commands listed in the DIFFCALC folder.

*NOTE: the commands listed here is the updated list present in the DIFFCALC320 folder. *

If you performed processing with older versions of TORTOISE ver 3 and above, you may still use these commands from version 3.2 to perform tensor fitting from command line.

A tensor needs to be computed from your processed data to compute the scalar maps listed in the folder.

To run a non linear tensor fitting on the processed DIFFPREP output or DRBUDDI output result.

**EstimateTensorNLLS -i <processed.list> -m <binary_mask optional>**

** The output is a _N1_DT.nii which will be used to derive scalar maps listed. The output of this will be used in your analysis or template creation*

*** binary mask to be provided during tensor fitting has been detailed on this page. Mask is optional. DIFFCALC will not automatically generate a binary mask. *

***Please refer to the end of this page if you are interested in using the EstimateTensorWLLS which is primarily used for quality check.*

*===========*

**Creating a binary mask**

===========

Please use software of choice to create a binary mask for your data. An example masking command with FSL bet is provided for convenience:

Extract the first bvalue from the DWI list file that will be used for tensor fitting. ExtractBValVolume command is found in the DIFFPREP folder.

***Usage***

*ExtractBValVolume -i <processed.list> -b 0*

Output is processed_b0_1.nii. The extraction in this scenario is of the first b0 available from the data. You may also provide the volume number using the tag -v to create the binary mask. Provide the extracted volume to bet and the bet syntax to mask the data is as follows:

*bet <processed_b0_1.nii> <processed_mask.nii> -m -f 0.2*

Output will be processed_mask.nii.gz (this is the masked first volume) and processed_mask_mask.nii.gz (binary mask of the extract volume). paremeters such as 'f' and 'g' can be altered to create customized masks. Please examine the mask generate to ensure it has full brain coverage. Refer to FSL bet manual to provide the most appropriate tags to adjust the mask output.

=====================================

**Maps extracted from computed tensor**

=====================================

**AMPLITUDE**: a calculated reference (S0) image, calculated from the intercept of the tensor fitting.**TRACE**: the trace of the diffusion tensor. Mean diffusivity (MD) = 1/3(TRACE)**Dxx, Dyy, Dzz**: diagonal tensor elements**Dxy, Dxz, Dyz**: off-diagonal tensor elements**EIGENV1, EIGENV2, EIGENV3**: the eigenvalues**SKEWNESS**: the degree of oblateness or prolateness of the diffusion ellipsoid in each

voxel based on the skewness of the eigenvalues ((Mean–Median)/Mean)**CHI SQUARE**: a voxel-wise map of a measure of the goodness of fit. Not output by default but if the tag --save_CS 1 is used during*EstimateTensorNLLS***OUTLIER MAP**: for robust fitting only, the percentage of outlier data points removed before fitting (points removed/(total points-degrees of freedom)). Only available as output if tensor fitting performed with*EstimateTensorNLLSRESTORE***W_LINEAR**: Westin linear measure**W_SPEHRICAL**: Westin spherical measure**W_PLANAR**: Westin planar measure

Tensor elements and eigenvalues are reported in 10 ^{-6} mm ^{2} /s

**Naming convention of saved files from running ComputeAllTensorMaps.bash**

*Note: you may add commands listed in the DIFFCALC folder, to the bash script, to output additional maps listed below. *

**_DT**: 4D file containing the 6 tensor elements: already should exist before running the bash script to derive the maps listed**_AM**: Amplitude image**_EG**: Eigenvectors**_EV**: Eigenvalues**_SK**: Skewness**_FA**: Fractional anisotropy**_LI**: Lattice index**_RD**: Radial diffusivity**_AD**: Axial diffusivity**_TR**: Trace**_WL**: Westin linear**_WP**: Westin planar**_DEC**: Directionally encoded color map**_NSDEC**: Non symmetric directionally encoded color map

**** MAPMRI commands and definitions will be updated *

###### Please note: There is a WLLS (weighted linear least squares) tensor fitting command that can also be used to perform tensor fitting. The ouput is _L0_DT.nii and scalar metrics can be derived similarly using the commands listed in the diffcalc folder.This is generally used to check the quality of the data import. The scalar metrics derived from _L0_DT.nii are generally used to check FA, Trace, DEC map, NSDEC map and glyphs and this procedure is performed before processing the data through DIFFPREP/DRBUDDI. Please refer to 'section 5: quality check of imported data' portion of this documentation to get more details.

**Note:** Please cite the following if you use TORTOISE DIFFPREP, citation1:TORTOISE: an integrated software package for processing of diffusion MRI data, C.Pierpaoli,L.Walker,M.O.Irfanoglu,A.Barnett,P.Basser,L-C. Chang,C.Koay,S.Pajevic,G.Rohde,J.Sarlls,and M. Wu, 2010,ISMRM 18th annual meeting,Stockholm,Sweden, #1597.

**Note:** Citation2,TORTOISE v3:Improvements and New Features of the NIH Diffusion MRI Processing Pipeline,Mustafa Okan Irfanoglu1, Amritha Nayak,Jeffrey Jenkins,and Carlo Pierpaoli, 2017,ISMRM 25th Annual meeting,Honolulu, HI, #3540.