Thursday, 7 January 2016

Mouse Tensor data

Extracted the diffusion tensor successfully from the mouse data today using MrTrix3

Commands:

navigate to folder with scans in, used APQ_0299

cd scan1
ls
## In each folder scan1, scan2, scan3, there is a file EPIDW_N4.nii.gz which is the diffusion weighted scan in a .nii.gz format, the mask has been created by Nyoman and is there as mask.nii the gradient file is the same for all the scans and is encoding.txt which is located in the parent folder of all the scans, two folders back.

inside folder /scan1:
dwi2tensor EPIDW_N4.nii.gz EPItensor1.nii -mask mask.nii -grad ../../encoding.txt
will create the tensor file as a .nii

Repeat this step inside scan2 folder and scan3 folder, changing the output filename as desired.  I used EPItensor, EPItensor2, EPItensor3.

Check in mrview to see if there are no weird islands, artifacts or missing bits.

Then load in MATLAB using:

MouseTens1 = load_untouch_nii('EPItensor1.nii')

which will create the structure MouseTens1 with substructures hdr (header info) and variables ext (extension info), untouch, and img.  img is the matrix with the actual diffusion data/

MouseTens1.hdr.dime.dim gives the size of the array.  4 (time), 64,48,76 (x,y,z), 6 (diffusion matrix values), 1,1,1


MT1=MouseTens1.img;

will create a matrix size 64 x 48 x 76 x 6 which is our diffusion matrix

we should then be able to compare these matrices directly.


Principle eigenvectors:

The 4th dimension of the matrix MT1,MT2, MT3 contains the six components of the diagonal diffusion matrix.  Components 1, 4, 6 are Dxx, Dyy, Dzz, the magnitudes of the principle eigenvectors in the x,y,z directions. 

We extract these into three new matrixes:
MT1ev=MT1(:,:,:,[1 4 6])
etc.
we can then take the cross product via
Cross12=cross(MT1ev,MT2ev);
etc
and compare the cross product matrices. 
What is the best numerical value to use as a marker of change? 

No comments:

Post a Comment